Jump to content
  • Advertisement
Sign in to follow this  
Leo_E_49

Alpha blending multiple layers in a complex scene

This topic is 4828 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

Ok, generally when I want to render an object alpha blended, I disable depth testing and backface culling. However, the problem with this is that an alpha blended object will always appear infront of all solid objects in a scene, creating some really wierd effects if you are supposed to have a solid object pass between you and the transparent object. If I don't turn off depth testing, some (front and back) surfaces of the alpha blended object seem to cancel each other out, which causes the overlap to appear completely transparent. (Like a subtraction effect) What am I doing wrong here? Surely I don't have to depth sort everything by hand to get objects to render in the right order?

Share this post


Link to post
Share on other sites
Advertisement
I think what you want to do is not disable z-testing, but disable z-writing. That way the alpha blended object should still be compared to the existing depth buffer of the rest of the scene (assuming you render alpha objects last).

By disabling z-writing, several billboards or objects will not depth cull each other out. This should work for most cases. Is there any special situation where this wouldn't work?

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!