3D Models are visible through terrain (moving from Google Earth to Cesiumjs)


I have a vehicle that I can drive around the world, the camera is following that vehicle (keeping it always in view), and I have the terrain meshes loaded. The issue that I am experiencing is that if I am on one side of a hill and another vehicle (3D model) is on the other side of the hill, I can still see it through the terrain. The same happens for billboards and labels.

Is there a way to prevent this from happening?

Hi Andrew,

I would not expect this. Can you provide a screenshot?



Check it out https://dl.dropboxusercontent.com/u/3050123/cesiumjs_terrain_issue.png

Hmm. I would not expect this. Can you send me

  1. a link to the app
  1. the glTF model



You can access the app by going to https://youbeq.com (you have to register first in order to use it).
I just deployed the Cesium version today to the production server. I'm doing the first public testing (fingers crossed for no weird bugs appearing), and next week will start announcing the switch from GE to Cesium.

These are the links for the two planes in the picture:

Thanks. Will have a look at the models.

From the view below, the depth test looks good. I’ll look into it more soon.


No matter which 3D model I test there is always this issue. I will also do more testing in other browsers and computers.
Thanks for the help.


Thanks for sharing the models and the link to your app. I’m having so much fun with it.

As for this issue, can you try setting this flag:

viewer.scene.globe.depthTestAgainstTerrain = true;

Looks like the base layer picker widget (which you are not using) sets this to true so I mistakenly thought the default was true.

Kevin - are we sure we want to expose this instead of just setting it based on the terrain provider? What is the use case? Work around artifacts in a particular app we built? Or perhaps we set this based on the terrain provider and an optional user override. Let’s discuss in #2160.



I'm glad you are having fun with it.
I just tested it and that solved the issue, don't know how I missed such an obvious flag.

Thanks for the help Patrick.


Awesome - I’m glad it worked for you. We are going to change the default to true so this should not be an issue for future developers.