Builtin Library
README.md
procgen.bake
Evaluates one target (an output or a node) of a .procGraph graph and stands
what it makes in the scene as durable content, with no generator: the one-shot
step that turns a graph's result into world content. It then reads the
spawned entities' bounds back to confirm something renderable landed.
By the target's output type:
- Geometry → a
.meshasset + a Model entity referencing it (materialoptionally tints it). - A population (points carrying a
Mesh) → a root entity namedname, standing atposition, holding one live entity per copy (viainstances.spawn), each where it stands relative to the root. - Bundle / Template → a persisted
.bundleinstantiated at its root.
Pass replace to swap an existing entity in place (the bake inherits its
position); position to place the baked root; name to name the asset/entity
(defaults to the graph id). A bake that fails keeps nothing it made: the entities it spawned
and the assets it wrote go with the error. Verification reads the spawned entities' world bounds
back, so a bake that produced nothing renderable reports verified = false.
graphis the graph, by its VFS path or its name, or a graph object.targetis"output:<name>"or"node:<id>"(default: the first declared output, else the value the firstio.outputshows).nameis the base name of the baked asset and entity (default: the graph id).replacenames an existing entity to replace: it is despawned and the bake takes its position unlesspositionis given.positionis a{ x, y, z }world position for the baked root.
verified is false when no baked entity has renderable bounds.
tools.use("procgen", "bake", { graph = "/source/scratch/Box.procGraph", name = "BakedBox", position = { 10, 0, 10 } })
tools.use("procgen", "bake", { graph = "/source/scratch/Box.procGraph", name = "BakedBox2", replace = "BakedBox" })
Part of procgen.toolbox, called as tools.use("procgen", "bake", ...)
(zero procgen bake in the engine shell). Returns { output_type, entities, verified, bounds }.