Tutorial: Volumetric Lighting Last edited 2 years ago2022-02-18 13:56:02 UTC

You are viewing an older revision of this wiki page. The current revision may be more detailed and up-to-date. Click here to see the current revision of this page.
✔️ Download example file

Volumetric lighting, also known as light shafts or god rays, is a lighting effect that can add depth and realism to the visuals of your map.

Requisites

Creating the effect

Skew a brush to closely match the angle of your light source. Since the base faces of the brush are meant to be invisible, they should be textured with CONTENTWATER in order to mirror the side faces of the brush, making it more realistic. Lastly, the brush should be an entity, such as func_illusionary, with Render Mode set to Additive. The translucency can be set with FX Amount (1 - 255).
User posted image
If you use NULL or black_HIDDEN, not all of the side faces will be rendered at the same time, and the effect is invisible from some angles (i.e. inside or directly below the volume). Here are a couple examples of volumetric lighting with and without the use of CONTENTWATER.
Volumetric lighting, with and without the use of CONTENTWATERVolumetric lighting, with and without the use of CONTENTWATER
Volumetric lighting, with and without the use of CONTENTWATERVolumetric lighting, with and without the use of CONTENTWATER
A scrolling texture could also be used with a func_conveyor entity.
Scrolling volumetric lightingScrolling volumetric lighting

Errors

Error: WATER brushes not allowed in detail
This error is caused by any of the following keyvalues in your entity:
  • zhlt_clipnodedetaillevel
  • zhlt_detaillevel
Error: mixed face contents
If your brush is textured with CONTENTWATER, then this error is caused by any of the following textures on your brush:

Volumetric lighting textures

TextureGroup
C0A0YELLOWvalve/halflife.wad
C1A3YELLOWvalve/halflife.wad
FADEvalve/halflife.wad
FADE2valve/halflife.wad
CULIGHTAcstrike/cs_havana.wad
CXLIGHTAcstrike/chateau.wad

Extra Info:

CONTENTWATER is basically how water is rendered in the HL engine. When the player is submerged in water and looking up, you still see the surface of the water from below. The surface has both sides of the faces visible to give this effect. It would certainly look strange without it. CONTENTWATER gives the same effect but without the water physics and swimming, rendering all faces adjacent to it to have both sides appear. It must to be used with brush entities and not any world brushes. It is very optimized compared to hollowed out brushes to achieve the same effect. Light shafts is one of the many perfect uses for it. It can also be used for brush based plants or leaves and other things that need to be perfectly thin.

2 Comments

Commented 4 years ago2020-02-24 22:10:13 UTC Comment #102552
this could probably stand a little more info on exactly what contentwater is. I'm looking at these images and I can't really tell which is which.
Commented 4 years ago2020-02-24 22:12:49 UTC Comment #102553
The whole thing could use more explaining and less telling.

You must log in to post a comment. You can login or register a new account.