diso icon indicating copy to clipboard operation
diso copied to clipboard

Bug: mesh output range is incorrect (values outside of 0,1)

Open JulianKnodt opened this issue 4 months ago • 2 comments

Hi, I found that the values output after mesh normalization are not in the correct range, and there can be values which are slightly outside of the range [0,1], including negative values. Assuming in Neumanifold you normalize all input meshes to the range [0,1], this likely didn't cause problems. For me, I am normalizing meshes to the range [-1, -1] with an extra step of multiplying by 2 then subtracting 1. Since the output is not in the range specified, this causes slight incorrect scaling in the output. Since you never measure chamfer or hausdorff distance in neumanifold, I suspect your results are correct, but it would be much appreciated to fix this.

How I found this was by initializing a grid with random values, then evaluating both DiffMC and DiffDMC on it, all at double precision. Both can return negative values and values above the value specified. This was without deformation.

I suspect this bug is because the grid is padded, which would require shifting the output by 1/resolution and then dividing by (1 + 2/resolution). I haven't checked closely tho.

Further Edit: Because the range output from marching cubes isn't correct initially, when you divide by the resolution it is also not guaranteed to be exactly the same range for the normalized version

JulianKnodt avatar Aug 28 '25 07:08 JulianKnodt

Did you add clamp when turning [-1, 1] to [0, 1]? I am afraid that when the input is slightly outside [0, 1], there might be a problem. Will also check closely about the issue.

SarahWeiii avatar Aug 28 '25 18:08 SarahWeiii

Ah no I didn't add clamp, to resolve this I turned normalization off, then I subtracted ((res-1)/2) and divided by ((res-1)/2), I think the range for the output is likely [-1, Res] instead of [0, Res-1], so centering with that normalization leaves the center at 0.

This version of normalization functions well enough for my case, but now I'm not sure if there is any unused grid cell outside of the range I'm expecting

JulianKnodt avatar Aug 29 '25 01:08 JulianKnodt