Walls don't always extend to surface when terrain is enabled

If you check out the sandcastle at the end of this point, then zoom in close to the northern end of the wall and rotate around, you’ll see that the wall isn’t actually reaching the surface as it normally does. I’d really like to be able to extend it down to the ground. Possible, or no?

There are two separate things at play here. By default, geometry is not clipped against terrain (to avoid problems with the way Cesium currently handles polygons and other vector data draped on terrain). To change this you can set

viewer.scene.globe.depthTestAgainstTerrain = true;

after constructing the viewer. Your wall will now successfully be hidden behind terrain.

The second issue is the fact that walls only extend to height 0 of the ellipsoid by default. This means that if you are using terrain and the terrain is below the ellipsoid, the wall will not extend far enough to touch the ground. The way to fix this is by adding an array of minimumHeights, where each item represents the bottom of the wall. Since positions has 2 values, you would add

minimumHeights : [-1000, -1000],

to the wall object in your code. I used 1000 as an example, but there’s probably smaller values should work too. The above code makes the wall extend 1000 meters below the ellipsoid. It’s still clipped by terrain, but there should be no space between the terrain and your wall.