---
id: "planar-reflections-oblique-clipping"
title: "Planar reflections with oblique near-plane clipping"
aliases: [mirror reflection pass, water plane reflection render, oblique frustum clipping, Lengyel oblique clipping]
domain: "gi"
stage: "lighting"
realtime: "realtime"
platforms: [webgl2, webgpu, desktop-gpu, mobile-gpu, unity, unreal, godot]
year_introduced: 2004
inputs: [mesh]
outputs: [radiance, texture]
style: "both"
dynamic: "dynamic"
cost: "medium"
authority: "Lengyel, 2005"
url: "https://texelatlas.vercel.app/t/planar-reflections-oblique-clipping/"
sources_verified_at: "2026-11-29"
---
# Planar reflections with oblique near-plane clipping (Lengyel, 2005)

> Render the scene a second time from a camera mirrored across a plane, with the near clipping plane replaced by the mirror plane so nothing behind it is drawn. The texture then supplies exact reflections for a flat surface.

## Reach for it when

- need exact mirror or water reflections on a flat plane
- objects below the water show up in the reflection
- reflection render includes geometry behind the mirror
- want a cheap clean reflection for a polished floor

## How it works

For a flat reflector, the reflection equals the scene seen from a virtual camera reflected through the plane. Build the reflected view matrix, render into a texture, and sample that texture on the mirror in screen space (optionally offset by a normal map for water ripples).

Two problems need care. Geometry between the reflected camera and the mirror, which lies behind the real mirror plane, must be clipped or it appears in the reflection. User clip planes are not always available and cost shader work, so the standard fix modifies the projection matrix: the near plane is replaced by the mirror plane, giving an oblique frustum. The projection is adjusted by Lengyel's method, which rewrites the third row of the matrix from the clip-space plane and scales it to keep the far plane in range.

Render triangle winding flips with the mirrored transform, so culling must be reversed. Cost is a second scene pass, so use a lower resolution, fewer shadow casters and a layer mask.

## When to use it

Choose it for a single flat reflector with exact, dynamic reflections: mirrors, calm water, polished floors, TV screens.

Prefer [screen-space-reflections](screen-space-reflections) when several surfaces need glossy reflections without extra passes and some missing off-screen content is acceptable. Prefer [reflection-probes-parallax-corrected-cubemaps](reflection-probes-parallax-corrected-cubemaps) for many rough or curved reflectors where one cubemap approximation is enough. Prefer [hybrid-ray-traced-reflections](hybrid-ray-traced-reflections) for arbitrary geometry on ray-tracing hardware. For rippling water combine with [gerstner-waves](gerstner-waves) or [flow-map-water](flow-map-water) normals.

## Cost

medium — A full second geometry pass at reduced resolution; cost grows with scene complexity and shadow casters visible in the mirror.
Measured GPU Weight: 19.67× baseline (moderate) — 0.6098 ms median / 0.6509 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 17.47× baseline (moderate) — 0.2777 ms median (2.2× faster on L4).
Ampere A100 scaling: 12.83× baseline (moderate) — 0.3695 ms median (1.65× faster on A100).

## Failure modes

- Objects below the water or behind the mirror leak into the reflection when the oblique clip is missing or wrong
- Depth precision collapses if the oblique near plane is steep, so distant reflected geometry z-fights
- Culling winding is not flipped, giving inside-out reflected meshes or missing faces
- Reflection texture is a frame late when the camera moves quickly, producing a visible lag at the mirror's edges
- Multiple mirrors need one pass each, and recursive mirror-in-mirror views blow up cost
- Roughness cannot be handled without blur; a single sharp texture makes frosted floors look like perfect mirrors

## Engine support

