Wednesday 15 October 2008

Order indipendency

Translucency and transparency are not trivial in realtime CG.

Peaceful ray tracers take their time to throw lines inside and outside objects, while rasterizers have no peace quickly collecting incoming fragments. In order to alpha blend them, they must arrive in a precise order: the farthest, the earliest.

This limitation has a deep impact when rendering a scene: you have to sort your objects in order to obtain a correct blending. Moreover, there are pathological cases which cannot be solved by using standard techniques (such as object1 covered by object2 covered by object3, which is covered by object1 again).

I googled a bit and found out that several different solutions has been offered to obtain the "order indipendent transparency", but just two are really cool and do not make use of external shaders: depth peeling and multisampled alpha coverage. The first one is brilliant: subdivide the scene by peeling away closest depths, and blending everything at the end. Naturally, many renders are required and performances fall.

The second one is less sophisticated, but interesting. It uses the additional samples taken by multisampling (for anti-aliasing and similar) and use the alpha information to create a coverage mask of these samples.


The final composition is stunning, but a correct irradiance on the shadowed object is still missing.