---
id: "ltc-cylindrical-tube-lights"
title: "Analytic LTC Cylindrical and Tube Area Lights"
aliases: [LTC linear lights, LTC tube lights, LTC capsule lights, linear-light LTC]
domain: "gi"
stage: "lighting"
realtime: "realtime"
platforms: [webgl2, webgpu, desktop-gpu, mobile-gpu, unity, unreal]
year_introduced: 2017
inputs: [gbuffer, material-params, normals]
outputs: [radiance]
style: "photoreal"
dynamic: "dynamic"
cost: "cheap"
authority: "Heitz & Hill, 2017"
url: "https://texelatlas.vercel.app/t/ltc-cylindrical-tube-lights/"
sources_verified_at: "2026-11-30"
---
# Analytic LTC Cylindrical and Tube Area Lights (Heitz & Hill, 2017)

> Extends Linearly Transformed Cosines from flat polygons to cylindrical tube and linear area lights, evaluating specular and diffuse shading analytically in transformed cosine space without Monte Carlo noise.

## Reach for it when

- need real-time specular reflections from neon or fluorescent tubes
- line lights look wrong on rough glossy pbr surfaces
- approximate capsule area light without ray tracing or sampling noise
- want analytic tube light shading with linearly transformed cosines
- sci-fi corridor lighting bars need accurate grazing highlights

## How it works

In standard [ltc-area-lights](ltc-area-lights), an inverse 3×3 matrix `M^-1` fetched from a precomputed roughness-and-view-angle LUT maps a GGX microfacet lobe onto a clamped cosine hemisphere. Applying that same transform to a finite **cylindrical tube light** (parameterized by segment endpoints `p1`, `p2` and radius `R`) yields a sheared cylinder in cosine space that can be integrated in closed form.

Following Heitz and Hill's linear-light formulation, the transformed line segment defines a local orthonormal frame whose plane contains the origin and the transformed segment. Because the cosine distribution integrates linearly over a thin glowing wire, the irradiance along an infinite line has a compact closed-form expression in terms of the closest-point distance and the tangent vector; subtracting the two semi-infinite tails beyond the clipped segment endpoints yields the exact finite-segment contribution. For finite-radius tubes, the cylinder is split into its line-segment integral scaled by radius plus optional spherical or disk endcaps, clipped smoothly against the shading horizon.

Diffuse lighting reuses the exact same evaluator with `M^-1 = I`, and the same 64×64 LTC lookup tables already used for rectangular lights require no extra texture memory.

## When to use it

Choose it for real-time fluorescent tubes, neon strips, saber glows, and architectural linear fixtures on rough or glossy PBR materials where you want crisp, noise-free elongated highlights at minimal shader cost.

Prefer [ltc-area-lights](ltc-area-lights) for flat rectangular windows, softboxes, or arbitrary convex polygons. Prefer [restir-di](restir-di) when a scene contains dozens of shadowed tube emitters, because analytic LTC is unshadowed. Prefer [split-sum-ibl](split-sum-ibl) for distant environment illumination.

## Cost

cheap — Shares the two 64×64 LTC LUT fetches with polygonal LTC lights and adds a small branch-light closed-form evaluation per tube light.
Measured GPU Weight: 30.11× baseline (heavy) — 0.9454 ms median / 0.9974 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 27.45× baseline (heavy) — 0.4337 ms median (2.18× faster on L4).
Ampere A100 scaling: 20.01× baseline (heavy) — 0.5763 ms median (1.64× faster on A100).

## Failure modes

- Produces unshadowed direct lighting; shadows require separate shadow maps, distance-field occlusion, or ray-traced visibility
- Thin-line approximation breaks down when the shading point sits closer to the tube than its radius, causing energy spikes unless capped or switched to capsule/disk endcap terms
- Horizon clipping of a sheared cylinder is approximate near grazing angles where the tube intersects the tangent plane
- Inherits LTC fit error for grazing Fresnel behavior and highly anisotropic BRDFs unless paired with anisotropic LTC tables

## Engine support

