I need to be able to subtract circles/spheres from a SDF (stored as a 2D/3D grid) for a project I'm working on. The algorithm in this project uses a quadtree (just a few copies of the distance field with the resolution doubling for each copy) to lower the number of grid cells that have to be updated when a circle is subtracted. It is currently not optimized at all, but it seems to be faster than updating every cell in the grid in most cases. The difference should be even larger in three dimensions. This should also work for the join/min operator, and for other shapes than circles. Click with your mouse or hold space to subtract circles. Click R to reset. Blue=positive SDF, red=negative SDF. "radius": Radius of the circle to subtract "method" = 0: accelerated method "method" = 1: check every cell (breaks method 0's data structure) "time": the time it took to subtract a circle