Adding Fog to the HDRP Pipeline in Unity 2020

The HDRP render pipeline implements fog as a Volume Override.

“The High Definition Render Pipeline (HDRP) implements a multi-layered fog composed of an exponential component, whose density varies exponentially with distance from the Camera and height HDRP allows you to add an optional volumetric component to this exponential fog that realistically simulates the interaction of lights with fog, which allows for physically-plausible rendering of glow and crepuscular rays, which are beams of light that stream through gaps in objects like clouds and trees from a central point.”

The most pertinent setting we have is the Fog Attenuation Distance.

The lower the value, the more noticeable the fog effect in our spot lights.
Note that this effect seems most noticeable in point or spot lights.

I can increase the fog effect by light source, here I have selected my platform lights prefab which is connect to 4 circular red lights on the platform.

As I turn up the Multiplier under Volumetrics, the fog becomes much more pronounced in this light source.

“The Light component has several properties that are useful for volumetric lighting:

· Emission Radius is useful to simulate fill lighting. It acts by virtually “pushing” the light away from the Scene. As a result, it softens the core of punctual lights. Always use a non-zero value to reduce ghosting artifacts resulting from reprojection.

· Volumetric Multiplier only affects the fog and replaces the Light Multiplier that HDRP uses for surfaces.

· Shadow Dimmer only affects the fog and replaces the Shadow Dimmer that HDRP uses for surfaces.”

Revealing Light Layers

Light layers are useful for differentiating our lighting effects, but for some reason Unity decided to hide them by default.

Simply click the gear icon as shown above and they will appear in your Inspector.

By setting this spot light to a light layer that does not correspond to the game objects in our scene, you can see that while it adds to the fog effect, it does not show up on the scene objects.

I’ve made this green so that the effect is very clear and not mixed with the other lighting and fog effects.

Something to keep in mind if you want to fine-tune the lighting in a fog without affecting the rest of the scene.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store