skip to Main Content

Fog is not visible in a build (but works in Unity Editor)

Make sure the URP asset used for the building platform has “Depth Texture” enabled. Note that Unity can use a different URP asset for specific devices. The URP assets can be found in Project Settings / Graphics and Project Settings / Quality (commonly one URP asset per quality level, so make sure all quality levels have the Depth Texture option enabled in its URP asset).

Shadow Cascade Bug

Universal Rendering Pipeline 7.1.8 has a bug with shadow cascade.

Solution: please make sure you use URP 7.2.0 or later.

Shadows Not Visible

Select the URP asset and make sure Shadow Distance is far enough and that “Transparent Receive Shadows” option is enabled.

Shader can take some time to compile

The first time the shader is compiled, it can take some time due to the amount of shader features. To speed up this process, you can edit the Volumetric Fog2DURP shader file and remove some “multi_compile” pragma lines or use Shader Control tool from the Asset Store to list and disable keywords related to features that you are not going to use:

#pragma multi_compile _ _MAIN_LIGHT_SHADOWS // directional light shadow

#pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE // shadow cascades

#pragma multi_compile _ _ADDITIONAL_LIGHT_SHADOWS // additional light shadows

#pragma multi_compile _ VF2_DEPTH_PREPASS // depth prepass

#pragma multi_compile_local_fragment _ VF2_POINT_LIGHTS VF2_NATIVE_LIGHTS // fast point or native lights

#pragma multi_compile_local_fragment _ VF2_RECEIVE_SHADOWS // receives directional light shadow

#pragma multi_compile_local_fragment VF2_SHAPE_BOX VF2_SHAPE_SPHERE // fog shape (box or sphere)

#pragma multi_compile_local_fragment _ V2F_DETAIL_NOISE // use 3d noise

Inverted Depth Bug

Universal Rendering Pipeline 7.2.0 has a bug which produces an incorrect (flipped) depth texture. This bug occurs when HDR is OFF, MSAA is x1 and Render Scale =1. More details here: https://forum.unity.com/threads/inverted-depth-texture-and-unresolved-shadowmap.824703/#post-5466879

Solution:

Option 1) Enabling HDR, MSAA or changing Render Scale (any of the three) produces the correct depth texture.

Option 2) Enable “Flip Depth Texture” option in Volumetric Fog Manager.

Shadows not showing in WebGL 2.0

Enable the option “Force WebGL Compatibility” in Volumetric Fog Manager.

You can also edit RayMarch2D.cginc file in Resources/Shaders folder and activate the following line:

// UNITY_UNROLLX(50)

(Increase the 50 value if needed)

Fog not rendering correctly when using VR in URP

URP 7.4 has a known bug related to inverted matrices not being set correctly in VR.

You can enable the option “Alternate WS Reconstruction” in Volumetric Fog Manager.

While this bug is not fixed by Unity, the workaround requires editing the file CommonsURP.hlsl and uncomment the line below:

//#define USE_ALTERNATE_RECONSTRUCT_API

Additional noise textures

You can find additional noise and detail noise textures inside the Demo / Noise Textures folder.

I have a question which is not covered in the guide

Please use the Support Forum and post your question there. Our team will get back to you shortly.

Back To Top