Polygon rendering a minefield with terrain

1. A concise explanation of the problem you’re experiencing.

I’m trying to get a polygonGraphic(2D plane mapped to the terrain) to clamp to the terrain. I’m not setting height or extrudedHeight, but I am using an ImageMaterialProperty with a CallbackProperty for the repeat property. Image attached. Is this just a limitation of PolygonGraphic? The original set of points I was using for the hierarchy property didn’t have elevation values, but I did try to get the elevation values from the Cesium.sampleTerrainMostDetailed function.

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

The code is quite involved, but I can probably create a sandtable example if this does sound like a bug.

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

This feature is a standard military(2525) way of representing a minefield on a map. See the attached photo. Basically the polygon’s material should scale based upon the screen space. The larger the area on the view the higher the repeat value should be set for the ImageMaterialProperty.

4. The Cesium version you’re using, your operating system and browser.

v1.36, windows 7, chrome

Thanks,

Scott

Hi Scott,

Polygons are able to clamp to ground, see this sandcastle example, and select “Draw Polygon” from the dropdown: https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Ground%20Clamping.html&label=Showcases

If you provide a snippet of the relevant code in a sandcastle example, it will be easier to deduce what the problem is and track down a bug if there is one.

Thanks,

Gabby

I think I remember that only solid colors or predefined materials clamp to the ground correctly? Am I wrong? This material is mostly transparent and is dynamically being set with the callbackProperty. I could see why this is causing an issue computationally.

Scott

Yes, I see. GroundPrimitives only work with color materials, see this GitHub issue. Their materials can have an alpha value and can be swapped out in a callback function, but I can see how that wouldn’t serve your needs here.

There’s been some work done in this branch on getting other materials working, and I’ll add a comment in the GitHub issue that this feature was requested again.

Thanks,

Gabby