jes notes Index Gallery . Shaft passers Snap issues

2025-03-07

Last modified: 2025-03-07 12:46:10

< 2025-03-06 2025-03-08 >

SDF Subtraction

The SDF I am using for subtraction does not preserve the distance property. That is why it has the glitch with coplanar faces.

float opSubtraction(float d1, float d2) { return max(d1, -d2); }

Can we do better?

I also think the intersection SDF may be wrong, for the same reason. "Subtraction" is basically intersection of d1 with the negative shape of d2.

OK, https://gamedev.stackexchange.com/a/198701 - the answer is that these boolean operations give a lower bound on the distance, not an exact value for distance.

So we have 3 types of SDF:

To fix the "coplanar faces" glitch with "lower bound on distance", we have to advance a bit further and check that the distance becomes negative. Done, much better now.

I've made it show the "exactness" in the property editor now. But probably this needs to somehow propagate up, so that an "exact" transform with an "isosurface" child is actually an "isosurface" transform.

And how true is it that you can renormalise by dividing by the length of the gradient? Needs some thought.

I'm kind of keen to use the "exactness" of the root node to switch between different rendering modes. Also we could change the number of allowable iterations in the renderer based on the frame rate? So far I haven't run into any scenario where the frame rate is bad, so ignore for now.

< 2025-03-06 2025-03-08 >