PDA

View Full Version : order-independent transparency



virtualchetan
09-23-2003, 03:16 PM
Hi,

A thumb rule to get transparency is 'draw the transparent object last', However, if it is not possible to draw it last, is there any way to achieve transparency? (using blending functions ofcourse.)

- Chetan

jwatte
09-24-2003, 12:51 PM
You can use, in limited ways, destination alpha, and blend everything into the buffer based on the opacity of what's already there. Draw transparent items without Z writes. The problem is that you can't get the Z buffer right that way, and you may end up blending things that are actually hither from the transparent things.

A better approach is "depth peeling" using the stencil buffer and some number of passes depending on what depth complexity you want. You end up drawing (parts of) the scene many times this way, but it's robust, and order independent.