The effect type selector in the inspector allows you to select one of the shader variants:
-
Desktop Fog + Sky Haze: this effect provides a fast fog effect plus sky haze options for desktop platforms. It uses two different noise textures to produce a soft animated fog effect.
-
Desktop Fog Plus + Sky Haze: this effect provides a fog effect using a volumetric approach improving the fog coverage when there’s no geometry in front of the camera. It also uses sky haze.
-
Mobile Fog + Sky Haze: optimized version of Desktop Fog + Sky Haze for mobile devices. Uses a single noise texture.
-
Mobile Fog (No Sky Haze): same than Mobile Fog but without sky haze effect.
-
Mobile Fog (Simplified): uses a volumetric approach and no noise textures, hence, no animation nor turbulence is supported in this mode. This can be the best choice for fast static fog.
-
Mobile Fog (Basic): uses a even simpler version of Mobile Fog (Simplified) aimed for the low end mobile devices.
-
The Orthogonal versions are variants that computes depth and height separately and mix them. They are intended for isometric or games with special perspectives.
Shaders used by each effect type
Fog variant | Perspective camera | Orthographic camera |
Desktop Fog Plus With Sky Haze | DFGDesktopPlus | DFODesktopPlus |
Desktop Fog Plus Orthogonal | DFGDesktopPlusOrthogonal | DFODesktopPlusOrthogonal |
Desktop Fog + Sky Haze | DFGDesktop | DFODesktop |
Mobile Fog (Simplified) | DFGSimple | DFOSimple |
Mobile Fog + Sky Haze | DFGWithSky | DFOWithSky |
Mobile Fog (No Sky Haze) | DFGOnlyFog | DFOOnlyFog |
Mobile Fog Orthogonal | DFGOrthogonal | DFOOrthogonal |
Mobile Fog (Basic) | DFGBasic | DFOBasic |
Note: you can remove unused materials and shaders from the Resources folder.
Fog materials
To use Dynamic Fog & Mist fog materials (not to be combined with the image effect! – see demo scene 5):
-
Select and duplicate any fog material inside DynamicFog/Resources/Materials (see below for names, they start with DFM).
-
Customize the material properties (color, texture or metallic/glossiness, depending on the chosen material).
-
Assign the material to your game objects (you can mix different material types).
-
Create an empty game object and add “DynamicFogManager.cs” script to it. This script controls the shaders of the fog materials and allows you to customize the fog properties for all materials from a centralized point.
The current fog materials available in DynamicFog/Resources/Materials are:
-
DFMStandardShader: a derivation of the Standard Shader which integrated our fog effect.
-
DFMStandardShaderNormal: same but adds bump map.
-
DFMStandardShaderNormalOcclusionMap: same but adds occlusion map.
-
DFMStandardShaderNormalOcclusionIntegrated: in this case the alpha component of the main texture is used for occlusion.
-
DFMStandardShaderSolidColor: same but does not use textures, just single color (faster).
-
DFMLambert: a fog shader that uses simple lighting (faster).
-
DFMLambertSolidColor: same but does not use textures (even faster).
-
DFMUnlit: does not use lighting, just texture, color and fog effect (faster yet!)
-
DFMUnlitSingleColor: same but does not use texture (the fastest shader!)
These materials are also available with a reflection texture support:
-
DFRStandardShader: a derivation of the Standard Shader which integrated our fog effect.
-
DFRStandardShaderSolidColor: same but does not use textures, just single color (faster).
-
DFRLambert: a fog shader that uses simple lighting (faster).
-
DFRLambertSolidColor: same but does not use textures (even faster).
-
DFRUnlit: does not use lighting, just texture, color and fog effect (faster yet!)
-
DFRUnlitSingleColor: same but does not use texture (the fastest shader!)
It’s possible to assign a reflection texture to these materials (using mat.SetTexture(“_ReflectionTex”, texture) to blend reflections along with the fog. The free asset Realtime Reflections provide a simple way to expose the reflection textures to these materials: https://www.assetstore.unity3d.com/en/#!/content/21730