Rendering semi-transparent objects.

I am currently trying to render some semi-transparent objects to the screen, however, there is no way for me to render them from back to front in order to give the correct blending.

Are there any proper ways of doing this successfully or does anyone know of any work arounds.


Well you could turn off depth writes and optionally use different blend functions for better results. It really depends on your desired effect and the opacity in question.

I agree with dorbie, but in the end, depth sorting is the way to go. What do you mean by “no way … to render them from back to front”?

Well the program I am writing that is having the problem has the facility to load additional drawing routines. Each of these plug-ins draws correctly (back to front) but obviously when loading more than one things go a bit pear shaped.

I was hoping that OpenGL might allow for greater than 1 bit depth and alpha buffers that may have been possible to allow for this but I think they don’t (would be very inefficient to).

Thank you for your help. I’m currently trying a few different blending options for some of the plugins to see if that helps enough when depth testing is turned off.

No, keep depth TESTING on, turn off depth WRITES.

Use glDepthMask to do this.

[This message has been edited by dorbie (edited 02-10-2004).]