Skip to content

SDF & Core Engine Types

Status: stub

Full SDF documentation is planned for Phase 2. Spec source: 08_ENGINE.csl.

A Signed Distance Field (SDF) is a function f: Vec3<World> → f32 where the output is the signed distance from the input point to the nearest surface (negative inside, positive outside).

Sigil provides a built-in Sdf type that wraps such a function and is recognized by the compiler for autodiff and composition:

// Built-in SDF primitives
let sphere = Sdf::sphere(center, radius);
let box_ = Sdf::box(min, max);
// SDFs compose with Boolean operations
let shape = sphere.union(box_).subtract(Sdf::sphere(hole_center, 0.1));
// Autodiff gives you the normal for free
let normal = Vec3::normalize((∂shape.eval)(p));

Full documentation in Phase 2.