Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitdd348ac6c3

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 .mesh asset + a Model entity referencing it (material optionally tints it).
  • A population (points carrying a Mesh) → a root entity named name, standing at position, holding one live entity per copy (via instances.spawn), each where it stands relative to the root.
  • Bundle / Template → a persisted .bundle instantiated 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.

  • graph is the graph, by its VFS path or its name, or a graph object.
  • target is "output:<name>" or "node:<id>" (default: the first declared output, else the value the first io.output shows).
  • name is the base name of the baked asset and entity (default: the graph id).
  • replace names an existing entity to replace: it is despawned and the bake takes its position unless position is given.
  • position is 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 }.