feat(gi): staged progressive GI bake with caches and atmospheric haze master
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Thu, 8 Oct 2026 21:08:42 +0000 (00:08 +0300)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Thu, 8 Oct 2026 21:08:42 +0000 (00:08 +0300)
commit1a18bc71793c8567529e6ede138d618abd2c6dbb
tree8fbeb201e1a7cfafebf2e07741cb623928d8b615
parent2e4aebafcb36644663fcd2a0d19bfe1fe1f8f6e3
feat(gi): staged progressive GI bake with caches and atmospheric haze

Restructure the global illumination bake into a four-stage
progressive pipeline: a uniform per-polygon direct preview, a
centroid bounce pass, a coarse per-texel lightmap bake, and a
fine-resolution refine pass that upscales composites and restarts
the solver at final density. New giStage2/3/4Radius config keys
gate each stage to a camera-distance bubble, re-evaluated at every
generation barrier, with idle workers catching up late entrants
against the frozen converged field.

Add LightmapCache and GiCentroidCache LRU stores so world cells
streaming out and back in restore baked lighting instantly; both
are validated against a light signature that now includes the sky
color. Mesh-block triangles gain per-texel lightmaps inside the
stage-3 bubble, resampling the block's photo texture into lightmap
space. Escaped bounce rays now sample the sky dome
(BOUNCE_GAIN x sky x SKY_SCALE, -De3d.gi.skyScale default 0.5).

Rewrite Lightmap onto an orthogonal bounding-rect frame with
aspect-first sizing plus refine()/restoreComposite() support.
Two-sided composite shapes emit a reversed-winding lightmapped
back triangle with its own lightmap.

Add an Atmosphere class implementing exponential distance haze,
folded into the existing per-polygon light multipliers of solid
and textured triangles, with AtmosphereTest coverage. Extend
ViewPanel with a per-instance enableGlobalIllumination overload
and accessor, and record the launch command and working directory
in BugReport.

Surface GI observability in DeveloperToolsPanel via a new
thread-safe Status snapshot (stage, queue progress, coverage,
cache sizes). Update the global illumination and configuration
documentation and drop the two one-off review write-ups.
24 files changed:
Documentation/Configuration/index.org
Documentation/Developer tools/Developer tools.png
Documentation/Global illumination/index.org
Documentation/index.org
Documentation/reviews/2026-09-20-codebase-review/aukio-3d-architecture-review.md [deleted file]
Documentation/reviews/2026-09-20-codebase-review/aukio-3d-perf-review.md [deleted file]
src/main/java/eu/svjatoslav/aukio/e3d/diag/EngineConfig.java
src/main/java/eu/svjatoslav/aukio/e3d/gui/BugReport.java
src/main/java/eu/svjatoslav/aukio/e3d/gui/DeveloperToolsPanel.java
src/main/java/eu/svjatoslav/aukio/e3d/gui/ViewPanel.java
src/main/java/eu/svjatoslav/aukio/e3d/renderer/raster/gi/GiCentroidCache.java [new file with mode: 0644]
src/main/java/eu/svjatoslav/aukio/e3d/renderer/raster/gi/GlobalIllumination.java
src/main/java/eu/svjatoslav/aukio/e3d/renderer/raster/gi/Lightmap.java
src/main/java/eu/svjatoslav/aukio/e3d/renderer/raster/gi/LightmapCache.java [new file with mode: 0644]
src/main/java/eu/svjatoslav/aukio/e3d/renderer/raster/gi/LightmappedTriangle.java
src/main/java/eu/svjatoslav/aukio/e3d/renderer/raster/gi/TriangleBvh.java
src/main/java/eu/svjatoslav/aukio/e3d/renderer/raster/lighting/Atmosphere.java [new file with mode: 0644]
src/main/java/eu/svjatoslav/aukio/e3d/renderer/raster/lighting/LightingManager.java
src/main/java/eu/svjatoslav/aukio/e3d/renderer/raster/shapes/basic/solidpolygon/SolidPolygon.java
src/main/java/eu/svjatoslav/aukio/e3d/renderer/raster/shapes/basic/texturedpolygon/MeshTriangle.java
src/main/java/eu/svjatoslav/aukio/e3d/renderer/raster/shapes/basic/texturedpolygon/TexturedTriangle.java
src/main/java/eu/svjatoslav/aukio/e3d/renderer/raster/shapes/basic/texturedpolygon/TriangleMeshBlock.java
src/main/java/eu/svjatoslav/aukio/e3d/renderer/raster/shapes/composite/LightmappedCompositeShape.java
src/test/java/eu/svjatoslav/aukio/e3d/renderer/raster/lighting/AtmosphereTest.java [new file with mode: 0644]