---
id: "shadow-map-bias-slope-scale-normal-offset"
title: "Shadow map depth bias (constant, slope-scale, normal offset)"
aliases: [shadow bias, depth bias, slope-scaled depth bias, normal-offset shadows, shadow acne fix]
domain: "visibility"
stage: "visibility"
realtime: "realtime"
platforms: [webgl2, webgpu, desktop-gpu, mobile-gpu, unity, unreal, godot]
year_introduced: 2014
inputs: [depth, normals, mesh]
outputs: [visibility-mask]
style: "both"
dynamic: "dynamic"
cost: "cheap"
authority: "Dou et al., 2014"
url: "https://texelatlas.vercel.app/t/shadow-map-bias-slope-scale-normal-offset/"
sources_verified_at: "2026-11-29"
---
# Shadow map depth bias (constant, slope-scale, normal offset) (Dou et al., 2014)

> A family of offsets that keep a surface from shadowing itself in a shadow map: a constant depth offset, a term scaled by the surface's slope to the light, and a shift along the normal before lookup.

## Reach for it when

- shadows covered in stripes on surfaces facing away from light
- shadow detaches from the bottom of objects
- floor looks striped or moire-patterned in shadowed areas
- characters seem to float above ground because shadow is offset
- shadow leaks through thin walls near contact point

## How it works

A shadow map stores depth at texel centres, but a receiver sampled between centres sits at a slightly different light-space depth, so a tilted surface compares itself against a sample that can be nearer than the point being shaded. Without correction half of every texel reads as shadowed (acne). Three fixes are combined. A **constant bias** subtracts a fixed amount from the receiver depth. A **slope-scaled bias** grows with the tangent of the angle between normal and light (or the depth gradient, as hardware polygon offset does), because the error grows as the surface becomes grazing. A **normal offset** moves the world position along the geometric normal by about one shadow texel (scaled by the sine of the light angle) before projecting, which shrinks the needed depth bias and avoids light leaking at contact points. Biases are best expressed in texel or world-space units per cascade, not clip-space depth, because texel footprint changes with every cascade and light type. Adaptive schemes compute the bias from the receiver's actual depth gradient.

## When to use it

