Jump to content
  • Advertisement
Sign in to follow this  
TheBuzzSaw

The Transparency Conundrum

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

I have been working on my scene graph in C++, and I am fairly pleased with results so far. However, I have run into a major roadblock; I know I cannot be the first with this problem. I am curious as to what the accepted solutions are.

After my scene graph tree updates all the matrices, I place the items into buckets (to be rendered) organized primarily by shader. (I plan on sub-organizing by texture soon because I understand that to be an expensive operation as well.) However, now I am stuck on the issue of transparency. I have my buckets sorting the items by distance from the camera in order to properly render from back to front (for proper transparency). What do I do if I have items A B C D E where A C and E are in one bucket but B and D are in another? Do I really have to bite the bullet and rapidly switch shaders/textures to draw them in the right order? Is there another solution I am unaware of?

Share this post


Link to post
Share on other sites
Advertisement
You'll have to render semi-transparent objects after all the opaque objects. You're free to sort the objects within those two groups any way you like.

Share this post


Link to post
Share on other sites

You'll have to render semi-transparent objects after all the opaque objects. You're free to sort the objects within those two groups any way you like.


The sorting of the semi-transparent objects matters. You have to sort them back to front for most situations. The only exception that I know of is if you are using cumulative transparency (accumulating colour*alpha in the colour buffer) and have depth writing turned off.

Share this post


Link to post
Share on other sites
Graphics hardware has now advanced to a point where OIT (order independent transparency) is often just as fast, or even faster than the age-old CPU presorted transparent geometry. With the added benefit of pixel perfect transparency in all cases, the availability of much more advanced programmable blending and the possibility to easily add thickness dependent effects like refraction or fogging.

I've switched my engine to OIT some time ago, removing all this distance sorting crap. I never looked back.

Share this post


Link to post
Share on other sites
How does order independent transparency work?

To OP: Your objects with any sort of transparency should have a separate bucket and it should be the last bucket to draw.

Share this post


Link to post
Share on other sites

Graphics hardware has now advanced to a point where OIT (order independent transparency) is often just as fast, or even faster than the age-old CPU presorted transparent geometry. With the added benefit of pixel perfect transparency in all cases, the availability of much more advanced programmable blending and the possibility to easily add thickness dependent effects like refraction or fogging.

I've switched my engine to OIT some time ago, removing all this distance sorting crap. I never looked back.


I am very interested in hearing more about this. I had no idea we had progressed to this point. How does one go about achieving this OIT? I am using GLSL for all my rendering. What is the next step?

Share this post


Link to post
Share on other sites
Things to google for would be "depth peeling", "weighted average" or "weighted sum" in combination with order independent transparency. Or get a quick overview of some methods (from 2008) here: http://www.slideshare.net/acbess/order-independent-transparency-presentation

Share this post


Link to post
Share on other sites

Me too actually... is this something exposed by the graphics card as a feature?


No, it is not. It is a technique that you implement.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!