Clamped to ground side-by-side polygons appear to have different heights

We’re drawing a set of contours using the entity API and PolygonGraphics. And each “smaller” contour is defined as a “hole” in the hierarchy of the next larger contour.

We want the polygons to be filled with transparent colors so that the map below can be seen. And we want the polygons to be clamped to ground.

When we use the default clamped to ground behaviour supported by the polygon entity the result looks good in some places (such as San Francicso)

But in other locations (such as New York) the polygons appear to be drawn at different heights. And as you tilt the scene they appear to change in height relative to each other… or there’s somewhat of a parallax effect maybe due to seeing through the terrain/map surface?

You can hardly detect the issue when looking straight down on the contours/polygons

We’ve tried every combination of properties we can think of when drawing the polygons including setting height and heightReference, providing height for each position defining the polygons and setting perPositionHeight to true, experimenting with zIndex. But we either get the issue with the heights of the polygons appearing different (like the New York example above) or we get terrain bleeding through the polygons.

However, simply allowing the polygon entities to clamp to ground (default behaviour) works very well in other places (like the San Francisco example above).

We would like to take advantage of the default clamp to ground behaviour.

Any ideas about what is causing this? Is there something we can do to address this issue?

Hi there,

Do you have terrain enabled, or are you using the base ellipsoid?

I suspect the issue may be stemming from this. We have a file, ApproximateTerrainHeights.json, which is shipped with CesiumJS and contains a course map of terrain heights at different locations. It’s values are used to define the rendering heights of ground primitives.

If that’s the case, and you are only using the base ellipsoid, you may be able to remove ApproximateTerrainHeights.json to eliminate the issue.

Hi @Gabby_Getz, thanks for the response and suggestion. I’ve been out the past week, but another member of our team discovered that we were not populating the holes correctly. I’m not sure of the details yet but wanted to say that we discovered it was an error on our part (which we discovered by trying to create a Sandcastle example).

Thanks again.