lightmap_bake.computeShader
Bakes a lightmap on the GPU — one thread per lightmap texel. Each thread reads its world position + normal, evaluates the shadowed direct irradiance (every scene light, visibility via a BVH shadow ray), then gathers indirect irradiance by tracing `indirectSamples` cosine-weighted
lightmap_bake
Bakes a lightmap on the GPU — one thread per lightmap texel. Each thread
reads its world position + normal, evaluates the shadowed direct
irradiance (every scene light, visibility via a BVH shadow ray), then
gathers indirect irradiance by tracing indirectSamples cosine-weighted
path chains of up to bounces surface interactions. Every path vertex
contributes its emissive plus its albedo (carried on the triangle
records by compute.buildBvh) times the shadowed direct light there; a
segment that escapes contributes the sky. Direct + indirect accumulate
as RGBA into output (A = coverage).
Bindings (see bindings.yaml): output (read_write), texel_positions,
texel_normals, bvh_nodes, triangles, lights, params — all
array<vec4<f32>>.
Usage: dispatch by identity with compute.dispatch("@builtin::systems.globalIllumination.lightmap_bake", ...) (buffers in bindings order) —
it resolves to the shader's stable guid and auto-compiles on first use (no setup).
Scoped to this part · feeds back into the world's score.