I think your problem can be solved by inverting the material effect. This is making me realize that we should probably expose a parameter on the tileset to allow users to invert polygons without having to modify the material, so I created an issue for it here - Add a parameter for inverting Cartographic Polygon · Issue #721 · CesiumGS/cesium-unreal · GitHub
I’m not sure what the timeline would be on adding that, so in the meantime here’s how you can do it in the material:
- In the Content Browser of UE, find the material MI_CesiumThreeOverlaysAndClipping in the Cesium plugin folder/Materials/Instances. Right click on it and duplicate it.
- Open your duplicated material and find the blend asset MLB_CesiumClipping. Click on the magnifying glass to navigate to it in your Content Browser. (You can also find it in CesiumForUnreal Content/Materials/Blends.)
Duplicate MLB_CesiumClipping and name your new duplicate something easy to find. This is what you’ll need to modify. If you modified the original it would mean that all tilesets that use clipping would now be inverted, which you may not want.
- Open your new MLB. It should look like this.
The nodes at the bottom are the nodes that access the clipping mask. The “1-x” node inverts the mask. Under the hood, it already behaves as you need, but the material inverts it for standard use. All you need to do is bypass the 1-x node. Connect the R pin of BreakOutFloat3Components to the B pin of the Multiply node.
- Save your MLB. Go back to your duplicated Material Instance and replace MLB_CesiumClipping with your new MLB.
- Apply the new material to your tileset by changing the Material parameter in the Details Panel. It should clip everything outside.
Your high precision terrain should use this inverted material. Your global low-res terrain should use the original, non-inverted material, but they can both share a Cartographic Polygon and the Polygon Raster Overlay settings can remain the same. If that works as intended, there should be a hole cut out of the low res terrain in the exact area that the high precision terrain is, and the high precision terrain should only render in that area.
Let me know if this works.