Jump to content
  • Advertisement
Sign in to follow this  
draktheas

Depth buffer and alpha blended or transparent objects

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

We are having some problems with our depth buffer based post process effects and it is mostly due to transparent (or alpha blended) objects in the scene. This seems like quite the common problem with post process effects and wanted to see if there is an easy way to solve the problem. Basically I want the depth values for alpha objects to write their z values to the depth buffer as if they were not transparent. Any suggestions? Thanks, Drak

Share this post


Link to post
Share on other sites
Advertisement
How are you doing alpha, exactly? Or depth buffering, for that matter? If you have a roll-your-own Z-buffer, just write the vertex depth out as you would any other one, if you're feeling really fancy perhaps even implement an alpha test here or there?

Share this post


Link to post
Share on other sites
This is a really common problem. You can potentially do the following:

You can render the transparent objects a second time into the depth buffer. Then you will only blur the closest object. Depending how transparent it is that might not look perfect. If you have something like a billboard then it will look awful. For billboards or objects that have an alpha channel, use the LOD bias instead as you render it into the scene. So the final process could be something like:

- Render your opaque objects
- Sort/Render Translucent objects
-- If the object is a billboard then use mip-lod-bias based on depth
- Render translucent objects again into the depth buffer
-- Excluding billboards etc from above
- Post-Process DOF

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!