Jump to content
  • Advertisement
Sign in to follow this  
godmodder

Screendoor transparency

This topic is 4492 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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'???

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!