Polygon always winning against terrain


I'm trying to use the Cesium Polygon object to draw the upper and lower
planes of airspaces, where sometimes the airspace lower plane is below
the terrain. unfortunately in this case, the Polygon object 'shows
through' the terrain, even though I have

widget.centralBody.depthTestAgainstTerrain = true;

other vertices, that I'm drawing myself (the 'side walls' of these
spaces) show correctly (the terrain cuts the appropriately)

I wonder how can one achieve for the terrain to cover the polygons if


oh, I forgot to include a sample that shows the issue:

Hi Akos,

The polygons are meant to be drawn on the ellipsoid without terrain so they rely on backface culling instead of the depth test, which avoids z-fighting. As a quick workaround, you can add the depth test. See Line 734 of Polygon.js. Again, the static geometry batching is going to help a lot here, as we’ll be able to explicitly define an object’s render state without having to write custom rendering code for everything like we do now.



thanks, I forced a different render state there with a depth test
and no back face culling, and all is showing fine now!
here is the result: I see. is there any way I can help out?

Hi Akos,

I see. is there any way I can help out?

Yes, please. See #766. We welcome pull requests, especially for new geometry types. If you haven’t already, check out CONTRIBUTING.md for details on how to contribute. It will be perhaps three weeks before we get the batching branch in shape for master so pull requests into the batching branch are OK.



looks great
what’s the status of the batching branch? I saw the list of features
/ tasks listed on the #766 issue page - are these all tasks to be
completed still, or are some already done?


Anything with an open checkbox - which is everything right now - still needs to be done. New geometry types are probably the best way to contribute. We’re happy to have you cherry pick some; just let us know so we don’t duplicate the work.



I cloned the batching branch - is there a 'playground' or samples where
I can see for example BoxGeometry or some of the new primitive features
at work?

I tried to load the sandcastle, but I got a bunch of 404 not found
errors when loading :frowning:

Just run Cesium Viewer. There’s some (messy) sample code in CesiumViewer.js.


indeed - great, thanks!