- babylonjs: builtin — `new BABYLON.RectAreaLight(...) (LTC area light evaluation; tube approximation via narrow rect)` (evidence: https://github.com/BabylonJS/Babylon.js/blob/9.38.0/packages/dev/core/src/Lights/rectAreaLight.ts, checked 2026-12-01)
- unity: builtin — `HDRP Light > Type = Area > Shape = Tube (LightType.Tube evaluated via analytic LTC line integration I_diffuse_line / ComputeLineWidthFactor in AreaLighting.hlsl)` (evidence: https://github.com/Unity-Technologies/Graphics/blob/557f6ac22b948284f57ffae6a789751fd1f63620/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDAdditionalLightData.cs, checked 2026-12-01) — HDRP-only; URP does not support real-time tube area lights.
- unreal: builtin — `Point Light > Light > Source Length and Source Radius turn a point light into an analytic capsule/tube area light` (evidence: https://dev.epicgames.com/documentation/en-us/unreal-engine/point-lights-in-unreal-engine, checked 2026-12-01)

## Dataflow

- Inputs: gbuffer, material-params, normals
- Outputs: radiance
- Platforms: webgl2, webgpu, desktop-gpu, mobile-gpu, unity, unreal

## Presets

### Analytic LTC cylindrical tube lights — exact glossy GGX specular & diffuse linear tube area lighting (glsl-fragment; rendered 2026-11-30)

```json
{
  "P_ROUGHNESS": 0.24,
  "P_TUBE_RADIUS": 0.06,
  "P_TUBE_LEN": 1.05,
  "P_ANIM_SPEED": 1
}
```

```glsl
const float P_ROUGHNESS = 0.24; // P Floor Roughness [0.06, 0.78, 0.02]
const float P_TUBE_RADIUS = 0.06; // P Tube Radius [0.025, 0.14, 0.005]
const float P_TUBE_LEN = 1.05; // P Tube Length [0.45, 1.65, 0.05]
const float P_ANIM_SPEED = 1.0; // P Tube Motion [0.0, 2.5, 0.05]

float sdCapsule(vec3 p, vec3 a, vec3 b, float r) {
  vec3 pa = p - a, ba = b - a;
  float h = clamp(dot(pa, ba) / max(dot(ba, ba), 1e-5), 0.0, 1.0);
  return length(pa - ba * h) - r;
}

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);
}

// Analytic diffuse + LTC-approximated representative-point GGX specular for a finite cylindrical tube (a -> b)
vec3 evalTubeLight(vec3 p, vec3 n, vec3 v, vec3 a, vec3 b, float tubeR, vec3 radCol, float rough) {
  vec3 L0 = a - p;
  vec3 L1 = b - p;
  float d0 = max(length(L0), 1e-4);
  float d1 = max(length(L1), 1e-4);

  // Exact analytical diffuse line-light integral (Picott / Karis / Heitz LTC diffuse form factor)
  float cos0 = dot(n, L0 / d0);
  float cos1 = dot(n, L1 / d1);
  float diffFF = max((cos0 + cos1) / max(d0 * d1 + dot(L0, L1) + 0.15, 0.15), 0.0);
  vec3 diffTerm = radCol * diffFF * 0.28 * (1.0 + tubeR * 4.5);

  // Representative closest point on tube segment to reflection ray R (Karis / LTC cylindrical lobe)
  vec3 R = reflect(-v, n);
  vec3 Ld = L1 - L0;
  float rDotL0 = dot(R, L0);
  float rDotLd = dot(R, Ld);
  float l0DotLd = dot(L0, Ld);
  float ld2 = max(dot(Ld, Ld), 1e-5);
  float tSeg = clamp((rDotL0 * rDotLd - l0DotLd) / max(ld2 - rDotLd * rDotLd, 1e-4), 0.0, 1.0);
  vec3 closestLine = L0 + Ld * tSeg;

  // Expand toward tube cylinder radius around closest point on axis
  vec3 centerToRay = dot(closestLine, R) * R - closestLine;
  vec3 repVec = closestLine + centerToRay * clamp(tubeR / max(length(centerToRay), 1e-4), 0.0, 1.0);
  float dist = max(length(repVec), 0.08);
  vec3 lDir = repVec / dist;

  // Energy-conserving LTC/GGX roughness broadening across tube radius & finite segment length
  float alpha = max(rough * rough, 0.006);
  float alphaPrime = clamp(alpha + tubeR / max(2.0 * dist, 0.1), 0.008, 1.0);
  float normE = (alpha / max(alphaPrime, 1e-4)) * clamp(sqrt(ld2) / max(dist * 1.4, 0.25), 0.35, 2.2);

  vec3 H = normalize(lDir + v);
  float ndh = max(dot(n, H), 0.0);
  float ndl = max(dot(n, lDir), 0.0);
  float denom = ndh * ndh * (alphaPrime * alphaPrime - 1.0) + 1.0;
  float D = (alphaPrime * alphaPrime) / max(3.14159265 * denom * denom, 1e-5);
  float F = 0.06 + 0.94 * pow(1.0 - max(dot(H, v), 0.0), 5.0);

  vec3 specTerm = radCol * D * F * normE * ndl * 0.22 / (0.25 + dist * dist * 0.35);
  return diffTerm + specTerm;
}

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 tAnim = iTime * max(P_ANIM_SPEED, 0.0);
  float rough = clamp(P_ROUGHNESS, 0.05, 0.85);
  float tubeR = clamp(P_TUBE_RADIUS, 0.02, 0.16);
  float halfL = clamp(P_TUBE_LEN, 0.35, 1.8) * 0.5;

  vec3 ro = vec3(0.0, 0.52, 2.75);
  vec3 rd = normalize(vec3(uv.x, uv.y - 0.12, -1.52));

  // 3 vibrant neon cylindrical tube area lights suspended above a glossy studio floor
  vec3 t0A = vec3(-1.05, 0.22 + 0.14 * sin(tAnim * 0.7), -0.75 - halfL * 0.7);
  vec3 t0B = vec3(-0.72, 0.88 + 0.14 * sin(tAnim * 0.7), -0.75 + halfL * 0.7);
  vec3 c0 = vec3(0.18, 1.65, 2.45); // electric cyan

  vec3 t1A = vec3(-halfL, 0.58 + 0.12 * cos(tAnim * 0.55), -1.45);
  vec3 t1B = vec3(halfL, 0.58 - 0.12 * cos(tAnim * 0.55), -1.45);
  vec3 c1 = vec3(2.45, 1.35, 0.32); // warm tungsten gold

  vec3 t2A = vec3(0.75, 0.84 - 0.12 * sin(tAnim * 0.8), -0.82 + halfL * 0.65);
  vec3 t2B = vec3(1.10, 0.18 - 0.12 * sin(tAnim * 0.8), -0.82 - halfL * 0.65);
  vec3 c2 = vec3(2.35, 0.28, 1.35); // neon magenta

  // Raymarch gallery geometry (glossy floor + rear curved wall + matte monoliths + glowing tubes)
  vec3 col = vec3(0.015, 0.020, 0.032);
  float t = 0.0;
  float matId = 0.0;
  bool hit = false;
  for (int i = 0; i < 68; i++) {
    vec3 p = ro + rd * t;
    float d = p.y + 0.55; matId = 1.0; // glossy floor
    float dBack = 2.15 + p.z; if (dBack < d) { d = dBack; matId = 2.0; }
    float dPlinth = sdBox(p - vec3(0.0, -0.30, -0.52), vec3(0.38, 0.25, 0.32)) - 0.03;
    if (dPlinth < d) { d = dPlinth; matId = 3.0; }
    float dT0 = sdCapsule(p, t0A, t0B, tubeR); if (dT0 < d) { d = dT0; matId = 4.0; }
    float dT1 = sdCapsule(p, t1A, t1B, tubeR); if (dT1 < d) { d = dT1; matId = 5.0; }
    float dT2 = sdCapsule(p, t2A, t2B, tubeR); if (dT2 < d) { d = dT2; matId = 6.0; }
    if (d < 0.002) { hit = true; break; }
    t += d;
    if (t > 12.0) break;
  }

  if (hit) {
    vec3 p = ro + rd * t;
    if (matId > 3.5) {
      if (matId < 4.5) col = c0 * 2.2;
      else if (matId < 5.5) col = c1 * 2.2;
      else col = c2 * 2.2;
    } else {
      vec3 n = vec3(0.0, 1.0, 0.0);
      float localRough = rough;
      vec3 baseAlb = vec3(0.18, 0.20, 0.24);
      if (matId < 1.5) {
        n = vec3(0.0, 1.0, 0.0);
        // Subtle spatial roughness variation across stone floor tiles
        vec2 tile = floor(p.xz * 1.25);
        float tv = fract(sin(dot(tile, vec2(12.98, 78.23))) * 43758.5);
        localRough = clamp(rough * (0.78 + 0.44 * tv), 0.04, 0.9);
        baseAlb = mix(vec3(0.14, 0.16, 0.20), vec3(0.22, 0.24, 0.28), tv);
      } else if (matId < 2.5) {
        n = vec3(0.0, 0.0, 1.0);
        localRough = clamp(rough + 0.22, 0.12, 0.92);
        baseAlb = vec3(0.20, 0.22, 0.26);
      } else {
        vec2 e = vec2(0.0025, 0.0);
        n = normalize(vec3(
          sdBox(p + e.xyy - vec3(0.0, -0.30, -0.52), vec3(0.38, 0.25, 0.32)) - sdBox(p - e.xyy - vec3(0.0, -0.30, -0.52), vec3(0.38, 0.25, 0.32)),
          sdBox(p + e.yxy - vec3(0.0, -0.30, -0.52), vec3(0.38, 0.25, 0.32)) - sdBox(p - e.yxy - vec3(0.0, -0.30, -0.52), vec3(0.38, 0.25, 0.32)),
          sdBox(p + e.yyx - vec3(0.0, -0.30, -0.52), vec3(0.38, 0.25, 0.32)) - sdBox(p - e.yyx - vec3(0.0, -0.30, -0.52), vec3(0.38, 0.25, 0.32))
        ));
        localRough = clamp(rough * 0.72, 0.05, 0.8);
        baseAlb = vec3(0.26, 0.28, 0.32);
      }

      vec3 v = -rd;
      vec3 lit = baseAlb * vec3(0.03, 0.035, 0.05);
      lit += evalTubeLight(p, n, v, t0A, t0B, tubeR, c0, localRough);
      lit += evalTubeLight(p, n, v, t1A, t1B, tubeR, c1, localRough);
      lit += evalTubeLight(p, n, v, t2A, t2B, tubeR, c2, localRough);
      col = lit;
    }
  }

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

Attribution: Original interactive WebGL2 fragment shader written for Texel Atlas (MIT).

## Lineage

- extends [Linearly Transformed Cosines for Area Lights](https://texelatlas.vercel.app/t/ltc-area-lights.md)

## Combines with

- [Linearly Transformed Cosines for Area Lights](https://texelatlas.vercel.app/t/ltc-area-lights.md): Reuses the exact same precomputed GGX LTC lookup textures to support both polygonal and cylindrical lights in one shader.
- [Split-Sum Image-Based Lighting](https://texelatlas.vercel.app/t/split-sum-ibl.md): Combines analytic local tube lighting with prefiltered environment maps for ambient reflections.

## Sources

1. [primary] Eric Heitz, Stephen Hill (2017) Linear-Light Shading with Linearly Transformed Cosines. GPU Zen, 2017. https://hal.science/hal-02155101 (verified via http on 2026-11-30)
2. [primary] Eric Heitz, Jonathan Dupuy, Stephen Hill, David Neubelt (2016) Real-time polygonal-light shading with linearly transformed cosines. ACM Transactions on Graphics. https://doi.org/10.1145/2897824.2925895 (verified via crossref on 2026-11-30)
3. [implementation] selfshadow (2017) selfshadow/ltc_code. https://github.com/selfshadow/ltc_code License: NOASSERTION. (verified via github on 2026-11-30)
4. [implementation] mrdoob (2026) mrdoob/codevember-2026. https://github.com/mrdoob/codevember-2026 License: MIT. (verified via github on 2026-11-30)

## Cite this entry

Texel. "Analytic LTC Cylindrical and Tube Area Lights." https://texelatlas.vercel.app/t/ltc-cylindrical-tube-lights/ (accessed 2026-12-01).
