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.
I did experiment with using the material instancing but the shear amount of instances that I need (30+) would make the project unusable.
I’m not sure why you would need 30 materials. Can you elaborate?
If you’re moving on, that’s fine too, and best of luck with your project.
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.
Hi, I am using v1.26.0 as that’s the only one available on the market place. would i have to install the v1.27.0 from the github ?
Ah right. We submitted our 1.27.0 release to Epic for review, but they haven’t actually published it to the Marketplace yet.
You can install v1.27.0 from Github for now, or wait until Epic publishes the files. Sorry for the inconvenience.
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.
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.
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.
Thanks. I have found that my problem is I use the same material layer for different overlays.
Now the effect is normal.
Hello, I want to fix this problem in version 1.24. May I know how to fix it and where to check the repair record? Thank you very much
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.