Skip to content

Mirrors

Add a real, reflective mirror — players (and their avatars) see themselves, fully in VR. Drop an SSMirror (Add Component ▸ Social Scape/World/Mirror) onto a flat mesh (a quad or plane) and you're done — no material or scripting required. Reflections are true scene renders: fog, shadows, the skybox and transparent objects all show up automatically, and mirrors can even reflect each other.

A mirror re‑renders your whole world — once per eye

A mirror is the single most expensive thing you can place in a world: it draws the scene again from behind the glass, twice in VR — and every recursion bounce draws it again. One well‑tuned mirror is fine; a wall of full‑resolution mirrors will wreck your frame rate. The inspector shows live guidance and a relative‑cost readout so you can see the effect of each choice. How you spend that budget is your call — we give you the levers and the guidance.

Adding one

  1. Make a quad (or a flat plane) where the mirror goes and face it into the room.
  2. Add Social Scape/World/Mirror to it.
  3. Press Play. A standing quad with Facing = Forward just works — the reflection auto‑orients toward the viewer.

That's the whole setup. Everything else is tuning — and the inspector has your back: real setup problems (no mesh renderer, a static‑batched mesh, a wrong‑shader material) show up as errors with one‑click fixes above the settings.

Reflection quality

Setting What it does Guidance
Resolution Sharpness of the reflection (texture size per eye). The biggest cost lever. 512 is plenty in VR — the headset lenses blur the edges anyway. Use 1024+ only for a large mirror viewed up close.
HDR High-dynamic-range reflection colours. Keep on unless you're squeezing every millisecond.
Anti Aliasing MSAA inside the reflection (Off/2×/4×/8×). 2× smooths edges nicely; 8× is rarely worth it.
Reflected Layers Which layers show up in the reflection. Your #1 performance win. Restrict it hard — drop UI, particles, tiny props, and anything the mirror can't really show.
Render Shadows Real-time shadows inside the reflection. Off by default. Turn on only if missing shadows are noticeable in your mirror.

Background / far look

Setting What it does
Background Color The colour the mirror fades to: at the distance limit, past the recursion budget (mirror‑in‑mirror), and wherever the reflection is off.
Probe Fallback Instead of the flat colour, faded‑out mirrors blend to this surface's baked reflection probe — a cheap mirror‑like sheen for far mirrors at zero reflection cost. Bake a probe near the mirror for best results.

Performance / culling

Setting What it does Guidance
Update Every N Frames Re-render the reflection every Nth frame (it keeps showing the last image in between). 2–3 roughly halves/thirds the cost and is usually invisible.
Max Render Distance Stop rendering beyond this many metres (0 = never). Great for small/decorative mirrors.
Fade Distance Fraction of the max distance over which the mirror eases to the background colour instead of popping. 0.25–0.5 looks natural.
Only When Visible Render only while the mirror is on screen. Leave on.
Recursions Mirror‑in‑mirror bounces (think two facing elevator mirrors). Each bounce is a full re-render. 1 = other mirrors show the background colour; 2 covers most rooms; save 3+ for a deliberate corridor set piece.
Recursion Darkening Dims each bounce toward the background colour. 0.2–0.4 sells depth and hides the budget cut-off.

Look

All of these are live‑tunable in Play mode — drag the sliders and watch the mirror change.

Setting What it does
Tint Colours the glass (warm/cool, smoked, etc.).
Reflectivity 1 = perfect mirror; lower fades toward the background for a dim/dirty mirror.
Blur Frosted / brushed-metal reflections. 0 = sharp. Costs extra texture reads when on.
Material Controls Look (Shown when a Mirror Material is assigned.) Hands the look over to your material — see Custom shaders.

Want ripples or animated distortion (water, funhouse glass)? Make a material with the SocialScape/Mirror/Surface shader, enable Refraction, and assign a scrolling normal map — then put that material in the mirror's Mirror Material slot.

Custom shaders (advanced)

You can write your own mirror shader — start from SocialScape/Mirror/Surface and extend it. Assign your material to Mirror Material and enable Material Controls Look: your material's authored values become authoritative and the component's Tint / Reflectivity / Background / Blur / Probe Fallback fields go inactive (they grey out). The runtime keeps driving only the reflection plumbing.

Your shader must honour this property contract:

Property Type Set by the runtime Your shader must
_TexLeft, _TexRight 2D per-eye reflection textures, every frame sample at the fragment's normalized screen position (they're screen-aligned per eye)
_DistanceBlend Float 0–1 distance fade / recursion budget 1 = show full reflection, 0 = show your "faded" look (this is how mirrors fade out and how mirror-in-mirror terminates)
_ForceEye Float -1 auto / 0 left / 1 right if ≥ 0, use that eye's texture; else pick by unity_StereoEyeIndex under #if defined(USING_STEREO_MATRICES)
_FlipY Float 0/1 per-context flip flip the sample UV's Y when 1
_HeadPos, _HeadRight Vector VR multipass only nearest-eye fallback when stereo matrices aren't available

Apply the standard screen-UV Y-correction (flip under UNITY_UV_STARTS_AT_TOP, flip again when _ProjectionParams.x < 0) — copy it from the stock shader. Reflection textures use Mirror wrap, so slight UV overshoot from distortion effects is safe.

Good habits

  • One hero mirror per room beats several mediocre ones.
  • Combine Max Render Distance + Fade Distance so mirrors gracefully shut off when nobody is near.
  • Keep Reflected Layers tight — reflections skip whole objects far cheaper than they draw them.
  • Don't mark the mirror mesh static — mirrors need their own bounds to cull correctly.