Taos API Reference
    Preparing search index...

    Module sdf

    The signed-distance-field subsystem: baking an SDF from a mesh into a 3D texture (SdfVolume), the CPU math helpers, and binding an SDF to a particle system for surface spawning, attraction, collision, and sticking. Generic GPU/CPU SDF tooling usable beyond particles — e.g. ray tracing, lighting, and physics queries.

    Classes

    SdfVolume

    A baked signed-distance field stored as a 3D r32float texture plus an AABB transform. Sampled by particle modifiers (sdf_attractor, sdf_collision) and the sdf_surface spawn shape.

    Interfaces

    SdfAabb

    Axis-aligned bounding box used by SDF volumes.

    ClosestPoint
    SdfBakeOptions

    Functions

    computeAabb

    Computes the axis-aligned bounding box of positions (tightly packed vec3 array, 3 floats per vertex), expanded along each axis by padding * axisLength.

    closestPointOnTri

    Closest point on triangle (a,b,c) to query point p, with squared distance.

    bakeSdfCpu

    CPU reference baker. Brute-forces signed distance at each grid cell using closestPointOnTri and the closest triangle's face normal for the sign — same algorithm the WGSL kernel runs, so this is the trusted oracle for tests. Output is row-major (x fastest, then y, then z).