Screendoor transparency

Started by
23 comments, last by Kalidor 18 years ago
Hi, I want to render transparent objects in my scene, but sorting is out of the question. Does anyone know of any methods to draw transparent objects without sorting the entire scene back-to-the-front? I was looking into the Screendoor Transparancy technique, but couldn't find much information on it. Does anyone know how it works? I think I have to do something with GL_POLYGON_STIPPLE but don't know what exactly. Thanks for your help, Jeroen
Advertisement
A simple way is to use two passes;

pass 1: disable the color buffer, enable depth buffer, draw all geometry
pass 2: enable the color buffer, disable depth writing, then draw all geometry agian

This isn't perfect, but it is quick to implement [grin]

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Do you mean I have to draw the WHOLE scene geometry twice, or just the transparent geometry? If it's the latter, it seems like a viable solution to me.
You could do it like that, first draw all solid geometry normally, then draw the transparencies in two passes, I don't see any reason why it wouldn't work.

I just rendered all my geometry in two passes when I used the technique for a small test app, so I don't know for sure.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Just checking (because no one said anything)

This '2-pass' trick of yours works with the Blend() function, right?

I've been having the same problem. But I couldn't find a way. I sort of had the same idea, but I didn't know how I was souppose to go about it.
nope, doesn't work -_-'

the texture is drawn to the right depth, but although it's transparent you still can't see what's behind it due to the quad drawing in the 1st pass.

Last check, is there really no way to draw a transparet or masked texture without 'Disable()ing' the 'DEPTH_TEST'???
Quote:Original post by Farraj
Last check, is there really no way to draw a transparet or masked texture without 'Disable()ing' the 'DEPTH_TEST'???


Instead of disabling the entire depth test, just try disabling writing to the depth buffer : glDepthMask(GL_FALSE)

"There is no dark side of the moon." - Pink Floyd
I just finish googling 'glDepthMask()'

I never knew that there was such a thing :D

It draws the transparnt object naturally like any other 3D object but without saving it's current depth in the depth buffer (z-puffer??)

Now that's what I call using your head. :P

Although, I still don't understand why use only GL_FALSE to change the depthmask from one state to another and back?

Oh well :P

thanks Specchum.
Just disabling DepthMask isn't going to get you the results you're looking for; if you rotate around a bit, you'll quickly find solutions where the draw-order breaks up.

Your best bet is to draw opaque and alpha objects in seperate passes, sorting alpha objects by depth, and disabling Z-write on them when rendering.

Allan
------------------------------ BOOMZAPTry our latest game, Jewels of Cleopatra
Quote:Original post by godmodder
...
Does anyone know of any methods to draw transparent objects without sorting the entire scene back-to-the-front?
...
There's no need to sort the entire scene. __ODIN__ has it right, I'll explain in a (very) little more detail.
 - Enable depth testing and depth writing - Render all opaque objects (order doesn't matter here) - Disable depth writing - Render all transparent objects from back to front

This topic is closed to new replies.

Advertisement