skip to Main Content

When I generate a build it stalls or takes lot of time!

This is a known issue with Unity when compiling shaders with many keywords.

You may want to reduce the shader complexity removing some keywords that you don’t use by using the “Shader Options” section on top of the Volumetric Fog inspector. This is the recommended solution.

If you want to further optimize the shader, you can edit it and modify the VolumetricFog.shader file and look for lines that contains #pragma multi_compile sentences:

  1. I don’t need that feature: just remove the corresponding keyword or the entire #pragma line.

  2. I need that feature: you may remove the #pragma line AND remove all #if related statements in the shader so that code will always execute.

#pragma multi_compile __ FOG_DISTANCE_ON

Used when you set Starting Distance > 0.

#pragma multi_compile __ FOG_VOID_SPHERE FOG_VOID_BOX

Used when you enable fog void option.

#pragma multi_compile __ FOG_AREA_SPHERE FOG_AREA_BOX

Used when you enable fog area option..

#pragma multi_compile __ FOG_HAZE_ON

Used when you Sky Haze setting is > 0.

#pragma multi_compile __ FOG_OF_WAR_ON

Used when you enable Fog of War feature.

#pragma multi_compile __ FOG_POINT_LIGHTS

Used when the range setting of the optional point light setting is > 0.

#pragma multi_compile __ FOG_SCATTERING_ON

Used for light scattering (god rays, sun shafts).

#pragma multi_compile __ FOG_SURFACE

Used for terrain fit feature.

If you want to further optimize shader keywords at project level, consider using Shader Control asset (check it on the Asset Store).

I see banding artifacts, how can I remove them?

To reduce banding artifacts (ie. circles on the sky), make sure your camera has HDR enabled and use the Dithering and Jittering options found in the Optimization & Quality settings section. You can customize the dither effect using the slider next to the toggle. For low density fog, you may need to increase the dithering intensity.

I see lot of noise, how can I smooth the effect?

To reduce noise, you can use the Blur option under the Optimizations section at the bottom of the inspector. You may need to enable “Force Composition” to make the blur option visible.

Also, you can enable “Blue Noise” option in Shader Options as well.

Can I extend the maximum distance far beyond the 2000 limit?

You can edit the custom inspector to increase that cap. However, increasing that value will impact performance. If you need to cover vast or far areas with fog, consider adding Dynamic Fog & Mist in addition to Volumetric Fog & Mist. Use Volumetric Fog & Mist for short distance effects and Dynamic Fog & Mist for the background.

When I enable transparency pass (Blend) I see strange colors or the particles don’t show up. What is it?

In this case, make sure Volumetric Fog & Mist camera scripts are first on the camera stack of components, before any other image effect.

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