Use it in every shadow-mapped renderer; it is the first thing to tune before blaming filtering. Prefer normal offset plus a small slope-scaled term over a big constant bias, which causes peter-panning (shadows detached from their casters). Reach for [Percentage-Closer Filtering](https://texelatlas.vercel.app/t/percentage-closer-filtering.md) or [Variance Shadow Maps](https://texelatlas.vercel.app/t/variance-shadow-maps.md) when the remaining artifact is blocky edges rather than self-shadowing, and use [Screen-Space Contact Shadows](https://texelatlas.vercel.app/t/contact-shadows.md) to recover the small-scale detail that bias removes. Per-cascade tuning matters with [Cascaded Shadow Maps](https://texelatlas.vercel.app/t/cascaded-shadow-maps.md); [Virtual Shadow Maps](https://texelatlas.vercel.app/t/virtual-shadow-maps.md) and [Ray-Traced Shadows](https://texelatlas.vercel.app/t/ray-traced-shadows.md) reduce but do not remove the need.

## Cost

cheap — A few ALU operations in the shadow lookup; the depth-bias state in the caster pass is free on fixed-function hardware.
Measured GPU Weight: 0.99× baseline (feather) — 0.0325 ms median / 0.0397 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 0.99× baseline (feather) — 0.0157 ms median (2.07× faster on L4).
Ampere A100 scaling: 1× baseline (feather) — 0.0288 ms median (1.13× faster on A100).

## Failure modes

- Shadow acne stripes on surfaces near-parallel to the light when bias is too small
- Peter-panning: the shadow visibly detaches from the base of the caster when constant bias is too large
- Light leaking at thin walls and contact edges because bias exceeds wall thickness
- A bias tuned for one cascade or light range shows acne or detachment in another
- Normal offset shrinks or grows silhouettes of shadows on curved or finely tessellated geometry
- Back-face casting hides acne on closed meshes but leaks on thin or open geometry

## Engine support

- babylonjs: builtin — `shadowGenerator.bias, shadowGenerator.normalBias` (evidence: https://github.com/BabylonJS/Babylon.js/blob/9.38.0/packages/dev/core/src/Lights/Shadows/shadowGenerator.ts, checked 2026-12-01)
- blender: builtin — `EEVEE > Render Properties > Sampling > Shadows (virtual shadow maps + normal/jitter bias)` (evidence: https://docs.blender.org/manual/en/5.2/render/eevee/render_settings/sampling.html, checked 2026-12-01)
- godot: builtin — `Light3D.shadow_bias and Light3D.shadow_normal_bias` (evidence: https://github.com/godotengine/godot/blob/4.7.2-stable/doc/classes/Light3D.xml, checked 2026-12-01) — Constant plus normal offset; no separate slope-scale parameter.
- metal: builtin — `MTLRenderCommandEncoder.setDepthBias(_:slopeScale:clamp:)` (evidence: https://developer.apple.com/tutorials/data/documentation/metal/mtlrendercommandencoder/setdepthbias(_:slopescale:clamp:).json, checked 2026-12-01) — Constant and slope-scale bias; normal-offset bias is done in MSL.
- threejs: builtin — `light.shadow.bias, light.shadow.normalBias` (evidence: https://github.com/mrdoob/three.js/blob/r187/src/lights/LightShadow.js, checked 2026-12-01)
- unity: builtin — `Light > Shadow Type; Light.shadowBias and Light.shadowNormalBias` (evidence: https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Light-shadowBias.html, checked 2026-12-01)
- unreal: builtin — `Light component > Details > Shadow Bias properties (set per light)` (evidence: https://dev.epicgames.com/documentation/en-us/unreal-engine/shadowing-in-unreal-engine, checked 2026-12-01) — Per-light bias properties.
- webgpu: builtin — `GPUDepthStencilState: depthBias, depthBiasSlopeScale, depthBiasClamp` (evidence: https://www.w3.org/TR/webgpu/, checked 2026-12-01) — Hardware constant and slope-scale bias; normal-offset bias is done in WGSL.

## Dataflow

- Inputs: depth, normals, mesh
- Outputs: visibility-mask
- Platforms: webgl2, webgpu, desktop-gpu, mobile-gpu, unity, unreal, godot

## Presets

### Bias comparison: acne, tuned, peter-panning (glsl-fragment; rendered 2026-11-29)

```json
{
  "slope": 2,
  "texels": 32,
  "bias_panels": [
    0,
    0.08,
    0.3
  ]
}
```

```glsl
// GLSL ES 3.0, Shadertoy-style. Three panels: no bias (acne), tuned bias, huge bias (peter-panning).
// Top-down view of a ground plane lit at a grazing angle, shadowed by a wall, with a low-res shadow map.
const float SLOPE = 2.0;    // receiver light-depth gradient across the plane (grazing light)
const float TEXELS = 32.0;  // shadow-map resolution across one panel
const float GAP = 0.8;      // depth separation gained per unit of shadow length behind the wall
const vec3 BIAS = vec3(0.0, 0.08, 0.3);
const float WALL_X = -0.5;

float lit(vec2 p, float bias) {
  float t = 2.0 / TEXELS;
  vec2 c = (floor((p + 1.0) / t) + 0.5) * t - 1.0;   // texel centre: what the map actually stored
  bool inShadowTexel = c.x > WALL_X && c.x < WALL_X + 0.6 && abs(c.y) < 0.35;
  float stored = SLOPE * c.x - (inShadowTexel ? GAP * (c.x - WALL_X) : 0.0);
  float receiver = SLOPE * p.x;
  return (receiver - bias > stored) ? 0.0 : 1.0;      // 0 = shadowed
}

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
  vec2 uv = fragCoord / iResolution.xy;
  float panel = floor(uv.x * 3.0);
  vec2 p = vec2(fract(uv.x * 3.0) * 2.0 - 1.0, uv.y * 2.0 - 1.0);
  float bias = panel < 0.5 ? BIAS.x : (panel < 1.5 ? BIAS.y : BIAS.z);
  float l = lit(p, bias);
  vec3 ground = vec3(0.86, 0.80, 0.68) * (0.30 + 0.70 * l);
  ground *= 0.92 + 0.08 * sin(p.y * 40.0);
  bool wall = p.x > WALL_X - 0.08 && p.x < WALL_X && abs(p.y) < 0.35;
  vec3 col = wall ? vec3(0.35, 0.22, 0.18) : ground;
  float edge = abs(fract(uv.x * 3.0) - 0.5);
  if (edge > 0.495) col = vec3(1.0);
  fragColor = vec4(col, 1.0);
}

```

Attribution: written for this index

## Lineage

- extends [Shadow Mapping](https://texelatlas.vercel.app/t/shadow-mapping.md)

## Combines with

- [Cascaded Shadow Maps](https://texelatlas.vercel.app/t/cascaded-shadow-maps.md): Per-cascade texel size defines the bias and normal-offset magnitude applied in each cascade lookup.
- [Percentage-Closer Filtering](https://texelatlas.vercel.app/t/percentage-closer-filtering.md): Bias must cover the whole PCF kernel footprint, so the receiver depth is plane-fitted or offset before the multi-tap compare.

## Sources

1. [primary] Hang Dou, Yajie Yan, Ethan Kerzner, Zeng Dai, Chris Wyman (2014) Adaptive depth bias for shadow maps. Proceedings of the 18th meeting of the ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games. https://doi.org/10.1145/2556700.2556706 (verified via crossref on 2026-11-29)
2. [tutorial] Microsoft Common Techniques to Improve Shadow Depth Maps. learn.microsoft.com. https://learn.microsoft.com/en-us/windows/win32/dxtecharts/common-techniques-to-improve-shadow-depth-maps (verified via http on 2026-11-29)
3. [tutorial] Matt Pettineo A Sampling of Shadow Techniques. therealmjp.github.io. https://therealmjp.github.io/posts/shadow-maps (verified via http on 2026-11-29)
4. [implementation] mrdoob (2010) mrdoob/three.js. https://github.com/mrdoob/three.js License: MIT. (verified via github on 2026-11-29)

## Cite this entry

Texel. "Shadow map depth bias (constant, slope-scale, normal offset)." https://texelatlas.vercel.app/t/shadow-map-bias-slope-scale-normal-offset/ (accessed 2026-12-01).
