I am implementing Marching Cubes Algorithm. Let say that I have 3D image which is similar to that draw picture. When I use MC algorithm I got something like this: effect
Everywhere where angle is ~ 90 degrees MC algorithm approximate that elements too (It follows from interpolating function but I am especially interested in disable approximating everywhere where angle is ~ 90 degrees).
So instead of that, I want something like this (but only where angle ~ 90, everywhere else I expect normal approximation (classic from MC algorithm).
Current interpolating function
I used signed distance function (SDF).
Vector3 interpolate(Vector3 v1, Vector3 v2, float sdf1, float sdf2)
{
float offset;
float d = sdf2-sdf1;
if(fabs(delta) < 1e-5)
{
offset = 0.5;
}else
{
offset = (1e-5 - sdf1)/delta
}
return Vector3(v1+offset*(v2-v1));
}
Possible solution
One of the solutions is to set smaller size for cubes (voxels). But I can't do that due to performance. So I think that the key is interpolating function.