Volumetric Fog uses an extremely optimized ray-marching algorithm to provide “volumetric sense” fog in front of your player. If you need to improve performance, you can try the following options (if you don’t have any of these options visible, make sure you’re using the latest version – you can get it from our Support site):
- Reduce the Final Texture Size setting (under Noise section). Reducing the noise texture size used by the shader can improve performance on mobile devices.
-
Increase RayMarch Min Step: increasing this value will improve performance but will make the fog effect less accurate and show more artifacts.
-
Reduce Raymarch Quality: reducing this value will indeed reduce the number of texture fetches per pixel.
-
Increase the Downscaling option in Volumetric Fog Manager. Try values of 1.25, 1.5, 1.75, 2.0 or even more.
- In the URP renderer, try setting Depth Texture mode to Force Prepass. This can improve performance on mobile and VR devices.
- Reduce Max Distance and use Max Distance FallOff to smooth the fade off. You may use the Distant Fog option to add a faster fog effect for the background instead of using very large values in Max Distance.
- Reduce the Shadow Max Distance.
- Use the “Enable Point Lights” instead of “Native Lights“. Native lights option is a powerful feature but can be expensive as it handles all light types including shadows. Fast Point Lights on the other hand allows multiple point lights without shadows using a more optimized and performant code.
-
Use Fog of War instead of Fog Voids: consider switching to fog of war instead of fog voids if you use many voids.
-
Detail Noise adds an additional texture3D sample during the ray-marching loop: consider disabling this option to increase performance if needed.
-
To achieve a simpler but smooth fog effect, enable the Constant Density option which also disables noise completely saving performance.
-
Depth Gradient and Height Gradient options add additional texture sampling during the ray-marching loop. These gradient textures are very small and shouldn’t impact performance on PC but they can affect mobile performance.
-
Reduce Render Scale in the Universal Rendering Pipeline asset. This will reduce the resolution of the framebuffer, improving the overall performance. This setting is especially useful on mobile devices since they use very high DPI screens and can afford to use a lower resolution
- Distant Fog option adds a fast noise-free fog effect which can be used along the volumetric fog effect. Distant Fog is very fast and can be used alone if the density value of the Volumetric Fog section is set to 0.
-
In Volumetric Fog Manager, select Shader Options and reduce the MAX_ITERATIONS parameter. By default, a value of 500 as maximum should be good for most open/large areas. If you’re fog areas cover a small area, you may want to reduce this value to ensure no more samples than necessary are used. Note that this value is just a maximum. It doesn’t mean that 500 iterations as used. The maximum is provided to avoid loops excessively large.
For older or less capable hardware, you can also consider using Dynamic Fog & Mist or the Distance Fog option of Volumetric Fog & Mist alone (setting Density to 0 will just render the Distance Fog if this option is enabled).
As a final advice, always use the latest version of the asset for the most recent improvements, optimizations and fixes.