4 ms·
How would you even do a boolean operation over two distances ?
by msk-lywenn 2y ago
How would you even do a boolean operation over two distances ?
- ChadNauseam 2y agoInigo Quilez (who is basically the CEO of SDFs in my book) has a page on this: https://iquilezles.org/articles/interiordistance/ https://iquilezles.org/articles/interiordistance/. The goal isn't boolean operations over distances themselves, because as you point out that makes no sense. What you often want though is boolean operations over the surfaces the functions are returning the distance to. For example, you have one function that gives the distance to the surface of a sphere, and another that gives the distance to the surface of a cube, and you want to AND them, to get a function that gives you the distance to whichever surface is closer. That explanation probably doesn't make any sense, so just check out the page I linked which has some great visualizations.
- ww520 2y agoIt's important to use the correct names for things. Using the boolean lingo AND/OR/XOR to describe distance function operations just creates confusion. For example in this case, getting the distance to whichever closer surface is not an AND operation. It's a UNION operation, including the surfaces from both objects. Even if using the boolean lingo, it's more like the OR operation, cube OR sphere. It's best to use the set lingo UNION/INTERSECTION/DIFFERENCE.
- msk-lywenn 2y agoThat makes much more sense indeed