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
简体中文

Physically Based Volumetrics In Source 2

While volumetrics can still be enabled using old SFM lights (see previous article discussing Game/SFM lights here) Half-Life Alyx introduces some new volumetric effects from the new Game 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 in the volume you wish to work in (for instance, the first level of Half-Life: Alyx has volumetrics near Alyx's hideout) or you must enable volumetrics in your own custom map by plopping in an env_volumetric_fog_controller entity in. 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 (but can still be disabled where required.) Because of this, you have to be careful when putting together your scenes and understand how volumetrics are going to interact with them. They don't have as fine tuned controls as they used to, but that is because it's a more realistic depiction of volumetric fog in the engine.

How To

You will already need to have created a session with the "Game" lights. Instructions for this can be found here. Volumetrics are supported on Ortho, Point, and Spot lights, however the Sun cannot use them. This can be alleviated by using an Ortho light in place of the Sun.

Inside of the element viewer for the light, there is an option named "fogLightingMode" which is the same property set in Hammer as "Volumetric Fogging." Setting this to 2 will be identical to the "Dynamic" option in Hammer, which is ideal for SFM. If you need lights that don't have volumetrics, just keep this at 2.

Now, enabling this on a map with an env_volumetric_fog_controller and/or in a valid volume or space (if there are no env_volumetric_fog_volume entities in the map, volumetrics will render everywhere) will show volumetrics, and they'll interact with your SFM models and all that good stuff!

You can also adjust the strength of the volumetrics by adjusting "fogContributionStrength" which is available as a slider on all supported light types.

See Also