Get the latest tech news
The Wrong Way to Use a Signed Distance Function (SDF)
Signed distance functions (sdf) are a staple of shader and raytracing code. This article shows a way to abuse sdfs for fun and profit*. *mileage may vary
Sdfs are more commonly associated with raytracing and shaders, and by far the best source to learn about them in that context is Inigo Quilez, of Shadertoy fame: https://iquilezles.org/. The advantage of seeing it this way is that the signed distance function can be easily replaced, and suddenly we’re checking collisions with a box, a torus, or any of the many shapes that have a well-defined sdf, like the list Inigo keeps. In the extreme case, if the particle is moving straight towards the geometry, it might end up directly on the surface, but it will never cross it or go inside.
Or read this on Hacker News