joesfer / Voronoi-Shattering

Maya plugin implementing geometry fracturing based on Voronoi Diagrams (Voronoi Shattering). Visit http://www.joesfer.com/?p=60 for further information.
http://www.joesfer.com/?p=60
GNU Lesser General Public License v3.0
42 stars 9 forks source link

Holes in resulting mesh #2

Closed sabotage3d closed 9 years ago

sabotage3d commented 9 years ago

Hello ,

I am having some holes in the resulting mesh. I started debugging but I cannot solve it myself. If we do just mesh cutting specific plane it can give holes. In my test I am making a single cut by one plane as a test. This is my testing code: http://codepad.org/vkuFLQCO The code is just a default cube in Maya. With single cut by the planes below. In Maya the shrinking is set to 0.01;

If I do

plane2.setPlane( 15.0, -5.0, -10.0, -planeDist + shrinkUnits ); 

or

plane2.setPlane( 20.0, -5.0, -10.0, -planeDist + shrinkUnits ); 

This is the resulting mesh:

screen shot 2014-11-16 at 21 41 25 screen shot 2014-11-16 at 21 41 51

Thanks in advance,

Alex

joesfer commented 9 years ago

Hi Alex,

With the mesh cutting, normally the first suspect is the tolerance values used to merge vertices/find whether they're colinear etc. These values are declared at the very top of the Meshcut.cpp file, so you could try tweak them to see if you get a different result. That being said, your test scene is as sane as it gets, so it might not be that (maybe the merge epsilon is a bit too high in hindsight).

On the same file, there's also a debug toggle (set #define DEBUG 1) which will dump intermediate steps as curves in Maya and will give you a better idea of what's going on in your scene.

Hope this helps, Jose

sabotage3d commented 9 years ago

Hi Jose, Thank you very much for your reply. If I output the curves with the debug mode. I am getting good looking curves around the edge although I am not sure why they are so many. I also enabled the debug mode in FillHoles the produced mesh is invisible in maya. This is the output from FillHoles debug:

Vertices:
[0: [-147.499, 11.0743, 0, 1], 
 1: [-55.4505, 11.0743, 0, 1], 
 2: [221.359, 11.0522, 0, 1], 
 3: [147.647, -11.0616, 0, 1], 
 4: [-221.286, -11.0616, 0, 1], 
 5: [-177.043, 2.21106, 0, 1]]

Triangles:

[5, 1, 0]

screen shot 2014-11-17 at 22 28 30

I played with all the constants but it is still failing with holes . If I play with divisions of the cube it changes the result sometimes without holes . Even with more divisions changing the plane to random angles produces holes. In some cases there are multiple triangles on top of each other n the internal faces. I wonder if there are some better constants for simple convex meshes ?

I made some tests with multiple planes.

This is with all the default settings in the plugin

I am calling it with

Shatter(2); setAttr ($shatterNode + ".shrinking") 0.01;

The first one is unit cube 1 division in each axis. The second one is unit cube with 3 divisions in each axis.

screen shot 2014-11-17 at 21 46 51 screen shot 2014-11-17 at 21 48 52

sabotage3d commented 9 years ago

After doing a conversion from plane matrices with angles to normals and offset the holes disappeared it just looks like a bad case scenario.