Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit098ece8e9e

README.md

ModelGraph

The graph a scene's parts are drawn by. The nouns record a scene's tree; at the end of the build one Generator is spawned on this graph, and the tree is its two plain inputs:

  • objects: the objects of the tree, parents before their children. Each is { name, parent, pose or channel and values, components?, leaves }: parent is the number of its parent object (0 for the first), pose is its position, rotation quaternion and scale as ten numbers (an object that stands still), channel and values name a formula of channels and the constants it puts in it (an object whose pose follows the clock), and each leaf is { shape, material, matrix }: shape is { op, args, ops? }, where op names a g.shape node, args are its inputs and ops are the modifiers applied in order (bevel, subdivide, taper, twist, bend, boolean), material is { color, metallic, roughness, emissive, opacity?, doubleSided? } and matrix places the leaf in its object (row-major 4x4). A shape whose op is loft carries its cross-sections in args.sections.
  • channels: the formulas of the poses that follow the clock, each { nodes, out, width }.

The graph composes the tree into the parts that stay where they are, each an entity with its parent and local pose, and the parts that move, grouped by formula and shape and drawn as instances, one population per group, the formula running on the device every frame. A graph that states a program (g:program) is stood by that program where it takes the tree, and cooked as this graph where it does not.

The graph's clock runs forward and loops. A material is one node per distinct colour, metalness, roughness, emissive, opacity and sidedness, shared by the parts that state it. Opacity below 1 or a double-sided material is made from the pbr shader with a transparent blend.

Modifiers run through procgen's own nodes: geometry.bevel, geometry.subdivide (points joined first), geometry.boolean and geometry.loft; taper, twist and bend are field arithmetic on the point positions.