- babylonjs: builtin — `new MirrorTexture(name, size, scene); mirrorTexture.mirrorPlane = plane` (evidence: https://github.com/BabylonJS/Babylon.js/blob/9.38.0/packages/dev/core/src/Materials/Textures/mirrorTexture.pure.ts, checked 2026-12-01)
- blender: builtin — `Add > Light Probe > Plane` (evidence: https://docs.blender.org/manual/en/5.2/render/eevee/light_probes/plane.html, checked 2026-12-01) — EEVEE only; oblique clipping is not documented.
- threejs: official — `import { Reflector } from 'three/addons/objects/Reflector.js'` (evidence: https://github.com/mrdoob/three.js/blob/r187/examples/jsm/objects/Reflector.js, checked 2026-12-01)
- unity: builtin — `HDRP: Planar Reflection Probe` (evidence: https://github.com/Unity-Technologies/Graphics/blob/557f6ac22b948284f57ffae6a789751fd1f63620/Packages/com.unity.render-pipelines.high-definition/Documentation~/Planar-Reflection-Probe.md, checked 2026-12-01) — HDRP only.
- unreal: builtin — `Place a Planar Reflection actor` (evidence: https://dev.epicgames.com/documentation/en-us/unreal-engine/reflections-environment-in-unreal-engine, checked 2026-12-01) — Planar reflection actor; oblique clipping is not documented.

## Dataflow

- Inputs: mesh
- Outputs: radiance, texture
- Platforms: webgl2, webgpu, desktop-gpu, mobile-gpu, unity, unreal, godot

## Presets

### Planar Reflections & Oblique Clipping — unclipped submerged leak (left) vs oblique-clipped mirror (right) (glsl-fragment; rendered 2026-11-30)

```json
{
  "P_RIPPLE_AMP": 0.35,
  "P_SUBMERGED_VIS": 1,
  "P_SUN_ANGLE": 0.65,
  "P_SPLIT": 0.48
}
```

```glsl
const float P_RIPPLE_AMP = 0.35; // P Water Ripple [0.0, 1.2, 0.03]
const float P_SUBMERGED_VIS = 1.0; // P Leak Contrast [0.2, 1.8, 0.05]
const float P_SUN_ANGLE = 0.65; // P Orbit Speed [0.0, 2.0, 0.05]
const float P_SPLIT = 0.48; // P Unclipped / Oblique [0.0, 1.0, 0.02]

mat2 rot2(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }

float sdTorus(vec3 p, vec2 t) {
  vec2 q = vec2(length(p.xz) - t.x, p.y);
  return length(q) - t.y;
}

float sdBox(vec3 p, vec3 b) {
  vec3 q = abs(p) - b;
  return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0);
}

// Scene above reflection plane (y > 0) AND submerged red-orange obstacle below plane (y < 0)!
vec2 mapWorld(vec3 p, float t, bool clipBelow) {
  // Above-water rotating golden torus sculpture + glowing cyan ring + pillars
  vec3 q = p - vec3(0.0, 0.56, -0.35);
  q.xz = rot2(t * 0.75) * q.xz;
  q.xy = rot2(0.55) * q.xy;
  vec2 res = vec2(sdTorus(q, vec2(0.36, 0.11)), 2.0);

  float dOrb = length(p - vec3(0.0, 0.56 + 0.08 * sin(t * 1.8), -0.35)) - 0.15;
  if (dOrb < res.x) res = vec2(dOrb, 3.0);

  float dPilL = sdBox(p - vec3(-0.92, 0.48, -0.85), vec3(0.14, 0.48, 0.14)) - 0.02;
  if (dPilL < res.x) res = vec2(dPilL, 4.0);
  float dPilR = sdBox(p - vec3(0.92, 0.48, -0.85), vec3(0.14, 0.48, 0.14)) - 0.02;
  if (dPilR < res.x) res = vec2(dPilR, 4.0);

  // Submerged bright crimson truss/box sitting BELOW y = 0 between mirrored camera and reflection plane!
  // Without oblique near-plane clipping, the mirrored camera hits this submerged box and corrupts the reflection!
  if (!clipBelow) {
    float dSub = sdBox(p - vec3(0.0, -0.44, 0.45), vec3(0.58, 0.28, 0.22));
    if (dSub < res.x) res = vec2(dSub, 5.0);
  }
  return res;
}

vec3 calcNormal(vec3 p, float t, bool clipBelow) {
  vec2 e = vec2(0.0025, 0.0);
  return normalize(vec3(
    mapWorld(p + e.xyy, t, clipBelow).x - mapWorld(p - e.xyy, t, clipBelow).x,
    mapWorld(p + e.yxy, t, clipBelow).x - mapWorld(p - e.yxy, t, clipBelow).x,
    mapWorld(p + e.yyx, t, clipBelow).x - mapWorld(p - e.yyx, t, clipBelow).x
  ));
}

vec3 shadeSky(vec3 rd) {
  float h = clamp(rd.y * 0.5 + 0.5, 0.0, 1.0);
  vec3 sky = mix(vec3(0.09, 0.14, 0.24), vec3(0.24, 0.42, 0.72), pow(h, 0.8));
  vec3 sun = normalize(vec3(0.55, 0.42, -0.72));
  sky += vec3(1.8, 1.25, 0.75) * pow(max(dot(rd, sun), 0.0), 28.0);
  return sky;
}

vec3 traceScene(vec3 ro, vec3 rd, float t, bool clipBelow, float leakGain) {
  float dSum = 0.0;
  float matId = 0.0;
  bool hit = false;
  for (int i = 0; i < 56; i++) {
    vec3 p = ro + rd * dSum;
    vec2 h = mapWorld(p, t, clipBelow);
    if (h.x < 0.0022) { hit = true; matId = h.y; break; }
    dSum += h.x;
    if (dSum > 8.5) break;
  }
  if (!hit) return shadeSky(rd);

  vec3 p = ro + rd * dSum;
  vec3 n = calcNormal(p, t, clipBelow);
  vec3 lDir = normalize(vec3(0.55, 0.80, 0.35));
  float diff = max(dot(n, lDir), 0.0);
  float spec = pow(max(dot(n, normalize(lDir - rd)), 0.0), 48.0);

  if (matId > 4.5) {
    // Corrupted submerged geometry leaking into unclipped reflection
    float stripe = smoothstep(0.45, 0.55, sin((p.x + p.y) * 32.0));
    return mix(vec3(0.95, 0.16, 0.12), vec3(1.15, 0.55, 0.10), stripe) * (0.55 + 0.65 * diff) * leakGain;
  }
  if (matId > 2.5 && matId < 3.5) {
    return vec3(0.22, 1.45, 1.85) * (0.65 + 0.5 * diff) + vec3(0.9) * spec;
  }
  vec3 alb = (matId < 2.5) ? vec3(0.92, 0.68, 0.24) : vec3(0.62, 0.68, 0.78);
  return alb * (0.24 + 0.85 * diff) + vec3(1.0, 0.95, 0.85) * spec * 0.65;
}

vec3 aces(vec3 x) {
  x = max(x, 0.0);
  return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
}

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
  float screenX = fragCoord.x / max(iResolution.x, 1.0);
  float split = clamp(P_SPLIT, 0.0, 1.0);
  bool useObliqueClip = screenX >= split;
  float ripple = clamp(P_RIPPLE_AMP, 0.0, 1.2);
  float leakGain = clamp(P_SUBMERGED_VIS, 0.2, 2.0);
  float t = iTime * max(P_SUN_ANGLE, 0.0);

  vec3 ro = vec3(0.0, 0.68, 2.18);
  vec3 rd = normalize(vec3(uv - vec2(0.0, 0.04), -1.48));

  // First trace primary camera above plane y = 0
  float tPlane = (rd.y < -0.001) ? ((0.0 - ro.y) / rd.y) : 1e5;
  float dPrimary = 0.0;
  float matId = 0.0;
  bool hitAbove = false;
  for (int i = 0; i < 56; i++) {
    vec3 p = ro + rd * dPrimary;
    if (dPrimary > tPlane) break;
    vec2 h = mapWorld(p, t, true);
    if (h.x < 0.0022) { hitAbove = true; matId = h.y; break; }
    dPrimary += h.x;
    if (dPrimary > 8.5) break;
  }

  vec3 col = vec3(0.0);
  if (hitAbove) {
    col = traceScene(ro, rd, t, true, leakGain);
  } else if (tPlane < 12.0) {
    // Hit glossy water/marble mirror plane y = 0
    vec3 pFloor = ro + rd * tPlane;
    vec2 wGrad = vec2(
      cos(pFloor.x * 7.5 + t * 2.1) * sin(pFloor.z * 6.2 - t * 1.4),
      sin(pFloor.x * 6.4 - t * 1.6) * cos(pFloor.z * 8.1 + t * 1.9)
    ) * 0.045 * ripple;
    vec3 nPlane = normalize(vec3(wGrad.x, 1.0, wGrad.y));

    // Mirrored virtual camera across y = 0: ro_m = (ro.x, -ro.y, ro.z)
    vec3 roMirror = vec3(ro.x, -ro.y, ro.z);
    vec3 rdMirror = normalize(pFloor - roMirror + vec3(wGrad.x, 0.0, wGrad.y) * 0.8);

    // Core technique:
    // Left (no oblique clip): ray starts at mirrored camera BELOW y=0 and hits submerged box!
    // Right (oblique near plane at y=0): ray starts clipped at pFloor on y=0, rejecting everything below!
    vec3 reflCol = useObliqueClip
      ? traceScene(pFloor + vec3(0.0, 0.004, 0.0), rdMirror, t, true, leakGain)
      : traceScene(roMirror, rdMirror, t, false, leakGain);

    float fresnel = 0.16 + 0.84 * pow(1.0 - max(dot(nPlane, -rd), 0.0), 4.0);
    float tile = mod(floor(pFloor.x * 1.8) + floor(pFloor.z * 1.8), 2.0);
    vec3 floorBase = mix(vec3(0.04, 0.07, 0.11), vec3(0.08, 0.12, 0.18), tile);
    col = mix(floorBase, reflCol, clamp(fresnel * 0.92, 0.25, 0.96));
  } else {
    col = shadeSky(rd);
  }

  float sep = smoothstep(0.0035, 0.0008, abs(screenX - split));
  col = mix(col, vec3(0.95, 0.97, 1.0), sep);

  fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}
```

Attribution: MIT — written for this index.

## Combines with

- [Gerstner (Trochoidal) Waves](https://texelatlas.vercel.app/t/gerstner-waves.md): Wave normals distort the planar reflection lookup so the water surface looks rippled.
- [Flow-map water animation](https://texelatlas.vercel.app/t/flow-map-water.md): A flowing normal map perturbs the reflected texture coordinates for moving water.

## Combination ideas

- [Mirrored refractive caustics via photon mapping and oblique planar reflections](https://texelatlas.vercel.app/ideas/caustic-photon-map-planar-reflections/)
- [Oblique-clipped planar reflections on sloshing FLIP fluid pools](https://texelatlas.vercel.app/ideas/flip-fluid-oblique-planar-reflections/)

## Sources

1. [primary] Eric Lengyel (2005) Oblique View Frustum Depth Projection and Clipping. Journal of Game Development, 2005. http://www.terathon.com/lengyel/Lengyel-Oblique.pdf (verified via http on 2026-11-30)
2. [implementation] three.js contributors three.js Reflector, planar reflection with oblique near-plane clipping. github.com. https://github.com/mrdoob/three.js/blob/dev/examples/jsm/objects/Reflector.js (verified via http on 2026-11-29)

## Cite this entry

Texel. "Planar reflections with oblique near-plane clipping." https://texelatlas.vercel.app/t/planar-reflections-oblique-clipping/ (accessed 2026-12-01).
