Thu, Nov 19, 2009

PV3D light rays

In the example above, click and drag to reposition the light rays filter light source.

For a while now I've been wanting to experiment with volumetric lighting techniques in Papervision and the other day I came across a great article from Fabien Sanglard regarding a fake post processing approach described in Graphics Gems 3. (Fabien has some excellent posts on GFX coding which I highly recommend, especially if you are an iPhone developer)

The post processing technique described is beautiful in it's simplicity and gives great results for very modest overhead. All it requires is drawing the occluders of the scene as black over a colored background then applying something similar to a radial blur emanating from the imaginary light source.
In the scene above the rendered output is scaled by 25% and drawn to a bitmap using a ColorTransform to make it black. This bitmap then has the light rays pixel bender filter applied, is scaled back up and blended with the scene using the regular blend mode. Check my experiments repository for the code!