depth test & transparency

Hi,

I have a question on displaying polygons (well, actually 'bodies') in
Cesium, which are transparent, but which have a somewhat peculiar
property in terms of depth tests.

on one side, these bodies should be 'covered' by the terrain, thus, they
should be part of the depth tests.

OTOH, as they are semi-transparent (alpha value of 0.4), I'd expect the
various bodies to be shown 'behind' or 'inside' other bodies.

now, what I have put together, which uses the Cesium Polygon objects
modified so that:

        upperPoly._rs = scene.getContext().createRenderState( {
            depthTest : {
                enabled : true,
                func : Cesium.DepthFunction.LESS
            },
            blending : Cesium.BlendingState.ALPHA_BLEND
        });

the interesting result is that while the it does the depth test properly
against the terrain, and the terrain itself is seen through the
semi-transparent polygons - the polygons / bodies behind / inside are
filtered out.

to see an example, see here: http://akos.maroy.hu/~akos/c/ - where there
is a 'red box' in the camera focus. but if you move 'up', it will be
hidden by the blue body that encompasses it.

(even more interestingly I've seen this working properly once)

what would be the proper way to achieve the see-through effect desired here?

Akos

Akos,

You can try:

    upperPoly._rs = scene.getContext().createRenderState( { 
        depthTest : { 
            enabled : true, 
            func : Cesium.DepthFunction.LESS 
        },

depthMask : false, blending : Cesium.BlendingState.ALPHA_BLEND
});

Also, with the new static geometry batching, we will be able to define “appearances”, which contain render state, instead of having to, err, tweak the polygon primitive like we are doing now.

Regards,

Patrick

this didn’t seem to have helped :frowning:
ok, I’ll start migrating to & working on the batching branch…
Akos

Hmm. Strange. Let’s worry about it in the batching branch if it is still a problem.

Patrick