Within a Cesium 3D Tileset I placed a Cartographic Polygon set to invert to isolate a section of terrain. I then added another Cartographic Polygon within the isolated area to clip out a piece of terrain. When I added the second Cartographic Polygon the effects of the first ceased to function, meaning the terrain was no longer isolated.
I am attempting to isolate multiple sections of terrain to remove existing buildings which will be replaced with my own models. Is this doable, using multiple Cartographic Polygons simultaneously?
With the default Material, you can only using a single CartographicPolygon (but it can have multiple polygons within it, if thatâs helpful). If you open the default material instance (called MI_CesiumThreeOverlaysAndClipping), youâll see that thereâs a material layer for clipping. You would need to make a copy of the material instance and then duplicate the clipping layer and give it a unique name. Then your second CesiumPolygonRasterOverlay needs to have a âMaterial Layer Keyâ that matches the name you gave the material layer.
In addition to the complexity, this is likely to make for a pretty heavyweight material. So itâs worth considering if you can solve your problem a different way.
I appreciate your responding. The answer is unfortunate. I was so hoping Cesium would fulfill my requirements on this project, but the limitations you described makes that seem to be an impossibility.
Thanks again for the answer. Have a great day!
Iâm surprised to hear you say itâs impossible, since I believe I just told you how it can be done. Itâs perhaps not as simple as weâd like, but certainly not impossible. Or did you run into a problem with that approach that you havenât mentioned?
Cesium for Unreal is open source, so you might also consider improving it yourself and contributing your improvements back.
I appreciate your confidence in my abilities, misplaced as it is . I did experiment with using the material instancing but the shear amount of instances that I need (30+) would make the project unusable. I think you have done a fabulous job making Cesium what it is so far. Thank you for the invitation to try and develop a workaround in the code, unfortunately I do not have the knowledge or the skill to do that sort of thing. Honestly I would not know where to begin.
Perhaps I am misunderstanding the process. I need to be able to remove multiple buildings (cut out) from the area I am working in so that I can replace them with my own models. Are you saying I can do this with a single material instance?
The capture below is just a sample to illustrate (It is not my project). The areas in red represent 3D buildings I need to remove from the Tileset and then insert my 3D models.
I appreciate your patience with my lack of understanding.
Yes, a single CesiumCartographicPolygonRasterOverlay can have multiple polygons. The only time you need two raster overlays (and therefore need the custom material) is when you need one set of polygons to exclude pixels inside them (for example, the buildings), and another to exclude pixels outside them (for example, to exclude all tiles outside of your area of interest).
I feel fairly silly. I had failed to try and add multiple polygons set to normal clipping. I will just do without the additional polygon set to inverted for now. Thanks for your invaluable assistance.
Hi Kevin, just wanted to expand on this topic of clipping material for multipolygons. I followed the steps to create a second CesiumPolygonRasterOverlay as need to also clip internally which seems to work, however sometimes when i move the camera or zoom the clipping gets distorted or clips other areas.
Is this because it is quite intensive for the engine to process or is there something additional in the settings i should add?
@mg281 Are you using the latest version of Cesium for Unreal, v1.27.0? This version fixed a bug where meshes outside of the polygon would get incorrectly clipped.
PleaseďźI need your helpďź
I am using three cesium polygon overlays to draw different colors of areas. Because I need three different materials, I have to use three overlays.
But I find that when I refresh the tilset, only one overlay can refresh,the other have no effect.
How can I solve this problem TAT
PSďźI mean,when I update the polygons of a polygon raster overlay, it can successfully color the area, but when I update another overlay, the previous overlayâs color will disappear.
I update overlay by using c++ script.I emplace a new polygon into overlay, and run overlay->Refresh() function.
If there is only one overlay, it is very normal, but I really need multiple overlays.
TAT
If you need to use multiple polygon overlays, youâll also need a custom material. Youâll need to copy the MI_CesiumThreeOverlaysAndClipping and duplicate the Clipping material layer once for each of your polygon overlays. Give each a different name, e.g. Clipping0, Clipping1, Clipping2. Then set the Material Layer Key in each overlay to match one of the material layer names.
This is likely to be a very expensive approach, though. A more performant approach would be to modify the Cesium for Unreal plugin itself to allow a value to be baked into each polygon. Then you could use a single polygon overlay with a custom material that colors the polygons based on their unique value. That will take some sort, though.
We canât help you backport changes to unsupported versions. But the full commit and PR history is in the public repo on GitHub, so feel free to take a look.