Depth Testing Blended Objects

Is there any way to enable OpenGL depth testing for blended objects? Using glDepthFunc(GL_LEQUAL), anything behind the “transparent” object aren’t shown…

I’m using the method of transparency described in the NeHe tutorials, which i understand suxxors… could this be part of the problem?

There is no problem enabling depthtesting for blended object’s, there is no difference from odinary objects, but if you do have depthtesting on and you render the blended object first, nothing that is rendered later will be able to show up “behind” the blended object just as you describe, could that be the problem maybe ?

With depthtesting on you must renderer all transparent object at the end.

Mikael

alright… that’s what i was wondering. Thank you very much…

So, basically I should keep all my transparent objects stored seperately from my regular objects and render them in two batches?

Also, is there anyway to render transparent objects with fogging enabled and not get insane FUBAR-age? The problem is that by disabling fogging for the transparent objects they aren’t effected by the fog, and are thus visible from miles away.

You should also remember to disable depth buffer writing when you draw your transparent objects, or you will end up with transparent objects that completely occlude other transparent objects (not what you want).

do:

glEnable( GL_DEPTH_TEST );
glDepthMask( GL_TRUE );

draw_solid_objects();

glDepthMask( GL_FALSE );

draw_transparent_objects();

Is there really needed to disable the depth writing?

Since to get correct transparency we have to render back-to-front, we should get anyway the correct result (maybe with lower performance anyway).

Anyone here took a look at the order-independant transparency demo from nvidia? I wonder if the new fragment program technologies would help us there…
Uhm, they probably can.