Billboards being rendered behind terrain

I've been working on allowing map features to be drawn on top of terrain rather than at sea level and I'm now hoping to get billboards to render behind the terrain rather than showing through it. I notice that this functionality exists when viewing billboards at such an angle that they are above the horizon. (

Does anyone have some quick pointers on how I might enable this from all angles?

-- David

Hi David,

I’m not sure I understand what you mean by “render behind the terrain rather than showing through it.” You mean you want billboards to be hidden by terrain if they are behind it? I believe that should already work.

You might be able to tweak the billboard’s height or eye offset. We are still working on the terrain implementation - it is not in master yet - and expect ongoing work to make polygons, polylines, and billboards play nice with terrain. In particular, parts of a billboard may sink behind terrain; we want it to be either completely visible or completely hidden. Is this what you are asking about?



This is actually broken in the terrain branch at the moment. As a quick fix, open up CentralBody.js and comment-out these lines:

// TODO: clearing depth here will not be acceptable for actual terrain.


You may still have the artifacts Patrick mentioned, but it should get you closer to what you’re looking for.


Thanks guys!

Patrick: I have noticed the problem of points sinking into the terrain, but right now I'm just concerned with getting points to be hidden when behind the terrain at all when not viewing at a very shallow angle.

Kevin: Thanks! I'll try this as soon as we pull in your latest revision.

-- David