Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

sdf.plane (procNode)

A half-space bounded by an infinite plane, as a signed distance field: the side the normal points away from is solid. Its bounds are infinite, so it is used to cut a bounded shape (sdf.intersect, sdf.subtract), or contoured with bounds given to sdf.mesh. A shape is a field of position: nothing is evaluated until something reads it, such as sdf.mesh, sdf.sample or field.substitute.

Inputs

  • normal (Vec3, default (0, 1, 0)): Which way is out: the half-space this normal points away from is the solid. Normalized on use; it takes a non-zero vector.
  • offset (Float, default 0.0): How far the plane sits from the origin along normal. Raising it grows the solid.

Outputs

  • sdf (Sdf): the half-space, a record of field (the signed distance, negative on the solid side) and bounds, infinite on every axis.

The distance at a point is dot(P, normalize(normal)) - offset.

Example

-- The lower half of a sphere: the plane keeps what lies below y = 0.
local shape = g.sdf.intersect({ a = g.sdf.sphere({ radius = 1 }), b = g.sdf.plane({ normal = vector.create(0, 1, 0) }) })
local mesh = g.sdf.mesh({ sdf = shape, resolution = 16 }).geometry