Up to date
This page is up to date for Godot
If you still find outdated information, please open an issue.
Volumetric fog and fog volumes¶
Volumetric fog is only supported in the Clustered Forward rendering backend, not Forward Mobile or Compatibility.
As described in Environment and post-processing, Godot supports various visual effects including two types of fog: traditional (non-volumetric) fog and volumetric fog. Traditional fog affects the entire scene at once and cannot be customized with Fog shaders.
Volumetric fog can be used at the same time as non-volumetric fog if desired.
On this page, you'll learn:
How to set up volumetric fog in Godot.
What fog volumes are and how they differ from "global" volumetric fog.
You can see how volumetric fog works in action using the Volumetric Fog demo project.
Here is a comparison between traditional fog (which does not interact with lighting) and volumetric fog, which is able to interact with lighting:
Volumetric fog properties¶
After enabling volumetric fog in the WorldEnvironment node's Environment resource, you can edit the following properties:
Density: The base exponential density of the volumetric fog. Set this to the lowest density you want to have globally. FogVolumes can be used to add to or subtract from this density in specific areas. A value of
0.0disables global volumetric fog while allowing FogVolumes to display volumetric fog in specific areas. Fog rendering is exponential as in real life.
Albedo: The Color of the volumetric fog when interacting with lights. Mist and fog have an albedo close to white (
Color(1, 1, 1, 1)) while smoke has a darker albedo.
Emission: The emitted light from the volumetric fog. Even with emission, volumetric fog will not cast light onto other surfaces. Emission is useful to establish an ambient color. As the volumetric fog effect uses single-scattering only, fog tends to need a little bit of emission to soften the harsh shadows.
Emission Energy: The brightness of the emitted light from the volumetric fog.
GI Inject: Scales the strength of Global Illumination used in the volumetric fog's albedo color. A value of
0.0means that Global Illumination will not impact the volumetric fog. This has a small performance cost when set above
Anisotropy: The direction of scattered light as it goes through the volumetric fog. A value close to
1.0means almost all light is scattered forward. A value close to
0.0means light is scattered equally in all directions. A value close to
-1.0means light is scattered mostly backward. Fog and mist scatter light slightly forward, while smoke scatters light equally in all directions.
Length: The distance over which the volumetric fog is computed. Increase to compute fog over a greater range, decrease to add more detail when a long range is not needed. For best quality fog, keep this as low as possible.
Detail Spread: The distribution of size down the length of the froxel buffer. A higher value compresses the froxels closer to the camera and places more detail closer to the camera.
Ambient Inject: Scales the strength of ambient light used in the volumetric fog. A value of
0.0means that ambient light will not impact the volumetric fog. This has a small performance cost when set above
Sky Affect: Controls how much volumetric fog should be drawn onto the background sky. If set to
0.0, volumetric fog won't affect sky rendering at all (including FogVolumes).
Two additional properties are offered in the Temporal Reprojection section:
Temporal Reprojection > Enabled: Enables temporal reprojection in the volumetric fog. Temporal reprojection blends the current frame's volumetric fog with the last frame's volumetric fog to smooth out jagged edges. The performance cost is minimal, however it does lead to moving FogVolumes and Light3Ds "ghosting" and leaving a trail behind them. When temporal reprojection is enabled, try to avoid moving FogVolumes or Light3Ds too fast. Short-lived dynamic lighting effects should have Volumetric Fog Energy set to
0.0to avoid ghosting.
Temporal Reprojection > Amount: The amount by which to blend the last frame with the current frame. A higher number results in smoother volumetric fog, but makes "ghosting" much worse. A l