Bevy-Rust-GPU / rust-gpu-sdf

Signed distance field library usable on both CPU and GPU.
Apache License 2.0
12 stars 1 forks source link

SignedDistanceField implementation for unit types #7

Closed Shfty closed 1 year ago

Shfty commented 1 year ago

i.e. Float; if a float literal were to represent a constant distance field, various modifiers could be further generalized to apply SDFs in place of floats (ex. shapes that use p.z - r to cheaply model a Z-axis plane).

Some of Inigo Quilez' examples min against zero, which in this context is equivalent to applying a boolean union with the unit distance field. a.k.a. a distance field that returns 0.0 for every possible input point. a.k.a. a hard-to-imagine imaginary shape whose surface is everywhere.

This seems like an interesting mathematical property, since it effectively makes a shape into an interior-only distance field. Or exterior only, if you instead apply a boolean intersection.

Shfty commented 1 year ago

Done.