1. Home
  2. Docs
  3. PIDI : Planar Reflections...
  4. Advanced Topics
  5. Depth & Blur Passes

Depth & Blur Passes

Depth Pass

Each Planar Reflection Renderer component can have its own optional depth pass. This depth pass stores the distance between the mirror’s surface and the objects reflected on it based on the depth of the virtual camera used to render it. This depth pass can be used to create complex fading effects or, in the case of the included PBR based shaders, to simulate contact reflections (that is, reflections that are sharper the closer an object gets to the reflective surface).

There are two steps to enable depth in your reflections. First, you must enable the depth pass in the Reflection Renderer to ensure that the pass is generated at all :

Then you have to enable the depth pass in your Reflection Caster for every material that will use it, so that the corresponding texture is sent to the material.

Once you’ve done this, your shaders can access the property called “_ReflectionDepth” and use its Red Channel, which now contains a default depth texture, and use it for all sorts of effects.

Please remember that not all platforms support depth textures and that some pipelines (like Universal RP) need to have the depth rendering feature enabled from their general settings.

For shader programming purposes, when depth is disabled in either the Reflection Renderer or the Reflection Caster it is set to black by default. The included nodes for Amplify Shader Editor and ShaderGraph provide useful outputs for the reflection’s depth that are ready to use.

Contact depth demo (HDRP 7.x)

Depth pass debug (HDRP 7.x)

Blur Pass

In PIDI Planar Reflections v 3.x an additional Blur Pass was available in the Reflection Caster component. This blur pass would apply a configurable blur to the reflection’s color and use this blurred texture to approximate how the roughness of a material affects its sharpness. It could also be used to simply blur the final output reflection for additional effects such as a foggy mirror or as a cheap alternative to anti-aliasing.

In version 4.x this is no longer necessary as all PBR shaders have a new and much more efficient integrated blur algorithm built into their code that accurately uses the roughness of the material to blur the reflection and achieve a more believable result. However, the old blur pass offered in v3.x is still available both as a backwards compatibility feature (for shaders made for version 3.x) as well as an artistic choice for some effects that may still benefit from it.

To use it, simply go to the Planar Reflection Caster component and enable the Blur Pass for the corresponding materials. Then you will see the following options appear :

Fast Blur is a setting that simplifies the internal algorithm to gain a few FPS in older devices. The Blur Pass mode defines whether the final reflection sent to the material or a copy of it will be blurred (if this setting is set to Separate Pass then the blurred reflection will be assigned to the _BlurReflectionTex property). Finally, for each material you can adjust the blur radius and the downscale that will be applied to the reflection texture before blurring it, giving you full control over the effect on a per-material basis.