Mirrors and reflections for VR
Built for VR but perfect for non-VR Desktop and Mobile projects as well
This is for the URP pipeline, tested from Unity 2019.4.16 all the way to 6, do not buy if you're using the standard renderer.
Fully working scene preview, easily modify the Shadergraph materials.
Shaders supports refraction that you can animate for cool effects. (Think water etc.)
Mirrors/reflections can reflect each other, not just 2.. Imagine an elevator, 3 mirrors all reflecting each other as deep as your memory and performace budget will take you.
Recursive occlusion culling for the reflection cameras garantee best in class performance.
The new V2 shader closely mirrors the functionality of the URP Lit material. It introduces support for box-projected reflection probes, delivering a highly efficient mirror-like effect for distant surfaces. As you move closer, the shader seamlessly transitions to real-time planar reflections.
Many options to tweak performance. Change the resolution, modify the layermask, limit AA and Blend gradually to a static color over a set distance.
Currently tested in VR on:
- Oculus (Meta) Quest 1, 2, 3 and pro, (Desktop and on-device)
- Pico 4
- Valve Index / Vive - SteamVR
- Oculus XR set to Multiview or Multi Pass
- OpenXR set to SinglePas Instanced or Multi Pass
- Forward and Deferred rendering suported
For a detailed compatibility list and instructions please read the documentation (see link below)
Documentation here
Youtube channel with demo material
An example APK for Quest
Release Notes
2.4.1
- Small bugfixes and better documentation regarding the flipping of the mirrors.
2.4.0
- Unity 6.1 improvements, no more warnings in Direct3D and reflections in the sceneview work under all circumstances.
- Added checkboxes to flip the reflection for either the sceneview/gameview or build. Depending on the platform and your URP settings you might need to use these new boxes.
2.3.0
- Unity 6 improvements. (I've now disabled rendering a reflection in the sceneview when rendergraph is being used in combination with Direct3D on Windows) instead of spawning the console with errors, warning in the MirrorRenderer explains how to solve for this.
- Added some textual information in the demo scene
2.2.1
- Updated documentation
- Bug fixed (error about childSurfaces) when creating a new mirror from scratch.
2.2.0
- Unity 6 compatibility fixes and improvements. (rendergraph now works, check the documentation for compatibility!)
- New mirror shadergraph that closely resembles normal PBR materials inputs.
- New shader supports BoxProjected reflectionprobes, smoothly transisitions to realtime planal reflections.
- Added informative messages in the MirrorRenderer component to help with potential issues.
- Orthographic cameras are now supported.
- Supports for non-fullscreen viewports (eg: SBS camera setups)
- Improvements to the SubmitRenderRequest rendering path.
2.1.0
- Fixed an issue if URP render scale was different from 1
- Fixed an occasional white flash when initialising a mirror at first run
- Suppressed the RenderSingleCamera warning in 2022.3.xx
- implemented an option to use the SubmitRenderRequest api for 2022.3 and above. This fixes UI rendering with the downside of a runtime error that seems to be save to ignore.
- Added documentation on how to fix an error in URP 14.0.11 that breaks the build.
--
2.0.0
- Quest 3 compatibility checked and confirmed.
- Added a property "rendererIndex" to mirrorRenderer. This allows you to select a different (faster) URP renderer for just the reflection. This means a huge potential performance improvement.
- Added the concept of ChildMirrorSurfaces, this allows you to set multiple mirrorSurfaces with different materials while still only rendering the reflection once. Think of a bathroom with tiles and a mirror and a window all reflecting in their own way while still only rendering the reflection once. as long as all surfaces are in the same plane. This means a huge potential performance improvement.
- Added some helpful debug messages when creating a mirror in the console.
- Added a mirrorPlane example prefab to show how to deal with custom forward transforms.
- Main Shader now supports lineair animation on albedo textures.
- Small fixes for the Unity 2019 shadergraphs.
- Various small bug fixes
--
1.1.2
- Scene view now continues to show the correct reflection while in play mode, along with the game window.
- Removed an annoying warning about stereoProjectionMatrixes in Unity 2022.2.15
- Fixed an issue where the Occlusion matrix would be incorrect when both the scene and game windows were active at the same time and the same mirror would be visible in both. This is now handled correctly.
--
1.1.1
- Selecting a mirrorSurface would select the baseMaterial for easy editing. The material however would not get the FadeColor from the mirrorSurface resulting in a difference in color when the Surface is selected in editor or not. This is now fixed.
- Small efficiency tweaks to the code
--
1.1.0
- !!Performance Boost!! Implemented Reflected Occlusion Culling. This means all reflections no matter how deep can now do occlusion culling. Depending on your scene (if you're using baked occlusion culling) you can expect a huge performance boost!
- You can now use any transform to define the normal of the reflection. No longer depending on the pivot point of the mesh. This makes it easy for meshes (like the unity plane) that have their forward pointing in the wrong direction. Added an example to showcase this.
- While reflectionCameras were not saved in the scene before, they're now also no longer shown. The "Show Debug Info" checkbox now shows the position of the reflection camera(s).
- Added a reflection tint color to the shader, use it to change the color of the reflected light.
--
1.0.12
- Added the option to MirrorRenderer to change the renderTexture format, this way DefaultHDR can be selected. This helps with reflecting materials that are only visible in HD Ranges and removes any banding. It is a bit heavier to render.
- Added a new shader that does simple blurring.
--
1.0.11
- Small fix where opaque and depth texture modes on a portalRenderer could reset to "Use Pipeline settings".
- Improved the demo camera rig so you can move around the demo scene.
--
1.0.10
- The MirrorRenderer Component now allows you to define an override to the reflection camera clearFlag and also set a background override color. This allows you to render to a transparantant mirror and make the background be transparent.
- Added a new example mirror that only shows the player in color and the background completely desaturated.
- Changed shaders default refraction value from 0.1 to 0 (a missing normal map would otherwise offset the mirror image)
--
1.0.9
- The MirrorRenderer Component now allows you to define a custom Skybox material. This material will be used as the skybox of the reflection. If no skybox is defined in the MirrorRenderer the skybox of the MainCamera is used (if any) and lastly the Skybox of the Lighting Settings. (previously only the Skybox of the lighting settings was considered).
- Removed the FlareLayer component from the generated reflection cameras.
- Made it more clear in the naming that the reflection cameras are generated and not saved with the scene.
- Added a nice wooden plank texture as an extra example and updated the documentation to be more clear on how to convert PBR textures to include the specular map inside the Albedo using Photoshop.
--
1.0.8
- New performance options. You can now disable shadows, post processing, opaque and depth texture generation. People using post processing are getting a performance boost. There's a new beta Occlusion Culling option, in most cases you won't be able to enable it without seeing some artifacts but specific cases where the angle towards the mirror is not too big will allow you to use culling and with it a nice performance boost.
--
1.0.7
- Added Multipass compatibility.
- Confirmed compatible with deferred rendering path.
- Now compatible from Unity 2019 al the way to 2022
- Fixed a bug where reflection probes would not take the reflection camera position into account if the Unity version was higher than 2021.2.6f1
--
1.0.6
- Added the ability to modify the pivot point so your meshes no longer need to have a specific orientation.
- Added compatibility with spectator cameras.
--
1.0.5
- Fixed a bug where scaling the camera would not be taken into account when rendering the reflection in VR.
- Fixed a bug where recursions deeper as 4 with 4 simultaneous mirrors would start showing mistakes in the deepest reflections.
--
1.0.4
- Updated documentation, MirrorRenderer got 2 new events so the scene can be modified before and after rendering the reflections.
--
1.0.3
- Added 2 more example materials and introduced a specularity property to the main shader. Texture use is reduced for recursing reflections.