Expand description
Ray marching and Signed Distance Field (SDF) rendering utilities.
Provides a CPU-side implementation of common ray marching primitives: SDFs for spheres, boxes, capsules, and tori; boolean CSG operators; smooth blending; ambient occlusion; soft shadows; and a simple renderer that produces depth and normal buffers.
Structs§
- Ambient
Occlusion - Ambient occlusion estimator using SDF step-based sampling.
- BoxSdf
- SDF for an axis-aligned box centred at the origin.
- Capsule
Sdf - SDF for a capsule (cylinder with hemispherical caps).
- Ray
- A ray defined by an origin point and a (normalized) direction vector.
- RayMarch
Renderer - A simple camera/renderer that generates rays and produces image buffers via ray marching.
- RayMarch
Result - Result of a single ray march step.
- Soft
Shadow - Penumbra-aware soft shadow estimator.
- Sphere
Sdf - SDF for a sphere.
- Torus
Sdf - SDF for a torus lying in the XZ plane, centred at the origin.
Traits§
- Sdf
- A Signed Distance Field: maps a 3-D point to the signed distance to the nearest surface (negative inside, positive outside).
Functions§
- ray_
march - Perform sphere-marching along
rayagainst the provided SDF. - sdf_
intersection - SDF intersection: take the maximum of two distances.
- sdf_
smooth_ union - Polynomial smooth union of two SDF values with blend radius
k. - sdf_
subtraction - SDF subtraction: subtract shape B from shape A.
- sdf_
union - SDF union: take the minimum of two distances.
- subsurface_
scattering_ approx - Approximate subsurface scattering transmittance.