Fake Volumetric Lighting via Particle Emitters
|Tutorial: Fake Volumetric Lighting via Particle Emitters|
|Editing Main Page||Written by: reaper_47|
NOTE: This tutorial was originally posted on redtechnologies, which is no longer available.
Before we start
Before you use this effect...
Always remember the method described in this tutorial uses alot of particles. Each particle needs a transparency effect which is quite a complex thing to render for your graphics card, especially when there are many transparent objects close to each other. The more particles there are, the bigger they are or the closer the player gets to them the slower the game will run.
If you use this effect make sure the fake volumetric lights:
- are far away from each other
- ideally never too close to the player or too big on the screen
- and there are never more than 2 or 3 visible to the player at the same time
Otherwise you'll get a performance nightmare.
NB: If you are using the default particle emitter texture you wil need to grab the fix from here, otherwise you may not be able to create packfiles.
That being said... let's move on to the theory ;)
Red Faction's own fake Spotlight Effect
Most light clutter-objects in RED have it's own fake Volumetric Light effect. It consists of 2 sprites: a flat picture of a beam of light that is only visible when you look at it from the side and a round glow that you only see when you directly stare into the spotlight. The engine can fade between the two sprites depending on the angle you look at it.
This is quite an effective method as it only needs 2 polygons. There are two problems though. First you can always see the transition when fading between the two sprites and secondly (and much more important) you always need a clutter object that has this effect enabled.
The Fake Volumetric Light Effect using Particle Emitters (tm)
Volumetric Lighting simulates a beam of light in foggy or dusty air. Often the result is a cylindric or conic shape like that of the spotlights in the 20th Century Fox logo.
The only way to simulate this effect in RF is having multiple, circle-shaped particles lined up in a row. Once there are enough particles they look like a solid, conical beam of light. It looks correct no matter what side you look at it!
All you need is a single Particle Emitter. The most common use for the effect would be a spotlight so add a light and change it's light type to "spotlight" in the preferences. Make sure it is bright enough and heads into the same direction like the Particle Emitter.
Velocity, Particle Radius and Growth Rate changes the shape of the Volumetric Light. Particle Color/Alpha and Fade Color/Alpha are the colors and transparency values the particles fades from. The Spawn Delay and Decay changes the number of particles that are on screen at the same time. Be careful with these values or you might have a hundred particles in a row and the game will run ridiculously slow.
Select the Particle Emitter and look around a bit so RED starts rendering a preview of the effect if it doesn't already. Remember it is a particle effect so it may take a few seconds to "build up" depending on the Decay rate.
You can use the FVLEuPE for all sorts of things from torches to rocket flares. Most of these effects look much brighter in game than they do in the editor. Just remember that it is a very costly effect when it comes to game performance.