Sun Shafts
Manual     Reference     Scripting   
Reference Manual > Components > Image Effect Scripts > Sun Shafts

Sun Shafts

The Sun Shafts image effect is a powerful technique to create radial light scattering such as god rays or light beams that are originating from a very bright light source.

As with the other image effects, this effect is only available in Unity Pro. Make sure to have the Pro Standard Assets installed.

Example for Sun Shafts.


Rely on Z BufferThis option can be used when no depth textures are available or too expensive to calculate (e.g. in forward rendering with plenty of objects). Note that if this option is disabled it is required that the Sun Shafts effect is the very first image effect of a camera.
ResolutionThe used resolution. Lower resolutions are faster to calculate and create softer results.
Blend ModeChose between the softer Screen or a simple Add operation.
Sun TransformThe transform of the light source that casts the Sun Shafts. Only the position is important.
Center on ...Move the Sun Transform along a ray from the center of the game view camera.
Shafts colorThe tint color of the shafts.
Distance falloffThe intensity falloff speed that lessens the sun shafts intensity the further away from the Sun Transform.
Blur sizeThe blur length
Blur iterationsThe iterations for creating sun shafts. More iterations will generate smoother and longer light beams but are also more expensive to calculate.
IntensityThe brightness of the added Sun Shafts.
Use alpha maskDefines how much the alpha channel of the color buffer should be used when generating Sun Shafts. This is useful e.g. when your skybox has a proper alpha channel that defines a mask (e.g. for clouds blocking the sun shafts).

Hardware support

This effect requires a graphics card with pixel shaders (2.0) or OpenGL ES 2.0. Additionally, depth texture support is required. PC: NVIDIA cards since 2004 (GeForce 6), AMD cards since 2004 (Radeon 9500), Intel cards since 2006 (GMA X3000); Mobile: OpenGL ES 2.0 with depth texture support; Consoles: Xbox 360, PS3.

All image effects automatically disable themselves when they can not run on end-users graphics card.

Page last updated: 2011-06-08