Signed distance fields as a shape tree: CPU evaluation, GLSL / WGSL / HLSL / Metal transpile, marching cubes, SVO and texture fitting.
https://crates.io/crates/alice-sdf โ// momentum
// why it's here
- Active: last commit today
- Built almost entirely by one person
// how to help
// readme
ALICE-SDF
Signed distance functions for Rust. A shape is a tree of primitives, CSG operations, transforms and modifiers. The crate evaluates the tree on the CPU (scalar, SIMD, BVH and JIT evaluators), transpiles it to GLSL, WGSL, HLSL and Metal, and turns it into meshes and file formats.
English | ๆฅๆฌ่ช
The same tree drives every backend, and the CPU evaluators return the same bits as each other on every platform CI tests. That makes the tree usable as the single description of a shape: the shader that renders it, the collider that a physics engine queries, and the mesh that is exported or printed are all computed from it, not from separate approximations.
It is not a mesh modeller or a renderer. The GPU shaders are not bit-exact with the CPU (they agree within a tolerance), the value after some modifiers (twist, bend, displacement and similar) is a bound on the distance rather than the distance itself, and turning a field into a fine mesh costs time and memory that grow with the resolution.