Local-Frame 6-Axis Directional Voxel Sky-Visibility Volumes
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.
Also known as directional voxel AO volume, 6-axis voxel sky visibility, per-building voxel AO volume
In the family Visibility, shadows & ambient occlusion, volumetric ambient occlusion
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | None found | No built-in 6-axis directional voxel sky-visibility AO volume generator or shader. |
| Babylon.js 9.38.0 | None found | |
| Godot 4.7 | None found | |
| Unity | None found | Adaptive Probe Volumes store SH sky occlusion rather than 6-axis directional voxel sky-visibility volumes. |
| Unreal 5.7 | None found | |
| Blender 5.2 | None found | |
| WebGPU W3C | None found | |
| Metal | None found |
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.
First, 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).
Rather 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 choose it
Reach for it when
- 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
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.
Prefer Ground-Truth Ambient Occlusion or Horizon-Based Ambient Occlusion for fine contact creases and dynamic characters. Prefer SDF Ambient Occlusion when the entire scene already has a continuous signed distance field. Prefer Voxel Cone Tracing when dynamic geometry and multi-bounce color bleeding are required.
Field marks
- 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
Presets
Local-Frame 6-Axis Directional Voxel Sky-AO — 6-lobe coarse voxel sky visibility (left) vs trilinear directional sky AO lighting (right)
{
"P_VOXEL_SIZE": 6,
"P_AO_POWER": 1.25,
"P_SUN_ANGLE": 0.55,
"P_SPLIT": 0.48
}Show GLSL (133 lines)
const float P_VOXEL_SIZE = 6.00; // P Voxel Grid Res [3.0, 12.0, 1.0]
const float P_AO_POWER = 1.25; // P Sky AO Strength [0.2, 2.2, 0.05]
const float P_SUN_ANGLE = 0.55; // P Sun Motion [0.0, 1.8, 0.05]
const float P_SPLIT = 0.48; // P 6-Axis Voxels / AO [0.0, 1.0, 0.02]
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);
}
// Deep architectural colonnade with heavy overhanging roof (classic SSAO failure case!)
vec2 mapColonnade(vec3 p) {
float dFloor = p.y + 0.62;
vec2 res = vec2(dFloor, 1.0);
// Heavy overhanging cantilevered roof slab (off-screen sky occluder!)
float dRoof = sdBox(p - vec3(0.0, 0.58, -0.35), vec3(1.15, 0.10, 0.85));
if (dRoof < res.x) res = vec2(dRoof, 2.0);
// Back recessed colonnade wall
float dBack = sdBox(p - vec3(0.0, 0.0, -1.15), vec3(1.20, 0.65, 0.12));
if (dBack < res.x) res = vec2(dBack, 3.0);
// Four square colonnade pillars supporting the overhang
for (int i = 0; i < 4; i++) {
float x = -0.82 + float(i) * 0.546;
float dPil = sdBox(p - vec3(x, -0.02, 0.25), vec3(0.10, 0.60, 0.10));
if (dPil < res.x) res = vec2(dPil, 4.0);
}
// Center recessed sculptural pedestal inside the dark colonnade
float dSph = length(p - vec3(0.0, -0.34, -0.35)) - 0.28;
if (dSph < res.x) res = vec2(dSph, 5.0);
return res;
}
vec3 calcNormal(vec3 p) {
vec2 e = vec2(0.0025, 0.0);
return normalize(vec3(
mapColonnade(p + e.xyy).x - mapColonnade(p - e.xyy).x,
mapColonnade(p + e.yxy).x - mapColonnade(p - e.yxy).x,
mapColonnade(p + e.yyx).x - mapColonnade(p - e.yyx).x
));
}
// Evaluate sky visibility along one of the 6 local-frame cardinal lobes (+X,-X,+Y,-Y,+Z,-Z)
float traceSkyLobe(vec3 p, vec3 dir) {
float vis = 1.0;
float t = 0.08;
for (int i = 0; i < 8; i++) {
float h = mapColonnade(p + dir * t).x;
vis = min(vis, clamp(h / max(t * 0.65, 0.05), 0.0, 1.0));
t += max(h, 0.14);
}
return clamp(vis, 0.05, 1.0);
}
// Compute 6-axis directional sky visibility volume value for position p & normal n
float evalDirectionalVoxelAO(vec3 p, vec3 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));
float visY = (n.y >= 0.0) ? traceSkyLobe(p, vec3(0.0, 1.0, 0.0)) : traceSkyLobe(p, vec3(0.0, -0.25, 0.95));
float visZ = (n.z >= 0.0) ? traceSkyLobe(p, vec3(0.0, 0.35, 1.0)) : traceSkyLobe(p, vec3(0.0, 0.35, -1.0));
vec3 w = n * n;
return w.x * visX + w.y * visY + w.z * visZ;
}
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 screenX = fragCoord.x / max(iResolution.x, 1.0);
float split = clamp(P_SPLIT, 0.0, 1.0);
float vRes = clamp(floor(P_VOXEL_SIZE + 0.5), 3.0, 12.0);
float aoPow = clamp(P_AO_POWER, 0.2, 2.5);
float t = iTime * max(P_SUN_ANGLE, 0.0);
vec3 ro = vec3(0.28 * sin(t * 0.45), 0.06, 2.15);
vec3 rd = normalize(vec3(uv.x, uv.y - 0.04, -1.42));
vec3 sky = mix(vec3(0.68, 0.78, 0.90), vec3(0.18, 0.42, 0.78), smoothstep(-0.1, 0.6, rd.y));
vec3 col = sky;
float dist = 0.05;
vec2 hit = vec2(10.0, 0.0);
for (int i = 0; i < 64; i++) {
vec2 h = mapColonnade(ro + rd * dist);
if (h.x < 0.0025) { hit = vec2(dist, h.y); break; }
dist += h.x;
if (dist > 8.0) break;
}
if (hit.y > 0.5) {
vec3 p = ro + rd * hit.x;
vec3 n = calcNormal(p);
vec3 sunDir = normalize(vec3(0.55 * cos(t * 0.4), 0.42, 0.72));
// Direct sun shadow
float sh = 1.0;
float ts = 0.04;
for (int s = 0; s < 18; s++) {
float ds = mapColonnade(p + sunDir * ts).x;
if (ds < 0.004) { sh = 0.0; break; }
ts += max(ds, 0.04);
if (ts > 3.2) break;
}
vec3 alb = vec3(0.80, 0.76, 0.70);
if (hit.y > 4.5) alb = vec3(0.88, 0.56, 0.28);
else if (hit.y > 2.5 && hit.y < 3.5) alb = vec3(0.74, 0.68, 0.62);
if (screenX < split) {
// Left: Raw quantized local-frame 6-axis voxel sky-visibility volume + directional axis color coding
vec3 vPos = (floor(p * vRes) + 0.5) / vRes;
float voxAO = pow(evalDirectionalVoxelAO(vPos, n), aoPow);
vec3 fracV = abs(fract(p * vRes) - 0.5);
float vEdge = smoothstep(0.055, 0.015, min(min(0.5 - fracV.x, 0.5 - fracV.y), 0.5 - fracV.z));
vec3 axisTint = abs(n) * vec3(0.95, 0.85, 0.98) + vec3(0.25);
col = mix(vec3(0.05, 0.08, 0.14), vec3(0.45, 0.84, 1.0) * axisTint, voxAO);
col = mix(col, vec3(0.95, 0.98, 1.0), vEdge * 0.28);
} else {
// Right: Smooth trilinear 6-axis directional sky AO illuminating deep recesses under the overhanging roof!
float skyVis = pow(evalDirectionalVoxelAO(p + n * 0.03, n), aoPow);
vec3 direct = alb * vec3(1.18, 1.02, 0.84) * max(dot(n, sunDir), 0.0) * sh;
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;
col = direct + skyAmb;
}
}
float sep = smoothstep(0.0035, 0.0008, abs(screenX - split));
col = mix(col, vec3(0.95, 0.98, 1.0), sep);
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 |
|---|---|---|---|
| directional-voxel-sky-ao-volumes-live | Tesla T4 1920x1080 | 71.1× baseline (extreme) · 2.34 ms / 2.47 ms | opengl-timer-query · 32 frames · GPU Weight Atlas · Colab T4 sweep |
| directional-voxel-sky-ao-volumes-live | NVIDIA L4 1920x1080 | 75.4× baseline (extreme) · 1.20 ms / 1.21 ms · 1.9× faster on L4 | opengl-timer-query · Cross-architecture validation |
| directional-voxel-sky-ao-volumes-live | NVIDIA A100-SXM4-40GB 1920x1080 | 46.5× baseline (heavy) · 1.34 ms / 1.36 ms · 1.7× faster on A100 | opengl-timer-query · Cross-architecture validation |
Crosses
- Scalable Production Sky and Atmosphere (Hillaire): Modulates physically based ambient sky irradiance with directional sky visibility so shaded ceilings and colonnades receive realistic skylight falloff.
- Cascaded Shadow Maps: Supplies soft ambient sky occlusion in shadowed recesses where direct sunlight from the shadow map is blocked.
Sources
- primaryLeonxlnx (2026). Leonxlnx/athenaion. A massive ancient Greek world built entirely in code with three.js. Zero assets, made with Claude Code (Opus 5.5)GitHub API · license MIT · 2026-11-30
- secondaryMorgan McGuire (2010). Ambient occlusion volumes. Proceedings of the 2010 ACM SIGGRAPH symposium on Interactive 3D Graphics and Games.Verified via crossref · 2026-11-30doi:10.1145/1730804.1730984
- secondaryCyril Crassin, Fabrice Neyret, Miguel Sainz, Simon Green, Elmar Eisemann (2011). Interactive Indirect Illumination Using Voxel Cone Tracing. Computer Graphics Forum.Verified via crossref · 2026-11-30doi:10.1111/j.1467-8659.2011.02063.x