Are the Polygon Raster Overlays only available in the editor or is it possible to use spawn and update them at runtime?
It should be possible to attach the
CesiumPolygonRasterOverlay component at runtime. However, I’m trying to prototype it myself and I don’t believe it currently works.
What is your use case? Maybe we can find an alternative solution?
Actually, I was able to get it working. You can set up your Blueprint like so, or use the equivalent C++ functions:
This Blueprint adds the
CesiumPolygonRasterOverlay component to the desired tileset. Then, it sets the
CesiumCartographicPolygon array that the raster overlay should use. Finally, it refreshes the overlay so that the new polygons take effect.
Let me know if you have any questions!
This is perfect! Thank you so much!
I am going to tinker with this. Do you know if it is possible to use the raster overlay to swap the google tiles with the bing aerial map tiles? Basically, at runtime, I am trying to remove the google map tiles in a user specified area and place the flat map so they can build in that area.
Yes, it is possible. (I assume by Bing Aerial Map Tiles, you mean Cesium World Terrain with Bing Maps imagery.)
CesiumPolygonRasterOverlay offers an “Invert Selection” option, which toggles whether the tiles inside or outside the polygon should be excluded. Basically, you’ll want to:
- Add a
CesiumPolygonRasterOverlaycomponent to each tileset.
- For Google Photorealistic 3D Tiles, make sure “Invert Selection” is false to exclude the tiles inside the polygon.
- For CWT with Bing Maps Imagery, set “Invert Selection” to true to exclude tiles outside the polygon.
You can set the “Invert Selection” setting via Blueprints. Be sure to do this before refreshing the overlay!
I’ll also shout out this Epic Games tutorial, which uses a geometry script to replace excluded tiles with a generated 3D mesh. This can result in a flatter surface to build on compared to Cesium World Terrain.