Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

sdf.rounded_box (procNode)

A box whose edges and corners are rounded to a radius, its outer size staying size, as a 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 outer width, height and depth, rounding included.
  • radius (Float, default 0.1): How far back from each edge and corner the rounding starts. Clamped to half the smallest side, where the box has become a capsule or a sphere.
  • 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).

Example

local shape = g.sdf.rounded_box({ size = vector.create(1, 1, 1), radius = 0.2 })
local mesh = g.sdf.mesh({ sdf = shape, resolution = 16 }).geometry