A CesiumCartographicPolygon can even be used to apply other material effects. For instance, instead of hiding data, a CesiumCartographicPolygon can be used to highlight its contents in a bright color for visual emphasis. Ultimately, you can control how polygons work in your own 3D Tileset materials and customize their appearance.How can this be implemented specifically? Are there any examples?
Hi @jh007,
We don’t have any dedicated examples, but you can implement this by:
- Making a copy of
CesiumDefaultTilesetShader, which can be found in the package's
Resources` folder. - Making a copy of
CesiumDefaultTilesetMaterial
, also found in the package’sResources
folder. Set it to your copy of the shader graph. - Modify your copy of the shader graph as desired.
If you locate the texture called “_overlayTexture_Clipping”, you can see how the texture is being used as a mask to set the alpha of a pixel. You can change this behavior – for example, instead of setting alpha = 0, you can set the fragment color to bright red. This will cause pixels to be highlighted by the polygon, instead of being hidden.
Let me know if that makes sense!
@janine Thank you for your response. Can I render the material in a selected area as water material or other materials, similar to Cesium for UE?
@jh007 you can do whatever you want inside the area of the polygon by customizing the material. However, you’ll need to create the water effect yourself. We don’t provide a water material out-of-the-box in Cesium for Unity.
How to customizing the material,Any examples?I mean, I have a custom material, how do I apply it to the polygon area
There’s no way to apply a different material inside the polygon versus outside. You need to create a single material that renders in two different ways (water or land) depending on whether the currently pixel is inside or outside the polygon. I don’t think we have any examples of this, but Janine’s post above explains how it is done.