WiseVol: Volumetric Light Effect

From Valve Developer Community
Jump to: navigation, search


This tutorial was originally created by wisemx. It was originally posted on SDKnuts.net.

VOLUMETRIC LIGHT: A 3D light source whose geometry can be changed and that simulates the behavior of natural light in an atmosphere, like a SPOTLIGHT.

WiseVolLight01.jpg

UPDATE: The example file for this project now contains two additional vmf files, one for CS:S and one for HL2/HL2DM. The additional files are examples of brush-based volumetric light. In each I've created a barn with 4 open windows and ambient light. For each I've used the Clipping tool to create the brush shape that I wanted for the effect. Then I converted the brushes to func_illusionary. (Press Ctrl+T with the brush selected)

The properties for each are:

  • Render FX: Normal
  • Render Mode: Normal
  • FX Amount: 150
  • FX Color: 255 255 255
  • Disable Receiving Shadows: Yes
  • Disable shadows: Yes

The textures I used for the brushes are:

models\effects\vol_light001, For HL2/HL2DM

effects\trainsky, For CS:S

Note.pngNote:You shouldn't use models\ textures in your maps but for the HL2 version of the brush based volumetric light this texture worked out fine.

For these examples there is a sample file at the bottom of this page.

In the main sample file I’ve created three types of volumetric light that you can use in your Source maps. I’ve also created one window that has no light at all, just a skybox.

The large windows in this example are modeled after my favorite volumetric light in HL2, the part where the metrocop tells you to put the trash in the can. On a good system the environment in that part of HL2 is just awesome. (Porter's note: Since 2007, this lighting has not rendered correctly for most video cards, but it does indeed exist.)

One of the windows uses the method that Valve used a lot in HL2, there is no light at all but a large space is created with a “light” texture inside that gives the appearance of both volume and light plus you will see that it casts a beam/shadows of its own.

The final volumetric Light in this example is the one I’ve placed in a few of my other tutorials. The spot light is more than it appears to be. Notice that there are multiple light sources for this and while the dust motes use the volume I’ve created for them the one point_spotlight specifically casts light onto that volume.

WiseVolLight02.jpg

The large windows actually use a prop_static model to create the very best volumetric light in HL2:

  • World Model: models/Effects/vol_light.mdl
  • Collisions: Not Solid
  • Start Fade Dist: 0
  • End Fade Dist: 0
  • Fade Scale: 1

I’ve used only one light_environment for this entire example:

  • Brightness: 237 218 143 800
  • Ambient: 190 201 220 200

The spot light makes use of 5 direct lights in this example, there are no other lights. The windows each show a method of creating lighting, shadows and volume. Here's a shot of the brush based volumetric light, included in the download for this tutorial:

WiseBrushVol.jpg

See also