Jump to content
  • Advertisement
Sign in to follow this  
Anand Baumunk

DX11 (Order Independent) Transparency

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

Hello guys,

I started implementing transparency in my engine, and I got stuck on the usualy problem, I think, even thought I can't find very much helpful stuff on this.

I use a classic blendmode for transparent objects, and order them by the distance from the cam before drawing. This works fine if they are just a bunch of objects on behind another, but as soon as I rotate them or a model contains multiple polygons which have to been blended over oneanother, it becomes problematic.

For the rotationpart, I suppose I need a way to check the point of the object closest to the cam, and order them by this point rather than by just their position.

But I can't see someone preordering the triangles inside a mesh to get which transparent one needs to get drawn first.

As a solution, I have read about Order Independent Transparency, which is only for dx11, but that would be fine with me. I can't seem to pick up a good tutorial on this, so I may aswell ask you for one.

Or do you have another way of fixing those two problems?

 

Thanks so much!

-gnomgrol

Share this post


Link to post
Share on other sites
Advertisement

I had some help earlier on a similar issue, if you search for the topic "Rendering Intersecting Premultiplied Transparent Planes" and look at the Billboard example in the Microsoft XNA samples site they show how two passes can be used to prevent intersecting planes from creating weird depth effects.

Share this post


Link to post
Share on other sites

There's the 'OIT11' sample in the DirectX SDK. It's an expensive technique, though. You can often get away by using simple additive blending.

Share this post


Link to post
Share on other sites

Additive blending is the only blending that can be drawn without drawing back to front, yes, for everything else I always implemented a simple binary tree that receives all the triangles being sent to the renderer, inserting them into the tree based on their distance, and then when its time to draw them to the screen I just walk the tree drawing from back to front, deconstructing the tree as the triangles are rendered. This entails building a new tree each frame, but it could be set up to only build a new tree once things have moved around enough to require a new tree being built. Also, for large triangles that could be intersecting eachother this won't work properly, but it works well enough for most cases. If you have a lot of triangles in your scene, its better to precompute something like a BSP tree for the static geometry, as it wouldn't be very efficient to rebuild a distance binary tree every frame (or even every couple of frames) for tens-of-thousands of triangles.

Share this post


Link to post
Share on other sites

Hi!

 

What you ended up using is called „alpha test“ and is not truly a solution to the blending of many transparent objects, though it is a common hack to avoid the problem.

Whenever you really need to approach true order-independent transparency, there are a number of methods:

  • Depth peeling [Everitt 01, Bavoil & Myers 08] (Requires to know the number of layers, but was used quite often in research papers. Also works on Dx9.)
  • Concurrent linked list construction [Yang et al. 10, Yakiimo 10]-> do not look into the DxSDK sample (OIT11). Last time I looked, it was poorly implemented (didn’t use shared memory at all).  Check the version of Yakiimo. He implemented it faster, even with multi-sampling. This technique grew more useful by the recent advances of the graphics hardware. Requires Dx11.
  • Stochastic transparency [Enderton et al. 10] (also rather a research thingy. It can handle an arbitrary number of layers, but consumes much performance to get it frame-to-frame coherent). Needs Dx 10.1 if I recall correctly, as it works on the coverage mask.
  • The list goes on... stencil routing etc... (Look into the related work of the papers I linked, if you want to learn more.)

AFAIK, true order-independent transparency was yet too expensive for games. (If someone knows a game that used OIT, please let me know!) It is easier to work around it or just sort the transparent objects by depth. (Of course, this doesn’t work in all cases, but you can tell your artist to circumvent the ugly cases.)
I’m creating technical demos and prototypes, so I can afford to use the concurrent linked list construction.

 

Best regards!
 

PS: Links don't seem to work at the moment, so I post the URLs.

Everitt 01: http://gamedevs.org/uploads/interactive-order-independent-transparency.pdf

Baviol & Myers 08: http://developer.download.nvidia.com/SDK/10/opengl/src/dual_depth_peeling/doc/DualDepthPeeling.pdf

Yang et al. 10: http://onlinelibrary.wiley.com/doi/10.1111/j.1467-8659.2010.01725.x/abstract

Yakiimo 10: http://www.yakiimo3d.com/2010/07/19/dx11-order-independent-transparency/

Enderton et al. 10: http://www.enderton.org/eric/pub/StochasticTransparency_I3D2010.pdf

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!