Builtin Library
README.md
bakeScene
The scene-reading layer the bake stands on. Before any lightmap or probe
field is computed, the bake has to answer one question about the scene as
it currently stands: what is bakeable, and where. This module is that
answer, read the same way by the baking toolbox, by the probe
auto-placement in volumeProbe, and by component code driving a bake of
its own.
What it reads
- Scope —
resolveScopeturns a name, id, entity proxy, an array of those, ornil(the whole scene) into the flat set of entity ids a pass considers. A scope that names nothing raises rather than silently baking the wrong set. - Lights —
gatherSpatialLightscollects the placed lights whose reach defines where indirect light matters. Directional and ambient light is global and carries no position, so it never anchors a volume. - Renderables —
collectStaticfinds the staticModelreceivers a lightmap is baked onto;renderableBoundsbounds everything that renders. Mobility is the axis: static geometry takes lightmaps, movers sample probe volumes.
How it places
clusterLights groups lights by influence overlap (two lights join when
their influence spheres touch, transitively), so two separated rooms yield
two volumes rather than one box spanning the dead space between them.
mergeClustersTo caps the volume count by fusing the nearest clusters, and
gridForBounds sizes each volume's probe grid to a target spacing while
holding a hard total-probe budget — a large volume gets coarser probes
instead of a runaway count.
padBounds, boundsCenterSize, and lightInfluenceBounds are the small
bounds arithmetic the rest builds on.