Skip to content
ninquiet_

cat ~/projects/mirror-vr.shader

-rw-r--r--  vfx / shaders  2024

Mirror VR

A VR mirror that renders the correct perspective for each eye.

unityvrstereo renderingcameras
Mirror VR preview

A working mirror for VR, where you see your own avatar reflected correctly.

Problem

In VR each eye has a different point of view, so a single reflection texture looks wrong: the mirror has to show each eye its own correct reflection or the image breaks the sense of depth.

Approach

Most of the work is in code rather than shaders: a camera system calculates the reflected view for each eye and feeds the right image to the mirror surface for that eye.

VR constraints

A mirror means rendering the scene again for the reflection, once per eye, so its cost has to be managed carefully to avoid dropping frames, which in VR directly hurts comfort.

// migrated from the old wordpress portfolio