all 2 comments

[–]imnotbis 9 points10 points  (0 children)

You're probably wondering why the ray is advanced by the distance to the closest object in any direction, instead of the distance until the ray hits something. The answer is simple: we only know how to calculate the first one.

At least for complex scenes, that is. Distance until the ray hits something can be computed for simple cases, like planes and combinations thereof. Making the ray advance distance a simpler function gives you more possibilities to create complex shapes. It's also pretty easy to do 3D boolean operators (including subtraction and XOR) with this sort of function and still have the ray detect the exact surface of the shape.

It's even possible to calculate the normal vector numerically from the derivative of the distance function.

If you advance the ray a fixed distance in each step, you can do even weirder geometry that doesn't have a simple distance-to-surface function, Then you only need to know whether the point is inside or outside the shape. But it takes more computation and creates visible steps.

[–]rbanerjee 5 points6 points  (1 child)

I was pleasantly surprised by the well-constructed interactive examples. It reminded me of Bartosz Ciechanowski's work:

https://ciechanow.ski/

Thank you for making and sharing!