Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

sdf.box (procNode)

An axis-aligned box with sharp edges and corners, as an exact signed distance field. A shape is a field of position: nothing is evaluated until something reads it, such as sdf.mesh, sdf.sample or field.substitute.

Inputs

  • size (Vec3, default (1, 1, 1)): The box's full width, height and depth; half of each reaches either side of center. Every component takes a value above 0, and a size with any component at or below 0 is refused.
  • center (Vec3, default (0, 0, 0)): Where the box sits.

Outputs

  • sdf (Sdf): the shape, a record of field (the signed distance at each point of space, negative inside) and bounds ({ min, max }, the box the shape stays inside).

The bounds are the box itself.

Example

local shape = g.sdf.box({ size = vector.create(1, 0.5, 2) })
local mesh = g.sdf.mesh({ sdf = shape, resolution = 16 }).geometry