Able to see shapes underneath globe?

How can I stop this from happening? I have been looking at horizon culling but I am not sure if I am on the right tracks? Is there a simple few lines of code that will stop the application from showing the part of the shape that is underneath the globe?

Hi Adam,

CentralBody has a “depthTestAgainstTerrain” property. Setting that to true will get you a lot closer to what you’re after.

viewer.getPrimitives().getCentralBody().depthTestAgainstTerrain = true;

This is off by default because it can lead to artifacts. In particular, objects that are near the globe surface will sometimes be considered partially or fully underneath the surface due to limited depth buffer precision as well as changes in the shape of the surface at different levels of detail. We’ll have a solution for this eventually, but it’s a very difficult problem.


Okay thanks for the help! I will add that to my application and see what happens.

I have attempted using this and still get the same outcome...

Can you share a screenshot and your code that is setting the depthTestAgainstTerrain property? If it had no effect at all, it’s likely that you’ve mistyped something or the problem you’re seeing is not what I think it is.


I am testing it in the volumes sandcastle example. I have entered the code:
viewer.scene.getPrimitives().getCentralBody().depthTestAgainstTerrain = true;

Yet I can still see the half of the sphere that is underneath the globe.