DepthTestAgainstTerrain only for Billboards?

DepthTestAgainstTerrain currently affects all Primitives.

Any suggestions for disabling DepthTest for just billboard collections?

Alternatively, is there any way to treat primitives that are occluded by terrain with DepthTestAgainstTerrain set to True so that the occluded portion is rendered differently? Like an X-ray view? or different shading/outline?

Thanks!

depthTestAgainstTerrain is an all or nothing setting, there’s no way to do it per-primitive.

Cesium doesn’t support the type of x-ray view you are describing and I think it would be a pretty complicated feature to add.

That being said, you may be able to do something with the billboard.eyeOffset to have a toggle that shows billboards behind terrain as if they were in front of terrain (as if depth testing is off just for those billboards). It would involve updating the z value of the eyeOffset for each billboard every time the camera is done moving and make it so the billboards eyeOffset.z property is the negative distance from the billboard to the camera - 1.

Hope that helps,

Matt

Thanks Matt!,
That is a helpful approach to try.

To expand on our core issue, we have Billboards with pixel offsets so that the location of the billboard corresponds to the center of the image. This looks great top down, but for Icons that are at Ground Level (when terrain is shown), when the camera pitches down, half of the icon is beneath the ground. Another idea we were tossing around was to extend the Billboard so that, like ScaleByDistance and TranslucencyByDistance, we could adjust the pixel offset based on the tilt of the camera. So that if the camera tilts down > 45 degrees, we could slide the offset down to the base of the icon, so that at ground level, the icon will appear above the map.

Any thoughts on that?

The half-buried problem is already solved at the primitive level via the Billboard.heightReference property, however that features hasn’t made it into the Entity API yet (but hopefully will soon). If you’re using the Entity API, your best option is to just wait for the heightReference property to be made available.

Hi Matt. Thanks.

What version of Cesium supports CLAMP_TO_GROUND for billboards?

I get a ‘height reference not supported’ exception when I try.

Never mind. I see it in 1.14.

Unfortunately, our billboards have to be pinned at the center of the image.

So even clamped to the ground, the exact alt will still have half of the icon in the ground.

Clamped to ground, and pinned to the bottom is the only way to achieve that treatment of the icon always being above ground.

So let me ask you this. Would it be possible to extend/add to the logic that sets transparency and size based on camera distance?

My thought is to make he altitude of the billboard increase as the camera is farther away, to make sure that the icon continues to appear above the ground completely. (by moving it up as the camera moves away).

Possible?

The only other option is to adjust the hotspot of the icon as the camera tilts, so that when you are tilted all the way down the hotspot is on the bottom. And when you are topdown, it is in the center.

Hello,

Do you have the vertical origin property set to verticalOrigin: Cesium.VerticalOrigin.BOTTOM?

That should keep your billboard on the surface instead of half in the ground.

-Hannah

I have set the eyeOffset for billboards to -ve z value based on the camera height and i have set depthTestAgainstTerrain to true
But the billboards seem to disappear as i zoom-in and the ones at the centre of the canvas seems to disaapear first
This issue occurs only when depthTestAgainstTerrain is set to true and terrain is on
Is there any way i can resolve this issue?
Thanks !

Could you paste a code sample that causes this to happen?
This might happen if the eyeOffset has a greater value than the camera distance, but I’m not sure if that’s what is happening in this case.

-Hannah

Thanks Hannah, Unfortunately, I dont think we can use VerticalOrigin Bottom because when looking top down onto a map, the icons actual location is at the bottom of the image, and not in the center.
This gives you an improper impression of where the item represented by the icon is located. We use pixel offset to specify the correct offset to center the icon over the location.