View Full Version : Depth Testing Blended Objects
02-08-2003, 07:05 PM
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?
02-08-2003, 11:04 PM
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.
02-19-2003, 07:29 PM
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.
02-19-2003, 11:05 PM
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).
glEnable( GL_DEPTH_TEST );
glDepthMask( GL_TRUE );
glDepthMask( GL_FALSE );
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.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.