Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

sdf.round (procNode)

The surface moved outward by a constant, which rounds every convex edge of the shape. 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 being offset.
  • radius (Float, default 0.1): How far the surface moves. Positive is outward (a bigger, rounder solid), negative is inward (a smaller one with its concave corners rounded). A negative value past the shape's thinnest half-width erases it.

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 field is the shape's distance less radius. The bounds grow by radius when it is positive and stay as they are when it is negative.

Example

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