Sun Shafts

Sun Shafts is the effect of volumetric light scattering due to shadows in the atmosphere. Here just use a post-process method to produce the effect, not accurate, but acceptable.

1. Render scene depth info to a texture
 

2. Generate Sun Shafts Mask

New a material and load the sunshafts_mask_gen.fx shader, then set the depth image to the 2nd texture; and use post output to a A8R8G8B8 render target (RT-A) ( you can  add render target by loading the 256-A8R8G8B8.dds ).


3. Procude shafts by the mask pattern

Use the sunshafts_gen.fx shader to radial blur the mask pattern. For multi-pass blurring, you need add another render target (RT-B) and alternately use RT-A & RT-B as input & output.

4. Combine the original scene image and shafts image

Use the sunshafts_disp.fx shader to display the final result.