# Able to see shapes underneath globe?

**URL:** <https://community.cesium.com/t/able-to-see-shapes-underneath-globe/714>\
**Category:** CesiumJS\
**Created:** [September 12, 2013, 2:37pm UTC](https://community.cesium.com/t/able-to-see-shapes-underneath-globe/714 "2013-09-12T14:37:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![adam.dunnage](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@adam.dunnage](https://community.cesium.com/u/adam.dunnage)\
**Post date:** [September 12, 2013, 2:37pm UTC](https://community.cesium.com/t/able-to-see-shapes-underneath-globe/714/1 "2013-09-12T14:37:39Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Kevin\_Ring](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/kevin_ring/32/2003_2.png) [@Kevin\_Ring](https://community.cesium.com/u/Kevin_Ring)\
**Post date:** [September 13, 2013, 3:29pm UTC](https://community.cesium.com/t/able-to-see-shapes-underneath-globe/714/2 "2013-09-13T15:29:45Z")

</div>

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.

Kevin

---

<div class="post-metadata">

**Author:** ![adam.dunnage](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@adam.dunnage](https://community.cesium.com/u/adam.dunnage)\
**Post date:** [September 13, 2013, 3:54pm UTC](https://community.cesium.com/t/able-to-see-shapes-underneath-globe/714/3 "2013-09-13T15:54:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![adam.dunnage](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@adam.dunnage](https://community.cesium.com/u/adam.dunnage)\
**Post date:** [September 16, 2013, 7:48am UTC](https://community.cesium.com/t/able-to-see-shapes-underneath-globe/714/4 "2013-09-16T07:48:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kevin\_Ring](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/kevin_ring/32/2003_2.png) [@Kevin\_Ring](https://community.cesium.com/u/Kevin_Ring)\
**Post date:** [September 16, 2013, 11:32am UTC](https://community.cesium.com/t/able-to-see-shapes-underneath-globe/714/5 "2013-09-16T11:32:33Z")

</div>

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.

Kevin

---

<div class="post-metadata">

**Author:** ![adam.dunnage](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@adam.dunnage](https://community.cesium.com/u/adam.dunnage)\
**Post date:** [September 16, 2013, 12:16pm UTC](https://community.cesium.com/t/able-to-see-shapes-underneath-globe/714/6 "2013-09-16T12:16:15Z")

</div>

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.
