I've spent some hours las night creating a little light shafts demo.
I'm looking for an efficient way to create "god rays" effect to implement it in Hydrax underwater mode, and... I think that the best way is, before implement it in Hydrax, make a little application! (However, I'm not going to use exactly this approach)
Rigth, this demo is inspirated on the ATI paper: http://ati.amd.com/developer/gdc/mitche ... shafts.pdf (Just inspirated, no code copied)
This is the approach:
- First, declare a camera wich represents the light projector frustum
- Make a rush(100 in the demo) of billboards according with the light camera's frustum
- Attach both to a scene node, so, now we can use the scene node normally, like rotate, translate, etc
- For shadows, we've to declare a RTT with the light camera viewport and render it with a depth material
- After it, this depth map is used in the light shafts material to calcule if the actual pixel is occluded by an object
- All calculations are done using projective texturing
- A little noise effect is applied, to simulate air particles
There're some screenshots:
![Image](http://img176.imageshack.us/img176/1216/demoozh9.th.png)
![Image](http://img232.imageshack.us/img232/8222/reedhu9.th.png)
![Image](http://img232.imageshack.us/img232/1963/wwhitezp9.th.png)
![Image](http://img210.imageshack.us/img210/2148/discoju4.th.png)
![Image](http://img210.imageshack.us/img210/9900/projectorwk8.th.png)
And the download link: (Demo binary + media + sources)
http://rapidshare.com/files/112339165/L ... s.rar.html [Rapidshare]
http://files.filefront.com/LightShaftsr ... einfo.html [Filefront]
Demo keys:
C - Show/Hide light frustum, default: on
V - Enable/Disable light rotation, default: on
B - Enable/Disable knot rotation, default: off
N - Change light cookie
Hope you like it!