Tag Archives: Volumetric

I made a game! Buy on Steam

Doom 3 is known for its shadows but in the last days something different got my interest: the  volumetric effects around lights.

Before we start, let me point something out: The aura around light is called many things. Here’s some terminology (please correct me if got this wrong):

Glare occurs when light is too bright and disables seeing sharp. Disappears when the light source isn’t seen directly.

Haze is basically fog and in our case lit by some light. You can see this even the light source isn’t visible!

Lens flare  is an effect caused by the imperfection of the camera lens. And it’s an
Photoshop effect which was heavily overused after it was
implemented.
Below you can see clearly that the Doom 3 light has a nice aura (like haze, since it’s not too strong) and that this aura disappears without directly sight to the light source (acts like glare). ID calls them “flare” in their materials.

Source: Doom 3

I alread knew three ways of doing these light effect.

  1. Render every glow of the frame into a big texture, blur it and overlay it with the the current frame. This costs memory but no special setup by artists. The glow is reduced automatically if the visible light area gets smaller or disappears (like glare).
  2. Place planes with a glowtexture around the light (the planes would have to fade out if you look in a narrow angle at them). This costs not much more memory but the effect stays even you don’t see the source of the light (like haze). Also it takes some time for artist to create these planes around every glowing area.
  3. Place a big glowing sprite which rotates always to the camera. But this wouldn’t work well at rectangular light areas which you find very often in Doom 3.

I created a test object with just a polygon like said in the documentation of D3 and added a material you find e.g. on the Doom 3 desk lamps:

Source: Doom 3

The effect behaves a bit “weird”, because when you walk near a light source there’s some movement in the aura. Another artifact cen be seen in the first image (orange lights): the lower light cuts into the wall and this cut “moves”. This wouldn’t happen if you place the planes by hand (because they don’t rotate to the camera).

How did ID this effect?  I have no idea and also the Internet does know too much. Only one other guys asked himself the same question but the answers weren’t satisfying. We can at least look at the wireframe:

Source: Doom 3

Isn’t that beautiful? They fold and unfold a (i think) vertex colored mesh in a way, that you always get a volumetric look. I love it!

Source: Doom 3

They draw this geometry only when you’re in front of the light source. If you lose direct sight, it  disappears:

Source: Doom 3

Depending on the angle they fade out the light by turning down the vertex colors. At least i think it’s done via vertex color. Anyway, they fade the effect out in a smooth way – i like it!

Source: Doom 3

If you don’t have much graphic memory and you don’t want to let artist spend a lot of time in  creating this effect by hand, i think this technique is awesome. You only have to create a polygon  (quad) and add a predefined material to it. Also you can set the parameters right in the material which gives you a good control.

Have a nice day!

Update 1
Update 2
Update 3
Yzer did a Doom glow implementation a while ago (see Update 2) and based on that, Hollowdilnik did one too! How cool is that?

Source: hollowdilnik
Update 4
Michael made a WebGL Implementation of the Doom glow! And even better, you can also find the source code on github! :)