Jump to content
  • Advertisement
Sign in to follow this  
Canazza

OpenGL Blending and depth testing question

This topic is 4477 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 there, i've been having some trouble recently with openGL. I'm modeling a solar system and i'm currently trying to render the sun. It's going to be 2 or 3 quads with a single texture on it, blended against the backdrop. a bit like this: http://img.photobucket.com/albums/v626/Canazza/2quads.gif my problem is that although each face blends with the backdrop and the planets, the second/third ones does not blend with the other ones. unless, i turn off depth testing, in which case, it isn't blocked by the planets. any help?

Share this post


Link to post
Share on other sites
Advertisement
Well that's the general problem of transparency... The Z-Buffer doesn't represent translucent objects any way, so you need to sort your alpha-enabled objects back to front and render without alpha writing on (alpha tests can be on). So your render order should be:

1. Render opaque objects with zwrites and ztesting on.(perhaps sorting front to back)
2. Render transparent objects with zwrites off and ztesting on (sorting back to front, to avoid artifacts)

NVidia has some sample of Order-Independent-Transparency, but I haven't looked into it if it could handle the case.

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!