View Full Version : drawing transparent objects

04 April 2005, 10:26 AM
hello, i understand that if you want to render transparent objects correctly, you turn off the depth test, right?

but what if a transparent object is behind an opaque one? then it will still be drawn infront of it?

whats the solution to this problem?


04 April 2005, 04:13 PM
you sort the objects by pseudodepth before drawing.
then you draw the opaque objects, lock the zbuffer and draw the transparent ones.
hidden transparent objects will fail the test and not be drawn.

if you have resolved object-intersections then the drawing will be correct.

04 April 2005, 08:36 PM

so i have to calculate the rendering order each time before i draw the frame?
cause if the camera rotates then the transparent object may be infront of the opaque one.

and what if i have a transparent object completely surrounding an opaque one (like when i visualize a boundingbox) then there will always be polygons of that will be infront and behind the opaque object.

04 April 2005, 02:12 AM
You might like to have a look at 3D Game Engine Design and Architecture by Dave Eberly.
The Ogre 3D engine may also give you some clues if you want to look at some code.
If you want to look into k-d trees, there is a good discussion in Graphics Programming Methods - edited by Jeff Lander.
These resources are also good for many other things and I have found them to be invaluable.

CGTalk Moderation
04 April 2005, 02:12 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.