{
 "id": "tiled-deferred-shading",
 "title": "Tiled deferred shading",
 "aliases": [
  "tiled shading",
  "tile-based light culling"
 ],
 "domain": "performance",
 "subdomain": "light culling",
 "stage": "performance",
 "realtime": "realtime",
 "platforms": [
  "webgl2",
  "webgpu",
  "desktop-gpu",
  "mobile-gpu"
 ],
 "year_introduced": 2009,
 "inputs": [
  "gbuffer",
  "depth"
 ],
 "outputs": [
  "radiance"
 ],
 "style": "both",
 "dynamic": "both",
 "summary": "Cut the screen into small tiles, find each tile's depth range and the lights touching it, then shade the G-buffer pixels with just that tile's light list.",
 "how_it_works": "After the G-buffer pass, a compute shader processes one tile per workgroup. Threads reduce the tile's min and max depth, build its frustum, and cooperatively test all lights against it, appending hits to a list in shared memory. Then each thread shades its pixel by looping that list, reading material data from the G-buffer.\n\nBecause lighting is done once per pixel and light lists are small, many hundreds of lights become affordable, though G-buffer bandwidth and material variety are limited.",
 "when_to_use": "Choose it with a deferred renderer and many small lights. Prefer `clustered-forward-shading` when you need MSAA, transparency, or wide depth ranges inside tiles. Prefer plain forward rendering with few lights on mobile.",
 "cost": {
  "class": "medium",
  "notes": "Scales with light count per tile and G-buffer width."
 },
 "failure_modes": [
  "Tiles with a large depth range, such as at silhouettes, get excess lights",
  "Transparent surfaces do not fit the G-buffer",
  "MSAA multiplies G-buffer cost",
  "Only one material model per G-buffer layout"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1080/2151237x.2011.621761",
   "type": "paper",
   "title": "Tiled Shading",
   "authors": [
    "Ola Olsson",
    "Ulf Assarsson"
   ],
   "year": 2011,
   "venue": "Journal of Graphics, GPU, and Game Tools",
   "url": "https://doi.org/10.1080/2151237x.2011.621761",
   "ids": {
    "doi": "10.1080/2151237x.2011.621761"
   },
   "license": null,
   "extra": {
    "csl_type": "journal-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1080/2151237x.2011.621761",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1080/2151237x.2011.621761",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1080/2151237x.2011.621761",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1080/2151237x.2011.621761",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1080/2151237x.2011.621761",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "olsson2011tiled"
  },
  {
   "role": "primary",
   "key": "doi:10.1145/2343045.2343095",
   "type": "paper",
   "title": "Tiled and clustered forward shading",
   "authors": [
    "Ola Olsson",
    "Markus Billeter",
    "Ulf Assarsson"
   ],
   "year": 2012,
   "venue": "ACM SIGGRAPH 2012 Posters on - SIGGRAPH '12",
   "url": "https://doi.org/10.1145/2343045.2343095",
   "ids": {
    "doi": "10.1145/2343045.2343095"
   },
   "license": null,
   "extra": {
    "csl_type": "proceedings-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/2343045.2343095",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/2343045.2343095",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/2343045.2343095",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/2343045.2343095",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/2343045.2343095",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "olsson2012tiled"
  }
 ],
 "presets": [
  {
   "id": "tiled-deferred-shading-specimen",
   "title": "Toy 2D tile light-culling heat map for animated point lights",
   "runtime": "glsl-fragment",
   "params": {
    "LIGHTS": 24,
    "TILE": 32
   },
   "code": "// Toy 2D light-culling view: screen split into 32px tiles, heat colour = number of lights whose radius overlaps the tile.\nconst int LIGHTS = 24;\nconst float TILE = 32.0;\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n    vec2 tileMin = floor(fragCoord / TILE) * TILE, tileMax = tileMin + TILE;\n    int cnt = 0; float lit = 0.0, ring = 1e9, cdist = 1e9;\n    for (int i = 0; i < LIGHTS; i++) {\n        float f = float(i);\n        vec2 c = (vec2(0.5) + 0.42 * vec2(sin(f * 2.3 + iTime * 0.4 + f * f * 0.05), cos(f * 1.7 + iTime * 0.3))) * iResolution.xy;\n        float r = 40.0 + 55.0 * fract(sin(f * 12.9) * 4375.0);\n        vec2 q = clamp(c, tileMin, tileMax);\n        if (distance(q, c) < r) cnt++;\n        float d = distance(fragCoord, c);\n        lit += smoothstep(r, 0.0, d) * smoothstep(r, 0.0, d);\n        ring = min(ring, abs(d - r));\n        cdist = min(cdist, d);\n    }\n    float x = float(cnt) / 6.0;\n    vec3 heat = clamp(vec3(1.5 * x, 1.5 - abs(3.0 * x - 1.5), 1.5 - 1.5 * x), 0.0, 1.0);\n    vec3 col = mix(vec3(0.04, 0.05, 0.08), heat * 0.55, cnt > 0 ? 1.0 : 0.0);\n    col += vec3(1.0, 0.9, 0.7) * lit * 0.12;\n    vec2 g = fract(fragCoord / TILE);\n    col = mix(col, vec3(0.0), (g.x < 0.04 || g.y < 0.04) ? 0.55 : 0.0);\n    col = mix(col, vec3(1.0), smoothstep(1.2, 0.5, ring) * 0.7);\n    col = mix(col, vec3(1.0), smoothstep(4.0, 2.5, cdist));\n    fragColor = vec4(pow(col, vec3(0.8)), 1.0);\n}\n",
   "basis": "original",
   "license_note": "written for this index",
   "execution_fidelity": "conceptual-diagram",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-29",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "tiled-deferred-shading",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-29T15:51:50.471Z",
     "renderer": "Chromium 145.0.7632.6 headless, WebGL2 via ANGLE/SwiftShader, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.4992,
      "std": 0.1989,
      "unique_colors": 373
     },
     "image": "/specimens/tiled-deferred-shading-specimen.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "clustered-forward-shading"
 ],
 "extends": [
  "deferred-shading"
 ],
 "supersedes": [],
 "combines_with": [
  {
   "id": "hierarchical-z-occlusion-culling",
   "why": "The depth pre-pass gives per-tile min and max depth for light culling and the pyramid for object culling."
  }
 ],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/performance/tiled-deferred-shading.json"
 },
 "solves": [
  "too many small lights tank deferred performance",
  "each pixel shades every light unnecessarily",
  "need a light list per screen region",
  "scene with hundreds of point lights on opaque geometry"
 ],
 "authority": "Olsson & Assarsson, 2011",
 "url": "https://texelatlas.vercel.app/t/tiled-deferred-shading/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 14.72,
  "tier": "moderate",
  "p50_ms": 0.4842,
  "p95_ms": 0.5053,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "tiled-deferred-shading-specimen",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 12.92,
   "tier": "moderate",
   "p50_ms": 0.2055,
   "p95_ms": 0.2057,
   "speedup_x": 2.36,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 9.23,
   "tier": "moderate",
   "p50_ms": 0.2657,
   "p95_ms": 0.2658,
   "speedup_x": 1.82,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}