Builtin Library
README.md
sdf.repeat (procNode)
A shape repeated on a lattice by folding the point being read back into one cell, forever or a finite number of times. Because repeat is a Luau keyword, a graph calls it as g.sdf["repeat"](...). A shape is a field of position: nothing is evaluated until something reads it, such as sdf.mesh, sdf.sample or field.substitute.
Inputs
sdf(Sdf): The shape filling one cell of the lattice. It fits inside oneperiod; a shape wider than its cell is cut off by the fold.mode(String, default "infinite"): "infinite" repeats forever and leaves the result unbounded; "finite" repeatscounttimes on each axis and leaves the rest of space empty.period(Vec3, default (1, 0, 0)): The spacing between copies on each axis, in metres. A component of 0 or below switches repetition off for that axis: one positive component gives a row, two a grid, three fill space.count(Vec3, default (3, 1, 1)): How many copies each axis carries, read whenmodeis "finite". Rounded down, at least 1. The run is centred oncenter, leaning toward the positive side when even.center(Vec3, default (0, 0, 0)): Where the lattice's origin cell sits: the copy that is the shape exactly where it was built.
Outputs
sdf(Sdf): the shape, a record offield(the signed distance at each point of space, negative inside) andbounds({ min, max }, the box the shape stays inside).
An infinite repetition has infinite bounds, so contouring one with sdf.mesh needs bounds; a finite one keeps the bounds of its run.
Example
local row = g.sdf["repeat"]({ sdf = g.sdf.sphere({ radius = 0.3 }), mode = "finite", period = vector.create(1, 0, 0), count = vector.create(3, 1, 1) })
local mesh = g.sdf.mesh({ sdf = row, resolution = 32 }).geometry