Alpha blending complex objects from arbitrary position

Started by
4 comments, last by MassacrerAL 16 years, 6 months ago
Hi everyone, How would I render a transparent object that blends with itself from any position? For example, a car or a bottle where the camera can look at the object from any point in the scene? I understand that in general, alpha blended objects must be rendered in back-to-front order. Also, I understand that you can render the back faces of an object first, and then the front faces so you get the right transparency. But how could you do it with an object like a bottle that you can view from any position? I could sort the mesh triangles by depth but this gets expensive quickly in scenes with more than just a few complex objects. Are there any other techniques that could be used? Or some sort of pre-processing step that would let you quickly render in back-to-front order at runtime? neneboricua
Advertisement
Depth peeling is the general solution, but it is rather expensive. Alpha-to-coverage may work for you but realize that it's just screen-door transparency on the sub-pixel level (when MSAA in enabled), so can produce some ugly artifacts if there is insufficient resolution (arguably no worse than not sorting at all though).
I don't know of any silver bullets for this, but a few ideas:

* depth peeling, e.g. http://research.microsoft.com/research/pubs/view.aspx?tr_id=1125

* break the mesh up into concave parts and just sort those as well as using the "render back faces then front faces" method.

* if you have the available memory, store multiple index buffers pre-sorted from a few major directions (better when your camera has known constraints). The order isn't 'perfect' from every angle, but usually it's adequate.

* only sort high LODs properly. Use something like the pre-sorted IBs for lower LODs.

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

Thanks for the tips guys. I had forgotten about the depth peeling stuff. Splitting the mesh into concave sections is also a good idea and could be a nice little shortcut in many cases so you don't have to sort as much stuff.

neneboricua
Concave in my post above should of course be convex. [Posting when tired, tsk...]

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

maybe you would like to find some info about zt-buffers somewhere. there is an article about it in some shaderX book.

This topic is closed to new replies.

Advertisement