0

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.

Community
  • 1
  • 1
VirtualUser
  • 215
  • 2
  • 9
  • The problem with Marching Cubes is that you will never get corners or edges if they are inside a cell, no matter how good your interpolation is. And things can get unstable if they are not. Take a look at *dual contouring*. DC can preserve sharp features, but you need the derivatives of the field. – Nico Schertler Jul 10 '19 at 00:28
  • But generally I need MC because I need to approximate a lot of real things which are round not sharp. – VirtualUser Jul 10 '19 at 05:38
  • You can also try to refine the cube size adaptively in areas where you deem it necessary. However, it becomes a bit tricky to keep the result consistent. – Nico Schertler Jul 10 '19 at 15:32

0 Answers0