Wrong values from fast sweeping

174 views
Skip to first unread message

Benjamin

unread,
Nov 30, 2020, 4:54:27 AM11/30/20
to OpenVDB Forum

I have a SDF from a mesh and would like to propagate its distance values to a volume inside the mesh. Until now I used my own fast marching implementation for it. But because it is quite slow, I would like to use the parallel fast sweeping method using the maskSdf function. Unfortunately the generated SDFs contain wrong values not reflecting the distance to the surface inside the volume.


Following is simple example which reproduces the kind of errors I get. I would very appreciate if someone could verify this and could share any ideas if this is a problem inside the fast sweeping algorithm and how it could possibly be fixed.


math::Transform::Ptr xform = math::Transform::createLinearTransform(0.2);

math
::BBox<openvdb::Vec3s> cube(openvdb::Vec3s(0.2, 0.2, 0), openvdb::Vec3s(10.1, 10.1, 10.1));
FloatGrid::Ptr cubeGrid = tools::createLevelSetBox<FloatGrid>(cube, *xform, 2);
   
math
::BBox<openvdb::Vec3i> box(openvdb::Vec3i(0, 0, 4), openvdb::Vec3i(10, 10, 6));
FloatGrid::Ptr boxGrid = tools::createLevelSetBox<FloatGrid>(box, *xform, 1);
BoolGrid::Ptr mask = tools::sdfInteriorMask(*boxGrid, 0);

FloatGrid::Ptr distanceField = tools::maskSdf(*cubeGrid, *mask);
distanceField
= tools::clip(*distanceField, *mask, true);

tools
::deactivate(*distanceField, -8, 0.5);

First I create a SDF of a cube (instead of the mesh SDF) and a box inside of it (see images 1 and 2, image 3 represents the SDF I am trying to achieve).


cube.jpgbox.jpgfield.jpg


Thereafter creating the distance field and clipping it. The last step of deactivating values is only for displaying the result, because the wrong values in this example are around -8 instead of the value around -1 they should have. Image 4 shows a 2D view of the result with the deactivated wrong values. Image 5 shows the result if I am rounding the points of the cube to (0, 0, 0) and (10, 10, 10). This time the SDF looks correct. Image 6 is a 3D view of the erroneous result without the deactivation of the wrong values.


2derror.jpg2d.jpgErrorPers.jpg


I would very appreciate any help to identify the problem and fix it.

Best regards,

Benjamin

Reply all
Reply to author
Forward
0 new messages