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.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of wrong way

wrong way

Photo of sdf

sdf

Related news:

News photo

Roku’s autoplay ads on startup are rubbing users the wrong way

News photo

Building a Waitlist (The Wrong Way)

News photo

Offworld 'company towns' are the wrong way to settle the solar system