{
 "id": "ltc-area-lights",
 "title": "Linearly Transformed Cosines for Area Lights",
 "aliases": [
  "LTC"
 ],
 "domain": "gi",
 "subdomain": "analytic direct lighting",
 "stage": "lighting",
 "realtime": "realtime",
 "platforms": [
  "webgl2",
  "webgpu",
  "desktop-gpu",
  "unity",
  "unreal"
 ],
 "year_introduced": 2016,
 "inputs": [
  "gbuffer",
  "material-params"
 ],
 "outputs": [
  "radiance"
 ],
 "style": "photoreal",
 "dynamic": "dynamic",
 "summary": "Fits a BRDF lobe with a clamped cosine transformed by a 3x3 matrix. Since the integral of a cosine over a polygon has a closed form, polygonal area lights are shaded exactly without sampling, noise or shadow rays.",
 "how_it_works": "A clamped cosine distribution over the sphere can be integrated against a polygon in closed form (it reduces to summing edge contributions). The trick is that a **linear transform** of a cosine lobe is still a normalized distribution: if `D(w) = cos_clamped(M^-1 w) * |det(M^-1)| / |M^-1 w|^3`, then the polygon integral of `D` equals the cosine integral of the polygon *transformed by `M^-1`*.\n\nSo the BRDF (GGX for a given roughness and view angle) is fitted offline with a matrix `M` and magnitude/Fresnel terms. Fits across the 2D parameter space of roughness and view angle are stored in two small 64x64 lookup textures. At runtime a pixel samples the textures for its `M^-1`, transforms the light polygon's vertices into the cosine-lobe space, clips against the horizon, and evaluates the closed-form edge sum.\n\nDiffuse shading uses `M = I`. Textured area lights (a TV screen) are supported by filtering the texture with a lookup based on the solid angle of the polygon.",
 "when_to_use": "Choose it for noise-free rectangular, disc or polygonal area lights with GGX materials in forward or deferred shading, where you want soft highlights from fluorescent tubes and windows at a few ALU ops per light.\n\nPrefer [restir-di](restir-di) or sampling with [light-bvh-many-lights](light-bvh-many-lights) when many emitters or shadowing must be handled, since LTC gives unshadowed lighting. Prefer [split-sum-ibl](split-sum-ibl) for distant environment lighting. Prefer [path-tracing](path-tracing) offline for accurate shadows and multi-bounce.",
 "cost": {
  "class": "cheap",
  "notes": "Per-light cost is two LUT fetches plus a small polygon integral; performance scales with vertex count of each light."
 },
 "failure_modes": [
  "No shadows: occlusion must be added separately (shadow maps, ray-traced shadows), and unshadowed light leaks under a table",
  "Fit error: the LTC approximation is not exact for grazing angles or very rough/anisotropic materials",
  "Polygon must be clipped to the horizon, and lights that straddle the surface plane need careful handling to avoid discontinuities",
  "Textured light filtering is approximate, with blurring of high-frequency texture detail"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1145/2897824.2925895",
   "type": "paper",
   "title": "Real-time polygonal-light shading with linearly transformed cosines",
   "authors": [
    "Eric Heitz",
    "Jonathan Dupuy",
    "Stephen Hill",
    "David Neubelt"
   ],
   "year": 2016,
   "venue": "ACM Transactions on Graphics",
   "url": "https://doi.org/10.1145/2897824.2925895",
   "ids": {
    "doi": "10.1145/2897824.2925895"
   },
   "license": null,
   "extra": {
    "csl_type": "journal-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/2897824.2925895",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/2897824.2925895",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/2897824.2925895",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/2897824.2925895",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/2897824.2925895",
     "checked_at": "2026-11-30T17:59:51.239Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-30T17:59:51.239Z",
   "title_sim": 1,
   "__bib": "heitz2016polygonal"
  },
  {
   "role": "tutorial",
   "key": "url:https://eheitzresearch.wordpress.com/415-2",
   "type": "tutorial",
   "title": "Real-Time Polygonal-Light Shading with Linearly Transformed Cosines (project page)",
   "authors": [
    "Eric Heitz"
   ],
   "year": null,
   "venue": "eheitzresearch.wordpress.com",
   "url": "https://eheitzresearch.wordpress.com/415-2",
   "ids": {},
   "license": null,
   "extra": {
    "http_status": 200,
    "live": true,
    "archive": {
     "url": "http://web.archive.org/web/20261029062710/https://eheitzresearch.wordpress.com/415-2/",
     "timestamp": "20261029062710"
    },
    "page_title": " ",
    "host": "eheitzresearch.wordpress.com",
    "title_confirmed_by_page": false,
    "title_unconfirmed": true
   },
   "provenance": {
    "title": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "http",
     "endpoint": "GET https://eheitzresearch.wordpress.com/415-2 → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "http",
     "endpoint": "GET https://eheitzresearch.wordpress.com/415-2 → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 0,
   "__bib": "heitzpolygonal"
  }
 ],
 "presets": [
  {
   "id": "ltc-area-lights-live",
   "title": "Analytic LTC polygonal quad area light — noise-free GGX specular and cosine diffuse",
   "runtime": "glsl-fragment",
   "params": {
    "ROUGHNESS": 0.28,
    "LIGHT_WIDTH": 1.4,
    "LIGHT_HEIGHT": 0.85,
    "INTENSITY": 3.2
   },
   "basis": "original",
   "license_note": "MIT — written for this index",
   "code": "const float ROUGHNESS = 0.28; // P\nconst float LIGHT_WIDTH = 1.4; // P\nconst float LIGHT_HEIGHT = 0.85; // P\nconst float INTENSITY = 3.2; // P\n\nvec3 integrateEdgeVec(vec3 v1, vec3 v2) {\n  float x = clamp(dot(v1, v2), -0.9999, 0.9999);\n  float y = abs(x);\n  float a = 0.8543985 + (0.4965155 + 0.0145206 * y) * y;\n  float b = 3.4175940 + (4.1616724 + y) * y;\n  float v = a / b;\n  float theta_sintheta = (x > 0.0) ? v : 0.5 * inversesqrt(max(1.0 - x * x, 1e-6)) - v;\n  return cross(v1, v2) * theta_sintheta;\n}\n\nfloat ltcEvaluate(vec3 N, vec3 V, vec3 P, mat3 invM, vec3 pts[4]) {\n  vec3 T1 = normalize(V - N * dot(V, N));\n  vec3 T2 = cross(N, T1);\n  mat3 basis = invM * transpose(mat3(T1, T2, N));\n\n  vec3 L[4];\n  for (int i = 0; i < 4; i++) L[i] = basis * (pts[i] - P);\n  vec3 dir = pts[0] - P;\n  vec3 lightNormal = cross(pts[1] - pts[0], pts[3] - pts[0]);\n  bool behind = (dot(dir, lightNormal) < 0.0);\n\n  for (int i = 0; i < 4; i++) L[i] = normalize(L[i]);\n  vec3 vsum = vec3(0.0);\n  vsum += integrateEdgeVec(L[0], L[1]);\n  vsum += integrateEdgeVec(L[1], L[2]);\n  vsum += integrateEdgeVec(L[2], L[3]);\n  vsum += integrateEdgeVec(L[3], L[0]);\n\n  float len = length(vsum);\n  float z = vsum.z / max(len, 1e-5);\n  if (behind) z = -z;\n  float ff = clamp(0.5 * (z + 1.0), 0.0, 1.0);\n  return max(0.0, len * ff * ff);\n}\n\nmat3 approxLtcInvM(float rough, float ndv) {\n  float r = clamp(rough, 0.05, 1.0);\n  float a = 1.0 / max(r * r, 0.012);\n  float skew = (1.0 - ndv) * (1.0 - r) * 1.15;\n  return mat3(\n    a, 0.0, 0.0,\n    0.0, a, 0.0,\n    -skew * a * 0.55, 0.0, 1.0\n  );\n}\n\nvec3 aces(vec3 x) {\n  x = max(x, 0.0);\n  return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;\n  vec3 ro = vec3(0.0, 0.52, 3.1);\n  vec3 rd = normalize(vec3(uv.x, uv.y - 0.08, -1.55));\n\n  float ang = 0.55 * sin(iTime * 0.55);\n  float tilt = 0.22;\n  if (iMouse.z > 0.5 || length(iMouse.xy) > 1.0) {\n    vec2 m = iMouse.xy / iResolution.xy * 2.0 - 1.0;\n    ang = m.x * 1.2;\n    tilt = clamp(m.y * 0.5 + 0.2, -0.3, 0.7);\n  }\n  float hw = max(LIGHT_WIDTH, 0.15) * 0.5;\n  float hh = max(LIGHT_HEIGHT, 0.15) * 0.5;\n  vec3 lCenter = vec3(sin(ang) * 1.25, 0.85 + tilt * 0.45, -1.35 + cos(ang) * 0.35);\n  vec3 lRight = normalize(vec3(cos(ang), 0.0, -sin(ang)));\n  vec3 lUp = normalize(cross(normalize(-lCenter), lRight));\n  vec3 lFwd = normalize(cross(lRight, lUp));\n\n  vec3 pts[4];\n  pts[0] = lCenter - lRight * hw - lUp * hh;\n  pts[1] = lCenter + lRight * hw - lUp * hh;\n  pts[2] = lCenter + lRight * hw + lUp * hh;\n  pts[3] = lCenter - lRight * hw + lUp * hh;\n\n  float tBest = 1e5;\n  int hitId = 0;\n  vec3 hitP = vec3(0.0), hitN = vec3(0.0);\n\n  // Floor y = -0.6\n  if (rd.y < -1e-4) {\n    float tf = (-0.6 - ro.y) / rd.y;\n    if (tf > 0.0 && tf < tBest) { tBest = tf; hitId = 1; hitP = ro + rd * tf; hitN = vec3(0.0, 1.0, 0.0); }\n  }\n  // Center sphere\n  vec3 sc = vec3(0.0, -0.05, 0.15);\n  float sr = 0.55;\n  vec3 oc = ro - sc;\n  float b = dot(oc, rd), c = dot(oc, oc) - sr * sr, h = b * b - c;\n  if (h > 0.0) {\n    float ts = -b - sqrt(h);\n    if (ts > 0.0 && ts < tBest) { tBest = ts; hitId = 2; hitP = ro + rd * ts; hitN = normalize(hitP - sc); }\n  }\n  // Area light quad\n  float denom = dot(rd, lFwd);\n  if (abs(denom) > 1e-4) {\n    float tl = dot(lCenter - ro, lFwd) / denom;\n    if (tl > 0.0 && tl < tBest) {\n      vec3 lp = ro + rd * tl - lCenter;\n      if (abs(dot(lp, lRight)) <= hw && abs(dot(lp, lUp)) <= hh) {\n        tBest = tl; hitId = 3; hitP = ro + rd * tl;\n      }\n    }\n  }\n\n  vec3 col = mix(vec3(0.025, 0.03, 0.045), vec3(0.08, 0.1, 0.14), clamp(uv.y + 0.5, 0.0, 1.0));\n  vec3 lightCol = vec3(1.0, 0.86, 0.68) * max(INTENSITY, 0.05);\n\n  if (hitId == 3) {\n    col = lightCol * 1.4;\n  } else if (hitId > 0) {\n    vec3 V = -rd;\n    float ndv = max(dot(hitN, V), 0.02);\n    float rough = hitId == 1 ? clamp(ROUGHNESS, 0.06, 0.98) : clamp(ROUGHNESS * 0.72, 0.05, 0.95);\n    vec2 tile = floor(hitP.xz * 1.5);\n    float chk = mod(tile.x + tile.y, 2.0);\n    vec3 albedo = hitId == 1 ? mix(vec3(0.14, 0.16, 0.19), vec3(0.24, 0.26, 0.30), chk) : vec3(0.76, 0.42, 0.24);\n    float metal = hitId == 2 ? 0.55 : 0.12;\n    vec3 F0 = mix(vec3(0.04), albedo, metal);\n    vec3 F = F0 + (1.0 - F0) * pow(1.0 - ndv, 5.0);\n\n    float diffIrr = ltcEvaluate(hitN, V, hitP, mat3(1.0), pts);\n    float specIrr = ltcEvaluate(hitN, V, hitP, approxLtcInvM(rough, ndv), pts);\n    // Analytic sphere occlusion approximation on floor\n    float occ = 1.0;\n    if (hitId == 1) {\n      vec3 toS = sc - hitP;\n      float d = length(toS);\n      float cosA = dot(toS / d, normalize(lCenter - hitP));\n      occ = mix(1.0, 0.28, smoothstep(0.6, 0.95, cosA) * smoothstep(2.2, 0.55, d));\n    }\n    vec3 diff = (1.0 - metal) * (1.0 - F) * albedo * diffIrr * 0.42;\n    vec3 spec = F * specIrr * mix(1.6, 0.35, rough);\n    col = (diff + spec) * lightCol * occ + albedo * vec3(0.03, 0.04, 0.065);\n  }\n  fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);\n}",
   "execution_fidelity": "conceptual-diagram",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-30",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "ltc-area-lights",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T16:15:34.232Z",
     "renderer": "Chromium 145.0.7632.6 headless, WebGL2 via ANGLE/SwiftShader, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.2929,
      "std": 0.2712,
      "unique_colors": 122
     },
     "image": "/specimens/ltc-area-lights-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "split-sum-ibl",
  "restir-di",
  "light-bvh-many-lights",
  "path-tracing"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "split-sum-ibl",
   "why": "LTC lights the surface from local area emitters while the split-sum term adds the distant environment."
  }
 ],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/gi/ltc-area-lights.json"
 },
 "solves": [
  "rectangular light sources look like point lights",
  "need soft specular highlights from large lights",
  "fluorescent panel reflections in real time",
  "area light shading without sampling noise"
 ],
 "authority": "Heitz et al., 2016",
 "url": "https://texelatlas.vercel.app/t/ltc-area-lights/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 8.43,
  "tier": "moderate",
  "p50_ms": 0.2775,
  "p95_ms": 0.2867,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "ltc-area-lights-live",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 6.62,
   "tier": "moderate",
   "p50_ms": 0.1053,
   "p95_ms": 0.1054,
   "speedup_x": 2.64,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 5.31,
   "tier": "light",
   "p50_ms": 0.153,
   "p95_ms": 0.1531,
   "speedup_x": 1.81,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}