1. Home
  2. Docs
  3. PIDI : Planar Reflections...
  4. Advanced Topics
  5. Reflections + Fog

Reflections + Fog

Fog in Unity doesn’t always work in the way that is expected when used together with Planar Reflections. The main reason for this is the way fog is calculated using the camera’s clip space, which in Planar Reflections is heavily modified due to the use of an oblique projection. Please test thoroughly whether fog is working well enough with reflections in your game before attempting to follow the steps in this guide, as there are several trade-offs when using our implementation of reflection-based fog.

In the Legacy pipeline, while in Deferred mode + Post FX fog is reconstructed or calculated from the start based on world positions, which means that it works mostly without any issues in the reflections. But for any other cases and for URP this is not possible, which means that fog has to be calculated and added back into the reflections in a different way. As a solution for this problem, PIDI Planar Reflections 5 includes a brand-new Fog Pass that generates an additional texture including world-position-based fog as seen through the reflection. This fog reads and matches all parameters set up in the Lighting settings of the scene by default, no additional work required.

Enabling fog support in the Legacy pipeline is as easy as turning on the setting in the Reflection Renderer and Reflection Caster scripts.

In URP however, due to limitations in the rendering pipeline, a special renderer is required and has to be added to the Scriptable Render Pipeline asset that your project uses. You can find this renderer inside the Fog Pass folder included with the asset.

As this is a Beta feature there are some limitations to what this fog renderer can do. The main limitation is that all objects in the fog pass are rendered as opaque objects.