God Ray or Sun Shaft or any kind of Volumetric Light is a very common effect in any realistic scene. Unity 5 comes with a image effect for sun shafts. Which creates dynamic sun shafts from position of sun to viewer’s direction. But in some cases volumetric lighting is required. For example an open window in a dark room or a hole in the ceiling in a dark cave. It can be achieved very easily using a particle engine in Unity.
To achieve this effect you need
- The default particle material and texture
- Long particle life, depending on how long beam of light you need
- High particle speed
- Large particle size, so that does not look sharp
- Emission as required
- Smooth alpha change over lifetime 0 -> 255 -> 0
- Stretched billboard render, depending on how long beam of light you need
- Shape as cone. Angle 0 or very low if it is sunlight, else as required
The cone angle can be changed to achieve pointed light. Such as light from a torch
Or particle size can be increased to achieve smoother effect
For more realistic effect a different dust particle system can also be added. As shown in first screenshots.