View Full Version : Any tips when drawing translucent objects

09-10-2011, 02:18 PM
Does anyone have any tips when it comes to drawing translucent objects other than drawing the farthest objects first. Is there any tricks I can use to avoid determining the order of objects each time I need to draw to screen?

09-11-2011, 06:54 AM
well maybe, but it depends on what your rendering, there are many cases where sorting is not needed or can be simplified.

1. If you know that no transparent objects will be rendered behind that surface you can just go ahead and render it after opaque objects but before other transparent objects.
2. If you know the transparent objects do not intersect and they are mostly convex you sort on a per object basis then draw each object with back facing polygons first then front facing polygons.
3. if your rendering fog or dust with a uniform color you can just go ahead and render them without sorting or depthwriting.
4. If your transparent objects are structured in separate groups but are concave in nature you can sort every polygon in each group first then sort the groups back to front.
5. for some objects (such as various forms of vegetation or smaller details) it's better to not render transparency but rather discard fragments instead based on the alpha.
with proper post processing you will never notice the difference

There are also more advanced techniques like depth pealing and gpu sorting, but i think it's better to stick to the basics in the begining.
Either way the more transparent objects there are on the screen the higher the need for sorting is

09-12-2011, 05:33 AM
If you can accept its limitations, "weighted average transparency" is fast and simple.