{
 "id": "directional-voxel-sky-ao-volumes",
 "title": "Local-Frame 6-Axis Directional Voxel Sky-Visibility Volumes",
 "aliases": [
  "directional voxel AO volume",
  "6-axis voxel sky visibility",
  "per-building voxel AO volume"
 ],
 "domain": "visibility",
 "subdomain": "volumetric ambient occlusion",
 "stage": "visibility",
 "realtime": "realtime",
 "platforms": [
  "webgl2",
  "webgpu",
  "desktop-gpu",
  "mobile-gpu",
  "cpu"
 ],
 "year_introduced": 2026,
 "inputs": [
  "voxels",
  "normals"
 ],
 "outputs": [
  "visibility-mask",
  "texture"
 ],
 "style": "both",
 "dynamic": "static",
 "summary": "Precomputes sky visibility along six local-frame cardinal lobes (±X, ±Y, ±Z) inside a coarse per-structure voxel grid packed into two RGBA8 3D textures, giving architectural interiors view-independent directional AO with zero screen-space passes.",
 "how_it_works": "Screen-space ambient occlusion fails inside deep architectural recesses, colonnades, and overhangs because off-screen roofs and walls are invisible in the depth buffer. A **local-frame 6-axis directional voxel sky-visibility volume** bakes large-scale occlusion directly around each building or modular structure in its own local coordinate frame.\n\nFirst, simplified proxy primitives (boxes, cylinders, prisms, or implicit predicates) rasterize into a coarse binary occupancy grid enclosing the structure. Only empty voxels within a small band of solid cells need evaluation. From each near-surface voxel, Fibonacci-sphere rays are marched through the voxel grid up to a cutoff distance to test whether they escape to the sky or strike an occluder (with a small floor value to emulate ambient bounce).\n\nRather than collapsing visibility to a single scalar, ray hits are cosine-weighted onto the six axis-aligned directional lobes (`+X`, `-X`, `+Y`, `-Y`, `+Z`, `-Z`) and packed into two compact `RGBA8` 3D textures. At shade time, world positions and normals transform into the structure's local frame, offset slightly along the surface normal (`P + N * cell`) to prevent self-occlusion, and blend the three positive or negative lobe channels matching the normal's sign using squared normal weights.",
 "when_to_use": "Choose it for architectural exteriors and semi-enclosed spaces—temples, porticoes, bridges, and modular buildings—where you want stable, view-independent directional sky occlusion that survives camera cuts and instanced building rotations without UV lightmaps.\n\nPrefer [ground-truth-ambient-occlusion](ground-truth-ambient-occlusion) or [hbao](hbao) for fine contact creases and dynamic characters. Prefer [sdf-ambient-occlusion](sdf-ambient-occlusion) when the entire scene already has a continuous signed distance field. Prefer [voxel-cone-tracing](voxel-cone-tracing) when dynamic geometry and multi-bounce color bleeding are required.",
 "cost": {
  "class": "cheap",
  "notes": "Runtime evaluation is two hardware trilinear 3D texture fetches per shaded fragment; CPU baking a coarse architectural grid takes milliseconds to a fraction of a second."
 },
 "failure_modes": [
  "Coarse voxel cell size misses sub-cell crevices, moldings, and thin brackets unless layered with screen-space AO",
  "Thin walls narrower than one voxel can leak sky visibility across interior and exterior rooms if the normal offset crosses the wall",
  "Static local occupancy does not react to moving doors, dynamic props, or nearby neighboring buildings outside the local volume bounds",
  "Axis-aligned 6-lobe basis smooths out sharp diagonal occlusion openings compared to higher-order spherical harmonics or ray-traced AO"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "gh:leonxlnx/athenaion",
   "type": "code",
   "title": "Leonxlnx/athenaion",
   "description": "A massive ancient Greek world built entirely in code with three.js. Zero assets, made with Claude Code (Opus 5.5)",
   "authors": [
    "Leonxlnx"
   ],
   "year": 2026,
   "venue": "GitHub",
   "url": "https://github.com/Leonxlnx/athenaion",
   "ids": {
    "repo": "Leonxlnx/athenaion"
   },
   "license": "MIT",
   "extra": {
    "stars": 736,
    "stars_checked": "2026-11-30",
    "archived": false,
    "fork": false,
    "pushed_at": "2026-10-17T22:58:02Z",
    "language": "JavaScript",
    "homepage": null,
    "license_name": "MIT License"
   },
   "provenance": {
    "title": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/Leonxlnx/athenaion",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "authors": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/Leonxlnx/athenaion",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "year": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/Leonxlnx/athenaion",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "venue": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/Leonxlnx/athenaion",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "url": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/Leonxlnx/athenaion",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "license": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/Leonxlnx/athenaion",
     "checked_at": "2026-11-30T17:59:51.239Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-30T17:59:51.239Z",
   "title_sim": null,
   "__bib": "leonxlnx2026leonxlnx"
  },
  {
   "role": "secondary",
   "key": "doi:10.1145/1730804.1730984",
   "type": "paper",
   "title": "Ambient occlusion volumes",
   "authors": [
    "Morgan McGuire"
   ],
   "year": 2010,
   "venue": "Proceedings of the 2010 ACM SIGGRAPH symposium on Interactive 3D Graphics and Games",
   "url": "https://doi.org/10.1145/1730804.1730984",
   "ids": {
    "doi": "10.1145/1730804.1730984"
   },
   "license": null,
   "extra": {
    "csl_type": "proceedings-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1730804.1730984",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1730804.1730984",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1730804.1730984",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1730804.1730984",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1730804.1730984",
     "checked_at": "2026-11-30T17:59:51.239Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-30T17:59:51.239Z",
   "title_sim": 1,
   "__bib": "mcguire2010ambient"
  },
  {
   "role": "secondary",
   "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": "directional-voxel-sky-ao-volumes-live",
   "title": "Local-Frame 6-Axis Directional Voxel Sky-AO — 6-lobe coarse voxel sky visibility (left) vs trilinear directional sky AO lighting (right)",
   "runtime": "glsl-fragment",
   "params": {
    "P_VOXEL_SIZE": 6,
    "P_AO_POWER": 1.25,
    "P_SUN_ANGLE": 0.55,
    "P_SPLIT": 0.48
   },
   "basis": "original",
   "license_note": "MIT — written for this index.",
   "code": "const float P_VOXEL_SIZE = 6.00; // P Voxel Grid Res [3.0, 12.0, 1.0]\nconst float P_AO_POWER = 1.25; // P Sky AO Strength [0.2, 2.2, 0.05]\nconst float P_SUN_ANGLE = 0.55; // P Sun Motion [0.0, 1.8, 0.05]\nconst float P_SPLIT = 0.48; // P 6-Axis Voxels / AO [0.0, 1.0, 0.02]\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// Deep architectural colonnade with heavy overhanging roof (classic SSAO failure case!)\nvec2 mapColonnade(vec3 p) {\n  float dFloor = p.y + 0.62;\n  vec2 res = vec2(dFloor, 1.0);\n\n  // Heavy overhanging cantilevered roof slab (off-screen sky occluder!)\n  float dRoof = sdBox(p - vec3(0.0, 0.58, -0.35), vec3(1.15, 0.10, 0.85));\n  if (dRoof < res.x) res = vec2(dRoof, 2.0);\n\n  // Back recessed colonnade wall\n  float dBack = sdBox(p - vec3(0.0, 0.0, -1.15), vec3(1.20, 0.65, 0.12));\n  if (dBack < res.x) res = vec2(dBack, 3.0);\n\n  // Four square colonnade pillars supporting the overhang\n  for (int i = 0; i < 4; i++) {\n    float x = -0.82 + float(i) * 0.546;\n    float dPil = sdBox(p - vec3(x, -0.02, 0.25), vec3(0.10, 0.60, 0.10));\n    if (dPil < res.x) res = vec2(dPil, 4.0);\n  }\n  // Center recessed sculptural pedestal inside the dark colonnade\n  float dSph = length(p - vec3(0.0, -0.34, -0.35)) - 0.28;\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    mapColonnade(p + e.xyy).x - mapColonnade(p - e.xyy).x,\n    mapColonnade(p + e.yxy).x - mapColonnade(p - e.yxy).x,\n    mapColonnade(p + e.yyx).x - mapColonnade(p - e.yyx).x\n  ));\n}\n\n// Evaluate sky visibility along one of the 6 local-frame cardinal lobes (+X,-X,+Y,-Y,+Z,-Z)\nfloat traceSkyLobe(vec3 p, vec3 dir) {\n  float vis = 1.0;\n  float t = 0.08;\n  for (int i = 0; i < 8; i++) {\n    float h = mapColonnade(p + dir * t).x;\n    vis = min(vis, clamp(h / max(t * 0.65, 0.05), 0.0, 1.0));\n    t += max(h, 0.14);\n  }\n  return clamp(vis, 0.05, 1.0);\n}\n\n// Compute 6-axis directional sky visibility volume value for position p & normal n\nfloat evalDirectionalVoxelAO(vec3 p, vec3 n) {\n  float visX = (n.x >= 0.0) ? traceSkyLobe(p, vec3(1.0, 0.35, 0.0)) : traceSkyLobe(p, vec3(-1.0, 0.35, 0.0));\n  float visY = (n.y >= 0.0) ? traceSkyLobe(p, vec3(0.0, 1.0, 0.0)) : traceSkyLobe(p, vec3(0.0, -0.25, 0.95));\n  float visZ = (n.z >= 0.0) ? traceSkyLobe(p, vec3(0.0, 0.35, 1.0)) : traceSkyLobe(p, vec3(0.0, 0.35, -1.0));\n  vec3 w = n * n;\n  return w.x * visX + w.y * visY + w.z * visZ;\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  float screenX = fragCoord.x / max(iResolution.x, 1.0);\n  float split = clamp(P_SPLIT, 0.0, 1.0);\n  float vRes = clamp(floor(P_VOXEL_SIZE + 0.5), 3.0, 12.0);\n  float aoPow = clamp(P_AO_POWER, 0.2, 2.5);\n  float t = iTime * max(P_SUN_ANGLE, 0.0);\n\n  vec3 ro = vec3(0.28 * sin(t * 0.45), 0.06, 2.15);\n  vec3 rd = normalize(vec3(uv.x, uv.y - 0.04, -1.42));\n  vec3 sky = mix(vec3(0.68, 0.78, 0.90), vec3(0.18, 0.42, 0.78), smoothstep(-0.1, 0.6, rd.y));\n  vec3 col = sky;\n\n  float dist = 0.05;\n  vec2 hit = vec2(10.0, 0.0);\n  for (int i = 0; i < 64; i++) {\n    vec2 h = mapColonnade(ro + rd * dist);\n    if (h.x < 0.0025) { hit = vec2(dist, h.y); break; }\n    dist += h.x;\n    if (dist > 8.0) break;\n  }\n\n  if (hit.y > 0.5) {\n    vec3 p = ro + rd * hit.x;\n    vec3 n = calcNormal(p);\n    vec3 sunDir = normalize(vec3(0.55 * cos(t * 0.4), 0.42, 0.72));\n\n    // Direct sun shadow\n    float sh = 1.0;\n    float ts = 0.04;\n    for (int s = 0; s < 18; s++) {\n      float ds = mapColonnade(p + sunDir * ts).x;\n      if (ds < 0.004) { sh = 0.0; break; }\n      ts += max(ds, 0.04);\n      if (ts > 3.2) break;\n    }\n\n    vec3 alb = vec3(0.80, 0.76, 0.70);\n    if (hit.y > 4.5) alb = vec3(0.88, 0.56, 0.28);\n    else if (hit.y > 2.5 && hit.y < 3.5) alb = vec3(0.74, 0.68, 0.62);\n\n    if (screenX < split) {\n      // Left: Raw quantized local-frame 6-axis voxel sky-visibility volume + directional axis color coding\n      vec3 vPos = (floor(p * vRes) + 0.5) / vRes;\n      float voxAO = pow(evalDirectionalVoxelAO(vPos, n), aoPow);\n      vec3 fracV = abs(fract(p * vRes) - 0.5);\n      float vEdge = smoothstep(0.055, 0.015, min(min(0.5 - fracV.x, 0.5 - fracV.y), 0.5 - fracV.z));\n      vec3 axisTint = abs(n) * vec3(0.95, 0.85, 0.98) + vec3(0.25);\n      col = mix(vec3(0.05, 0.08, 0.14), vec3(0.45, 0.84, 1.0) * axisTint, voxAO);\n      col = mix(col, vec3(0.95, 0.98, 1.0), vEdge * 0.28);\n    } else {\n      // Right: Smooth trilinear 6-axis directional sky AO illuminating deep recesses under the overhanging roof!\n      float skyVis = pow(evalDirectionalVoxelAO(p + n * 0.03, n), aoPow);\n      vec3 direct = alb * vec3(1.18, 1.02, 0.84) * max(dot(n, sunDir), 0.0) * sh;\n      vec3 skyAmb = alb * mix(vec3(0.26, 0.36, 0.52), vec3(0.46, 0.68, 0.96), 0.5 + 0.5 * n.y) * skyVis * 0.95;\n      col = direct + skyAmb;\n    }\n  }\n\n  float sep = smoothstep(0.0035, 0.0008, abs(screenX - split));\n  col = mix(col, vec3(0.95, 0.98, 1.0), sep);\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": "directional-voxel-sky-ao-volumes",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T21:07:07.000Z",
     "renderer": "Headless EGL Tesla T4/PCIe/SSE2, OpenGL 3.30 Core, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.5449,
      "std": 0.2762,
      "min": 0.058,
      "max": 0.9014
     },
     "image": "/specimens/directional-voxel-sky-ao-volumes-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "sdf-ambient-occlusion",
  "voxel-cone-tracing",
  "bent-normals",
  "ground-truth-ambient-occlusion",
  "irradiance-volumes",
  "voxel-grid-dda-traversal"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "hillaire-sky-atmosphere",
   "why": "Modulates physically based ambient sky irradiance with directional sky visibility so shaded ceilings and colonnades receive realistic skylight falloff."
  },
  {
   "id": "cascaded-shadow-maps",
   "why": "Supplies soft ambient sky occlusion in shadowed recesses where direct sunlight from the shadow map is blocked."
  }
 ],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-30T17:59:51.239Z",
  "draft": "data/drafts/visibility/directional-voxel-sky-ao-volumes.json"
 },
 "solves": [
  "need soft sky occlusion and bounce tint inside voxel caves",
  "screen space ao misses overhanging arches and off-screen roofs",
  "want directional ambient lighting for destructible voxel worlds",
  "uniform ambient term makes voxel overhangs look flat and ungrounded",
  "cheap prefiltered sky visibility lookup for dynamic block terrain"
 ],
 "authority": "Leonxlnx, 2026",
 "url": "https://texelatlas.vercel.app/t/directional-voxel-sky-ao-volumes/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 71.06,
  "tier": "extreme",
  "p50_ms": 2.3379,
  "p95_ms": 2.4713,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 32,
  "preset_id": "directional-voxel-sky-ao-volumes-live",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 75.4,
   "tier": "extreme",
   "p50_ms": 1.1988,
   "p95_ms": 1.2116,
   "speedup_x": 1.95,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 46.55,
   "tier": "heavy",
   "p50_ms": 1.3407,
   "p95_ms": 1.3583,
   "speedup_x": 1.74,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}