This article relates to the game "Half-Life: Alyx". Click here for more information.
This article relates to the workshop tools for "Half-Life: Alyx". Click here for more information.
This article's documentation is for Source 2. Click here for more information.

Working With Volumetrics

From Valve Developer Community
Jump to: navigation, search
English (en)中文 (zh)Translate (Translate)

Physically Based Volumetrics In Source 2

While volumetrics can still be enabled using old SFM Projected Lights in the classic way, (see previous article discussing Game/SFM lights here) Half-Life Alyx introduces new volumetric effects from the new PBR lights. However, some extra steps need to be taken in order to enable them.

Prerequisites

To utilize volumetric lights, you either have to use a map that already has them enabled (all Half-Life Alyx maps have fog volumes enabled in a lot of locations) or you must enable volumetrics in your own custom map by placing an env_volumetric_fog_controller entity. More info on this can be found in the Level Design documents.

Much like the new Physically Based shader in Source 2, the volumetrics system is also physically based around volumes, hence why it's a per-map decision rather than available on a per-light basis.

Tips

Volumetric Fog is supported on Ortho, Point, and Spot lights.
By default, spawning a light will instantly cast full-strength volumetric fog if the map has an env_volumetric_fog_controller, and the light is within the fog volume.
You can disable, or adjust the strength of the volumetrics by adjusting the "fogContributionStrength" slider on any light.

The new Source 2 volumetric lights have a finite range (due to VR performance reasons) and will fade out over a fairly short distance. This means volumetric fog is not great for larger scenebuilds or exterior environments. In these cases where the light needs to be further from the camera, it's recommended to use a Projected Light with Volumetrics enabled, and add fog to the scene the same as in Source 1.

Because of the way the fog reacts to lights, having the fogcontributionStrength set too high / max will often completely blow out the colour and cause a washed out / white look to the light. It's often recommended to lower either the fog strength on the light, or the light intensity itself to preserve the colour and detail of the volumetric fog.

See also