Volumetric Light using Particles in Unity

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.

This slideshow requires JavaScript.

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
Screen Shot 2017-01-20 at 9.47.24 AM.png
Simulation for Sun Shaft
Screen Shot 2017-01-20 at 9.47.50 AM.png
Particle Settings

The cone angle can be changed to achieve pointed light. Such as light from a torch

Screen Shot 2017-01-24 at 8.30.48 AM.png
Simulation for Spot Light

Or particle size can be increased to achieve smoother effect

screen-shot-2017-01-20-at-9-55-26-am
Simulation for Smooth Spot Light

For more realistic effect a different dust particle system can also be added. As shown in first screenshots.

Advertisements

4 thoughts on “Volumetric Light using Particles in Unity

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s