Cartographic Polygons for Real-Time Clipping

Is it possible to use Cesium Cartographic Polygons and Polygon Raster Overlays to clip tile sets to a smaller area, similar to how ProjectAnywhere XR functions, in a real-time scenario? The box collider/volume-based approach is undesirable in my case. Desire is to make visible only the area of the tile set bounded by the Polygon as the terrain is moved through the bounding area and scaled. Any insight is appreciated.

Hi @jLes,

It should be possible, but it likely won’t be performant. You would probably need to apply an offset to the Cartographic Polygon’s globe anchor position and transform scale every time the terrain is moved, in order to prevent the polygon from moving and scaling with your terrain. Then, you’d need to refresh the tileset every frame when moving the terrain. I haven’t tried it, but I’m guessing all of that will be too expensive for a realtime application.

Because Cartographic Polygons work by rasterizing the spline information to an overlay based on geographic location, they’re inherently optimized for use at specific geographic locations. The box collider option doesn’t need globe awareness, which would make a lot of things easier in trying to achieve this effect. Is there a reason the box collider/volume approach won’t work for your project?


Hi @agallegos,

Thank you for your response! I can confirm that refreshing the tileset even close to the frequency needed for real-time seems to be very expensive.

I was interested in essentially allowing n-gon geometry clipping zones, and just arbitrary geometry based clipping in general. Mostly an aesthetics issue, but I was just curious about the potential of the cartographic polygons. It seems like the collider based version presented is also very limited specifically to box colliders (rectangular-prism geometry) where the width, length and height of the shape are fixed. It would not be possible to use a custom collider geometry to the same effect, correct?

Hello @jLes,

Are you referring to the Cartographic Polygons when you mention the custom collider geometry? The polygons are splines that you can add more points to and create complicated shapes with. The only constraint is that Cartographic Polygons are 2.5d.

For your case, you can probably define a volume in world space (cube, sphere, or something more complicated). Send the details of that volume (pos, radius, etc) into a Material Parameter Collection (MPC). Then create a custom tileset material - add a new layer to a copy of the default tileset material and put it in the override material slots in the tileset details panel. You should be able to access the volume data in the new material layer through the MPC. You can compare the volume to the current texel world space location in the material, set the opacity mask to 0 if the texel is outside the volume.

Unlike the cartographic polygons case, you should be able to move this volume at runtime with minimal cost (just remember to update the MPC of course). Unfortunately the tile culling will not work outside the volume, tiles will still be loaded even though you can’t see them. If the performance becomes an issue, you could implement custom tile culling quite easily in C++ within Cesium for Unreal / Cesium Native.

I haven’t tried this, but it should work with some experimentation and tweaking. @agallegos does that sound about right?


Hi @Nithin_Pranesh,

So, I was more referring to a static mesh actor with a custom ‘Simple Collision’ model defined. But your answer still helps. It seems like, using a MPC, I can grab the volume characteristics of a non-standard (box, sphere, pill) collision mesh to alter the tileset material. I guess I need to learn more about MPCs. Do you think I could use them to do something like this:

  • Use vector fields of the MPC to define the boundary of an N-gon
  • Add in a scalar field for the height of the volume
  • Use this volume as a clipping volume of the tileset material?

Yup that’s the workflow I was imagining! Let us know if something along those lines works for you, again I haven’t tried it myself but it sounds reasonable.