Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

sdf.sphere (procNode)

A sphere, as an exact signed distance field, negative inside. A shape is a field of position: nothing is evaluated until something reads it, such as sdf.mesh, sdf.sample or field.substitute.

Inputs

  • radius (Float, default 1.0): How far the surface sits from the centre. A radius at or below 0 is refused.
  • center (Vec3, default (0, 0, 0)): Where the sphere 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 cube around the sphere, center plus and minus radius on every axis.

Example

local shape = g.sdf.sphere({ radius = 0.5 })
local mesh = g.sdf.mesh({ sdf = shape, resolution = 16 }).geometry