Linearly Transformed Cosines for Area Lights
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.
Also known as LTC
In the family Light transport & global illumination, analytic direct lighting
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | Built in | new THREE.RectAreaLight(color, intensity, w, h); RectAreaLightUniformsLib.init() on WebGLRenderer docs |
| Babylon.js 9.38.0 | Built in | new BABYLON.RectAreaLight('l', position, width, height, scene) docs |
| Godot 4.7 | Built in | Add an AreaLight3D node docs Forward+ full support; limited on Mobile and Compatibility. |
| Unity | Built in | Light > Shape = Rectangle / Tube / Disc (HDRP area lights) docs HDRP area lights are shaded with LTC tables. URP has no real-time area lights. |
| Unreal 5.7 | Built in | Place Actors > Lights > Rect Light (RectLightComponent rectangular area lights) docs |
| Blender 5.2 | Built in | EEVEE Area Light analytic lighting via Linearly Transformed Cosines docs |
| WebGPU W3C | None found | |
| Metal | None found |
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.
So 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.
Diffuse 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 choose it
Reach for it when
- 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
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.
Prefer ReSTIR DI: Spatiotemporal Reservoir Resampling for Direct Lighting or sampling with Light BVH and Adaptive Tree Splitting when many emitters or shadowing must be handled, since LTC gives unshadowed lighting. Prefer Split-Sum Image-Based Lighting for distant environment lighting. Prefer Unidirectional Path Tracing offline for accurate shadows and multi-bounce.
Field marks
- 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
Presets
Analytic LTC polygonal quad area light — noise-free GGX specular and cosine diffuse
{
"ROUGHNESS": 0.28,
"LIGHT_WIDTH": 1.4,
"LIGHT_HEIGHT": 0.85,
"INTENSITY": 3.2
}Show GLSL (143 lines)
const float ROUGHNESS = 0.28; // P
const float LIGHT_WIDTH = 1.4; // P
const float LIGHT_HEIGHT = 0.85; // P
const float INTENSITY = 3.2; // P
vec3 integrateEdgeVec(vec3 v1, vec3 v2) {
float x = clamp(dot(v1, v2), -0.9999, 0.9999);
float y = abs(x);
float a = 0.8543985 + (0.4965155 + 0.0145206 * y) * y;
float b = 3.4175940 + (4.1616724 + y) * y;
float v = a / b;
float theta_sintheta = (x > 0.0) ? v : 0.5 * inversesqrt(max(1.0 - x * x, 1e-6)) - v;
return cross(v1, v2) * theta_sintheta;
}
float ltcEvaluate(vec3 N, vec3 V, vec3 P, mat3 invM, vec3 pts[4]) {
vec3 T1 = normalize(V - N * dot(V, N));
vec3 T2 = cross(N, T1);
mat3 basis = invM * transpose(mat3(T1, T2, N));
vec3 L[4];
for (int i = 0; i < 4; i++) L[i] = basis * (pts[i] - P);
vec3 dir = pts[0] - P;
vec3 lightNormal = cross(pts[1] - pts[0], pts[3] - pts[0]);
bool behind = (dot(dir, lightNormal) < 0.0);
for (int i = 0; i < 4; i++) L[i] = normalize(L[i]);
vec3 vsum = vec3(0.0);
vsum += integrateEdgeVec(L[0], L[1]);
vsum += integrateEdgeVec(L[1], L[2]);
vsum += integrateEdgeVec(L[2], L[3]);
vsum += integrateEdgeVec(L[3], L[0]);
float len = length(vsum);
float z = vsum.z / max(len, 1e-5);
if (behind) z = -z;
float ff = clamp(0.5 * (z + 1.0), 0.0, 1.0);
return max(0.0, len * ff * ff);
}
mat3 approxLtcInvM(float rough, float ndv) {
float r = clamp(rough, 0.05, 1.0);
float a = 1.0 / max(r * r, 0.012);
float skew = (1.0 - ndv) * (1.0 - r) * 1.15;
return mat3(
a, 0.0, 0.0,
0.0, a, 0.0,
-skew * a * 0.55, 0.0, 1.0
);
}
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;
vec3 ro = vec3(0.0, 0.52, 3.1);
vec3 rd = normalize(vec3(uv.x, uv.y - 0.08, -1.55));
float ang = 0.55 * sin(iTime * 0.55);
float tilt = 0.22;
if (iMouse.z > 0.5 || length(iMouse.xy) > 1.0) {
vec2 m = iMouse.xy / iResolution.xy * 2.0 - 1.0;
ang = m.x * 1.2;
tilt = clamp(m.y * 0.5 + 0.2, -0.3, 0.7);
}
float hw = max(LIGHT_WIDTH, 0.15) * 0.5;
float hh = max(LIGHT_HEIGHT, 0.15) * 0.5;
vec3 lCenter = vec3(sin(ang) * 1.25, 0.85 + tilt * 0.45, -1.35 + cos(ang) * 0.35);
vec3 lRight = normalize(vec3(cos(ang), 0.0, -sin(ang)));
vec3 lUp = normalize(cross(normalize(-lCenter), lRight));
vec3 lFwd = normalize(cross(lRight, lUp));
vec3 pts[4];
pts[0] = lCenter - lRight * hw - lUp * hh;
pts[1] = lCenter + lRight * hw - lUp * hh;
pts[2] = lCenter + lRight * hw + lUp * hh;
pts[3] = lCenter - lRight * hw + lUp * hh;
float tBest = 1e5;
int hitId = 0;
vec3 hitP = vec3(0.0), hitN = vec3(0.0);
// Floor y = -0.6
if (rd.y < -1e-4) {
float tf = (-0.6 - ro.y) / rd.y;
if (tf > 0.0 && tf < tBest) { tBest = tf; hitId = 1; hitP = ro + rd * tf; hitN = vec3(0.0, 1.0, 0.0); }
}
// Center sphere
vec3 sc = vec3(0.0, -0.05, 0.15);
float sr = 0.55;
vec3 oc = ro - sc;
float b = dot(oc, rd), c = dot(oc, oc) - sr * sr, h = b * b - c;
if (h > 0.0) {
float ts = -b - sqrt(h);
if (ts > 0.0 && ts < tBest) { tBest = ts; hitId = 2; hitP = ro + rd * ts; hitN = normalize(hitP - sc); }
}
// Area light quad
float denom = dot(rd, lFwd);
if (abs(denom) > 1e-4) {
float tl = dot(lCenter - ro, lFwd) / denom;
if (tl > 0.0 && tl < tBest) {
vec3 lp = ro + rd * tl - lCenter;
if (abs(dot(lp, lRight)) <= hw && abs(dot(lp, lUp)) <= hh) {
tBest = tl; hitId = 3; hitP = ro + rd * tl;
}
}
}
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));
vec3 lightCol = vec3(1.0, 0.86, 0.68) * max(INTENSITY, 0.05);
if (hitId == 3) {
col = lightCol * 1.4;
} else if (hitId > 0) {
vec3 V = -rd;
float ndv = max(dot(hitN, V), 0.02);
float rough = hitId == 1 ? clamp(ROUGHNESS, 0.06, 0.98) : clamp(ROUGHNESS * 0.72, 0.05, 0.95);
vec2 tile = floor(hitP.xz * 1.5);
float chk = mod(tile.x + tile.y, 2.0);
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);
float metal = hitId == 2 ? 0.55 : 0.12;
vec3 F0 = mix(vec3(0.04), albedo, metal);
vec3 F = F0 + (1.0 - F0) * pow(1.0 - ndv, 5.0);
float diffIrr = ltcEvaluate(hitN, V, hitP, mat3(1.0), pts);
float specIrr = ltcEvaluate(hitN, V, hitP, approxLtcInvM(rough, ndv), pts);
// Analytic sphere occlusion approximation on floor
float occ = 1.0;
if (hitId == 1) {
vec3 toS = sc - hitP;
float d = length(toS);
float cosA = dot(toS / d, normalize(lCenter - hitP));
occ = mix(1.0, 0.28, smoothstep(0.6, 0.95, cosA) * smoothstep(2.2, 0.55, d));
}
vec3 diff = (1.0 - metal) * (1.0 - F) * albedo * diffIrr * 0.42;
vec3 spec = F * specIrr * mix(1.6, 0.35, rough);
col = (diff + spec) * lightCol * occ + albedo * vec3(0.03, 0.04, 0.065);
}
fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}Attribution: MIT — written for this index
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| ltc-area-lights-live | Tesla T4 1920x1080 | 8.43× baseline (moderate) · 0.278 ms / 0.287 ms | opengl-timer-query · 40 frames · GPU Weight Atlas · Colab T4 sweep |
| ltc-area-lights-live | NVIDIA L4 1920x1080 | 6.62× baseline (moderate) · 0.105 ms / 0.105 ms · 2.6× faster on L4 | opengl-timer-query · Cross-architecture validation |
| ltc-area-lights-live | NVIDIA A100-SXM4-40GB 1920x1080 | 5.31× baseline (light) · 0.153 ms / 0.153 ms · 1.8× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
From the citation graph (Crossref reference lists): cited by Light BVH and Adaptive Tree Splitting.
Crosses
- Split-Sum Image-Based Lighting: LTC lights the surface from local area emitters while the split-sum term adds the distant environment.
Sources
- primaryEric Heitz, Jonathan Dupuy, Stephen Hill, David Neubelt (2016). Real-time polygonal-light shading with linearly transformed cosines. ACM Transactions on Graphics.Verified via crossref · 2026-11-30doi:10.1145/2897824.2925895
- tutorialEric Heitz. Real-Time Polygonal-Light Shading with Linearly Transformed Cosines (project page). eheitzresearch.wordpress.com.Verified via live page · 2026-11-29