Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitdd348ac6c3

README.md

growth

Curves that grow from other curves. The result is a single geometry holding every curve, starting curves included. Each point carries:

  • generation: 0 on the starting curves, one more per fork;
  • u: how far along its own curve, 0 to 1.

Because the result is geometry, every curve, point and field op works on it:

  • roughen it with geometry.set_position and a noise field;
  • sweep it into tubes with geometry.sweep;
  • sample it with points.on_curve, for sparks along a crack;
  • read generation through a ramp, so branches thin as they fork.

procgen.searchNodes("", { pack = "growth" }) lists the family and procgen.describeNode("op.<id>") describes any one of them.

Ops

  • curve.branch — branches sprout from each curve, generation after generation. Each curve sends out branches children from along its length. A child turns off its parent by up to angle, is ratio as long, and wanders as it goes. A normal keeps the growth in one plane, the way a crack keeps to the surface it crosses. Use it for cracks, lightning forks, frost and coral.
  • curve.grow — branches reach toward a cloud of attractor points (space colonisation). A node grows a step toward the attractors that pull on it, and an attractor a branch reaches is spent, so the growth fills the cloud's shape. Use it for canopies, root balls and leaf veins.
local impact = g.op.curve.line({ start = { x = -1, y = 0, z = 0 }, finish = { x = 1, y = 0, z = 0 }, segments = 8 })
local cracks = g.op.curve.branch({ curve = impact, generations = 4, branches = 2, angle = 45, wander = 25,
    normal = { x = 0, y = 1, z = 0 } })
local jag = g.op.field.curl({ frequency = 3, amplitude = 0.05 })
local rough = g.op.geometry.set_position({ geometry = cracks, offset = jag })