Docs menu · Procedural modelling basics

Documentation

Procedural modelling basics

The idea

We will build a padded crate covered in amber studs, in eight nodes. Along the way you will use the four moves you need for almost everything in Tessera: generate a shape, modify it, scatter points on it and copy something onto those points.

Conventions: Y is up, 1 unit = 1 metre, the ground is at y = 0.

Build it by hand

  1. Box. Right-click empty graph space, type box, press Enter. Rename it body. Set size to 2 2 2, divisions to 2 2 2 and turn on bottom_at_origin so it sits on the ground. Double-click it to display it.
  2. Extrude. With body selected, add extrude (it is wired to the selected node automatically). Rename it panels. Set distance 0.15, inset 0.12 and turn on individual: each face is pushed out separately with a bevelled border, like padded panels. Extrude writes the groups extrude_front and extrude_side, which you could use later.
  3. Subdivide. Add subdivide after panels, name it smooth, depth 1. Catmull-Clark rounds every panel into a soft cushion. Try depth 2 for smoother, or algorithm linear to add resolution without rounding.
  4. Scatter. Add scatter after smooth, name it spots: count 80, pscale 0.08. It places points on the surface, weighted by area, with a normal N and a scale pscale on each.
  5. Something to copy. Add a sphere named stud (not connected to anything): radius 1, rows 8, cols 16. The radius is 1 because pscale on each point will scale it down to 0.08.
  6. Copy to points. Add copy_to_points named studs. Connect stud to input 0 (what to copy) and spots to input 1 (where). Each copy is oriented along the point normal and scaled by pscale.
  7. Colour. Add color after studs named stud_color, color 0.91 0.64 0.24.
  8. Merge and output. Add merge named all and connect smooth and stud_color into it. Finish with a null named OUT_crate and give it the display flag. Press L to lay out the graph.

The result is about 9,600 points and 9,400 polygons: a padded cube about 2.3 m across with 80 studs.

Make it procedural

Now everything is a dial. Drag the numbers (press in a field and drag sideways):

  • spots.count from 80 to 400, or change spots.seed for a new arrangement.
  • panels.inset and panels.distance to change the cushion shape.
  • body.size to 4 1 2 for a bench; everything downstream follows.
  • Make the studs breathe: set spots.pscale to =0.08 + 0.03*sin(F*0.2) and press Space.
  • Tie the stud size to the crate: =ch("body.size")[0] * 0.04.

Bypass smooth (B) to compare hard panels with cushions. Move the display flag to spots to see the scattered points alone.

The same graph as ops

This is what the AI sends through edit_graph, and what you can POST to /api/ops. A node added with inputs becomes the display node unless you say otherwise.

POST http://127.0.0.1:7419/api/ops
{"ops": [
  {"op":"add","type":"box","name":"body","params":{"size":[2,2,2],"divisions":[2,2,2],"bottom_at_origin":true}},
  {"op":"add","type":"extrude","name":"panels","inputs":["body"],"params":{"distance":0.15,"inset":0.12,"individual":true}},
  {"op":"add","type":"subdivide","name":"smooth","inputs":["panels"],"params":{"depth":1}},
  {"op":"add","type":"scatter","name":"spots","inputs":["smooth"],"params":{"count":80,"pscale":0.08,"seed":1}},
  {"op":"add","type":"sphere","name":"stud","params":{"radius":1,"rows":8,"cols":16}},
  {"op":"add","type":"copy_to_points","name":"studs","inputs":["stud","spots"]},
  {"op":"add","type":"color","name":"stud_color","inputs":["studs"],"params":{"color":[0.91,0.64,0.24]}},
  {"op":"add","type":"merge","name":"all","inputs":["smooth","stud_color"]},
  {"op":"add","type":"null","name":"OUT_crate","inputs":["all"],"display":true},
  {"op":"layout"}
]}

The same graph in Python

With the engine running (the app open, or started by MCP)
from tessera.client import Tessera

t = Tessera()                      # http://127.0.0.1:7419
t.add("box", "body", size=[2, 2, 2], divisions=[2, 2, 2], bottom_at_origin=True)
t.add("extrude", "panels", inputs=["body"], distance=0.15, inset=0.12, individual=True)
t.add("subdivide", "smooth", inputs=["panels"], depth=1)
t.add("scatter", "spots", inputs=["smooth"], count=80, pscale=0.08, seed=1)
t.add("sphere", "stud", radius=1, rows=8, cols=16)
t.add("copy_to_points", "studs", inputs=["stud", "spots"])
t.add("color", "stud_color", inputs=["studs"], color=[0.91, 0.64, 0.24])
t.add("merge", "all", inputs=["smooth", "stud_color"])
t.add("null", "OUT_crate", inputs=["all"])
t.display("OUT_crate")
print(t.cook()["geometry"])
t.render(view="persp", file="crate.png")
t.export("OUT_crate", "C:/temp/crate.glb")

Where to go next

  • Swap the sphere for a rock or tree and scatter on a grid run through mountain: a landscape.
  • Use boolean to cut windows, sweep to run a profile along a curve, attrib_wrangle for anything custom.
  • Browse the node reference by category.