{
 "id": "voxel-cone-tracing",
 "title": "Voxel Cone Tracing",
 "aliases": [
  "VXGI",
  "SVOGI",
  "voxel GI"
 ],
 "domain": "gi",
 "subdomain": "voxel-based GI",
 "stage": "lighting",
 "realtime": "realtime",
 "platforms": [
  "desktop-gpu",
  "webgl2",
  "webgpu"
 ],
 "year_introduced": 2011,
 "inputs": [
  "mesh",
  "voxels",
  "gbuffer"
 ],
 "outputs": [
  "radiance"
 ],
 "style": "photoreal",
 "dynamic": "dynamic",
 "summary": "Voxelizes the lit scene into a mip-mapped 3D texture and approximates diffuse and glossy indirect light by marching a handful of wide cones through the mip chain, instead of tracing many thin rays.",
 "how_it_works": "Each frame (or when geometry changes) the scene is **voxelized**: triangles are rasterized into a 3D grid, usually with conservative rasterization, storing albedo, normal and emissive. A light-injection pass computes direct lighting (with shadow maps) for each occupied voxel, giving outgoing radiance plus an anisotropic **opacity** per voxel.\n\nThe grid is mip-mapped, with an **anisotropic** variant storing directional values in each of six faces so that averaging does not blur thin walls into translucent fog. At a shading point, a small set of cones (about five to nine) is traced over the hemisphere. A cone steps along its axis; at distance `d` the radius is `d * tan(half-angle)`, so the sample is taken from the mip level whose voxel size matches the footprint. Radiance is accumulated front-to-back using the sampled opacity, as in volume rendering.\n\nA narrow cone gives specular reflections; a wide cone gives soft occlusion for AO. A few wide cones replace the hundreds of rays of path tracing, trading exactness for stable, noise-free results.",
 "when_to_use": "Choose it for fully dynamic GI and glossy reflections on GPUs without hardware ray tracing, in bounded scenes where a voxel volume around the camera is enough.\n\nPrefer [ddgi](ddgi) when you have ray tracing and want a clean grid of probes and fewer leaks. Prefer [lumen-gi](lumen-gi) for large production scenes with software and hardware ray tracing fallbacks. Prefer [light-propagation-volumes](light-propagation-volumes) for a cheaper, lower quality approximation. Prefer [lightmap-baking](lightmap-baking) when the scene is static and quality matters more than dynamism.",
 "cost": {
  "class": "heavy",
  "notes": "Voxelization and mip generation are the main fixed costs; cone tracing cost scales with the cone count. The original paper reports interactive frame rates on 2011 GPUs for its scenes."
 },
 "failure_modes": [
  "Light leaking and over-darkening through thin walls because voxels average geometry (partially mitigated by anisotropic voxels)",
  "Aliasing and temporal flicker when the camera moves and the voxel grid snaps",
  "Specular reflections are blurry and miss anything outside the voxelized volume",
  "Voxelization cost and memory (hundreds of MB for large volumes) limit scene size, so clipmaps are needed"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1111/j.1467-8659.2011.02063.x",
   "type": "paper",
   "title": "Interactive Indirect Illumination Using Voxel Cone Tracing",
   "authors": [
    "Cyril Crassin",
    "Fabrice Neyret",
    "Miguel Sainz",
    "Simon Green",
    "Elmar Eisemann"
   ],
   "year": 2011,
   "venue": "Computer Graphics Forum",
   "url": "https://doi.org/10.1111/j.1467-8659.2011.02063.x",
   "ids": {
    "doi": "10.1111/j.1467-8659.2011.02063.x"
   },
   "license": null,
   "extra": {
    "csl_type": "journal-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1111/j.1467-8659.2011.02063.x",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1111/j.1467-8659.2011.02063.x",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1111/j.1467-8659.2011.02063.x",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1111/j.1467-8659.2011.02063.x",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1111/j.1467-8659.2011.02063.x",
     "checked_at": "2026-11-30T17:59:51.239Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-30T17:59:51.239Z",
   "title_sim": 1,
   "__bib": "crassin2011interactive"
  }
 ],
 "presets": [
  {
   "id": "voxel-cone-tracing-live",
   "title": "Voxel cone tracing — hierarchical mip-voxel indirect bounce & glossy cone aperture",
   "runtime": "glsl-fragment",
   "params": {
    "P_CONE_APERTURE": 0.55,
    "P_GI_BOUNCE": 1.3,
    "P_VOXEL_RES": 12,
    "P_GLOSSINESS": 0.72
   },
   "basis": "original",
   "license_note": "Original interactive WebGL2 fragment shader written for Texel Atlas (MIT).",
   "code": "const float P_CONE_APERTURE = 0.55; // P Cone Aperture [0.15, 1.1, 0.03]\nconst float P_GI_BOUNCE = 1.3; // P Indirect GI [0.0, 2.5, 0.05]\nconst float P_VOXEL_RES = 12.0; // P Voxel Grid [6.0, 24.0, 1.0]\nconst float P_GLOSSINESS = 0.72; // P Glossy Spec [0.0, 1.4, 0.04]\n\nfloat sdBox(vec3 p, vec3 b) {\n  vec3 q = abs(p) - b;\n  return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0);\n}\n\n// Analytical scene SDF (Cornell room + glossy sphere + matte monolith)\nvec2 mapScene(vec3 p) {\n  vec2 res = vec2(1.0 + p.y, 1.0); // floor\n  float ceilD = 1.0 - p.y; if (ceilD < res.x) res = vec2(ceilD, 1.0);\n  float backD = 1.4 + p.z; if (backD < res.x) res = vec2(backD, 1.0);\n  float leftD = 1.4 + p.x; if (leftD < res.x) res = vec2(leftD, 2.0); // orange-red emitter wall\n  float rightD = 1.4 - p.x; if (rightD < res.x) res = vec2(rightD, 3.0); // cobalt-cyan wall\n\n  float dBox = sdBox(p - vec3(-0.48, -0.45, -0.45), vec3(0.35, 0.55, 0.35));\n  if (dBox < res.x) res = vec2(dBox, 4.0);\n\n  vec3 sPos = vec3(0.45, -0.52 + 0.12 * sin(iTime * 0.9), -0.15);\n  float dSph = length(p - sPos) - 0.38;\n  if (dSph < res.x) res = vec2(dSph, 5.0);\n  return res;\n}\n\nvec3 calcNormal(vec3 p) {\n  vec2 e = vec2(0.0025, 0.0);\n  return normalize(vec3(\n    mapScene(p + e.xyy).x - mapScene(p - e.xyy).x,\n    mapScene(p + e.yxy).x - mapScene(p - e.yxy).x,\n    mapScene(p + e.yyx).x - mapScene(p - e.yyx).x\n  ));\n}\n\n// Sample quantized voxel radiance volume at mip level corresponding to cone diameter\nvec4 sampleVoxelMip(vec3 p, float coneDiameter, float voxRes, vec3 emPos) {\n  float mipScale = max(voxRes / max(1.0, coneDiameter * voxRes * 0.65), 2.0);\n  vec3 vp = (floor(p * mipScale) + 0.5) / mipScale;\n  vec2 h = mapScene(vp);\n  float voxelSize = 1.0 / mipScale;\n  float occ = smoothstep(voxelSize * 0.85, -voxelSize * 0.25, h.x);\n  vec3 rad = vec3(0.0);\n  if (occ > 0.01) {\n    if (h.y < 1.5) rad = vec3(0.42, 0.43, 0.46);\n    else if (h.y < 2.5) rad = vec3(1.45, 0.32, 0.14);\n    else if (h.y < 3.5) rad = vec3(0.14, 0.68, 1.35);\n    else rad = vec3(0.72, 0.72, 0.74);\n    // Modulate voxel radiance by proximity to moving glowing emitter bar\n    float lDist = length(vp - emPos);\n    rad *= (0.45 + 1.85 / (0.35 + lDist * lDist));\n  }\n  // Glowing emissive voxel strip\n  float dEm = length(vp - emPos) - 0.24;\n  float emOcc = smoothstep(voxelSize * 0.9, -voxelSize * 0.2, dEm);\n  if (emOcc > 0.01) {\n    rad = mix(rad, vec3(3.2, 2.4, 1.4), emOcc);\n    occ = max(occ, emOcc);\n  }\n  return vec4(rad, occ);\n}\n\n// Trace a single VCT cone with front-to-back alpha accumulation: c += (1 - a) * c_i; a += (1 - a) * a_i\nvec4 traceCone(vec3 ro, vec3 rd, float aperture, float voxRes, vec3 emPos) {\n  vec3 accum = vec3(0.0);\n  float alpha = 0.0;\n  float t = 0.12;\n  for (int i = 0; i < 8; i++) {\n    float diam = max(0.08, 2.0 * t * aperture);\n    vec4 vox = sampleVoxelMip(ro + rd * t, diam, voxRes, emPos);\n    float a = clamp(vox.a * 0.72, 0.0, 1.0);\n    accum += (1.0 - alpha) * vox.rgb * a;\n    alpha += (1.0 - alpha) * a;\n    if (alpha > 0.94 || t > 3.2) break;\n    t += diam * 0.62;\n  }\n  return vec4(accum, alpha);\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\n  vec3 ro = vec3(0.0, 0.04, 2.38);\n  vec3 rd = normalize(vec3(uv, -1.35));\n\n  float voxRes = clamp(P_VOXEL_RES, 5.0, 28.0);\n  float aperture = clamp(P_CONE_APERTURE, 0.12, 1.2);\n  float giGain = max(P_GI_BOUNCE, 0.0);\n  float gloss = max(P_GLOSSINESS, 0.0);\n\n  vec3 emPos = vec3(0.55 * sin(iTime * 0.65), 0.72, -0.35 + 0.35 * cos(iTime * 0.65));\n\n  float t = 0.0;\n  float matId = 1.0;\n  bool hit = false;\n  for (int i = 0; i < 64; i++) {\n    vec2 h = mapScene(ro + rd * t);\n    if (h.x < 0.002) { matId = h.y; hit = true; break; }\n    t += h.x;\n    if (t > 9.0) break;\n  }\n\n  vec3 col = vec3(0.02);\n  if (hit) {\n    vec3 p = ro + rd * t;\n    vec3 n = calcNormal(p);\n\n    vec3 alb = vec3(0.76, 0.76, 0.78);\n    if (matId > 1.5 && matId < 2.5) alb = vec3(0.88, 0.24, 0.12);\n    else if (matId > 2.5 && matId < 3.5) alb = vec3(0.14, 0.54, 0.88);\n    else if (matId > 4.5) alb = vec3(0.90, 0.92, 0.95);\n\n    // Subtle voxel lattice visualization etched on room walls\n    vec3 vg = abs(fract(p * voxRes * 0.5 - 0.5) - 0.5);\n    float grid = smoothstep(0.055, 0.01, min(min(vg.x, vg.y), vg.z));\n    alb *= (1.0 - 0.12 * grid * step(matId, 3.5));\n\n    // Direct light from moving orb\n    vec3 toL = emPos - p;\n    float lDist = length(toL) + 1e-4;\n    vec3 lDir = toL / lDist;\n    float ndl = max(dot(n, lDir), 0.0);\n    float sh = 1.0;\n    float ts = 0.05;\n    for (int s = 0; s < 16; s++) {\n      float dh = mapScene(p + n * 0.02 + lDir * ts).x;\n      sh = min(sh, clamp(5.0 * dh / ts, 0.0, 1.0));\n      ts += max(dh, 0.06);\n      if (ts > lDist - 0.1) break;\n    }\n    vec3 direct = alb * vec3(2.4, 1.95, 1.45) * ndl * sh / (0.45 + lDist * lDist);\n\n    // Diffuse VCT: 5 wide hemisphere cones (1 normal + 4 tilted)\n    vec3 tanV = normalize(abs(n.y) < 0.9 ? cross(n, vec3(0.0, 1.0, 0.0)) : cross(n, vec3(1.0, 0.0, 0.0)));\n    vec3 bitV = cross(n, tanV);\n    vec4 c0 = traceCone(p + n * 0.06, n, aperture, voxRes, emPos);\n    vec4 c1 = traceCone(p + n * 0.06, normalize(n * 0.65 + tanV * 0.76), aperture, voxRes, emPos);\n    vec4 c2 = traceCone(p + n * 0.06, normalize(n * 0.65 - tanV * 0.76), aperture, voxRes, emPos);\n    vec4 c3 = traceCone(p + n * 0.06, normalize(n * 0.65 + bitV * 0.76), aperture, voxRes, emPos);\n    vec4 c4 = traceCone(p + n * 0.06, normalize(n * 0.65 - bitV * 0.76), aperture, voxRes, emPos);\n\n    vec3 diffGI = (c0.rgb * 0.28 + (c1.rgb + c2.rgb + c3.rgb + c4.rgb) * 0.18) * giGain;\n    float voxAO = 1.0 - 0.55 * (c0.a * 0.28 + (c1.a + c2.a + c3.a + c4.a) * 0.18);\n\n    // Glossy specular VCT cone along reflection vector (tighter aperture on sphere & floor)\n    vec3 rDir = reflect(rd, n);\n    float specAp = (matId > 4.5) ? max(0.09, aperture * 0.25) : max(0.22, aperture * 0.5);\n    vec4 cSpec = traceCone(p + n * 0.06, rDir, specAp, voxRes, emPos);\n    float fres = 0.06 + 0.94 * pow(1.0 - max(dot(n, -rd), 0.0), 5.0);\n    float specAmt = (matId > 4.5) ? (0.45 + 0.55 * fres) : (0.18 * fres);\n\n    col = direct + alb * (diffGI + vec3(0.04, 0.045, 0.055) * voxAO) + cSpec.rgb * specAmt * gloss;\n  }\n\n  // Visible glowing light orb in scene\n  vec3 toEm = emPos - ro;\n  float proj = dot(toEm, rd);\n  if (proj > 0.0 && (!hit || proj < t)) {\n    float dPerp = length(toEm - rd * proj);\n    col += vec3(3.2, 2.3, 1.2) * exp(-dPerp * 14.0);\n    col += vec3(4.0, 3.6, 2.8) * smoothstep(0.11, 0.05, dPerp);\n  }\n\n  fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);\n}",
   "execution_fidelity": "reduced-sandbox",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-30",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "voxel-cone-tracing",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T16:50:13.852Z",
     "renderer": "Chromium 145.0.7632.6 headless, WebGL2 via ANGLE/SwiftShader, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.8439,
      "std": 0.1035,
      "unique_colors": 205
     },
     "image": "/specimens/voxel-cone-tracing-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "lumen-gi",
  "ddgi",
  "light-propagation-volumes",
  "radiance-cascades"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "screen-space-gi",
   "why": "Screen-space gathers fill in the contact-scale detail that voxel resolution misses."
  }
 ],
 "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/voxel-cone-tracing.json"
 },
 "solves": [
  "need dynamic gi and glossy reflections without ray tracing hardware",
  "indirect lighting that updates as lights and objects move",
  "bounce light for fully dynamic scenes on older gpus",
  "few wide samples instead of many noisy rays",
  "diffuse and specular indirect from a voxel scene"
 ],
 "authority": "Crassin et al., 2011",
 "url": "https://texelatlas.vercel.app/t/voxel-cone-tracing/",
 "execution_fidelity": "reduced-sandbox",
 "fidelity_label": "Analytic Sandbox",
 "benchmark_eligible": true,
 "gpu_weight": {
  "weight_x": 119.27,
  "tier": "extreme",
  "p50_ms": 3.9239,
  "p95_ms": 4.0347,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "voxel-cone-tracing-live",
  "execution_fidelity": "reduced-sandbox",
  "fidelity_label": "Analytic Sandbox",
  "benchmark_eligible": true,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 102.53,
   "tier": "extreme",
   "p50_ms": 1.6302,
   "p95_ms": 1.6937,
   "speedup_x": 2.41,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 69.24,
   "tier": "extreme",
   "p50_ms": 1.9942,
   "p95_ms": 1.9963,
   "speedup_x": 1.97,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}