9
$\begingroup$

My goal is to simulate a particle system in an animation, convert the particles to a mesh, then apply Boolean modifiers to the result mesh. This usually works. However, the mesh generation occasionally results in non-manifold elements which cause the Boolean modifiers to fail. The question is if there is a way to ensure that meshes generated from meta-elements will be a manifold and not contain non-manifold vertices. An idea solution solves the problems by

  1. explaining how to generate the mesh without non-manifold elements;
  2. explaining how to remove the non-manifold elements using a feature in blender; or
  3. explaining how to use scripts to remove the non-manifold elements.

Manual editing of the mesh is not an option since thousands of meshes will be generated.

Details

Using Blender 2.76, the particle system consists of several thousand particles. The particles are converted to a mesh by a script which runs on each render event. The script creates a metaball for each particle, then converts the metaballs to a mesh. This works fine. However, the resulting mesh occasionally contains non-manifold vertices. The non-manifold vertices can cause Boolean modifiers to fail.

Is there a way to either generate the mesh or modify the mesh to ensure that the all vertices are on the manifold. Manual editing is not an option since thousands of these meshes will be automatically generated in an animation.

Example:

This image shows the particle system during an animation:

particle system

This image shows a rendering of the meshed particle system:

rendered particle system

This image shows the meshed generated from the particle system with non-manifold vertices identified. From the top of the image, 2-vertices are identified as non-manifold.

meshed metaballs with non-manifold elements

To see the issue with the mesh, this a zoomed version to the problem area is highlighted.

zoom into non-manifold elements

An example of a successful Boolean modifier applied to the mesh:

successful Boolean operation on mesh


Update based on comments.

From testing with cubesurfer 0.95cubesurf 0.95 and Blender 2.76, the meshes generated are not always manifold.

Example:

For the same problem, here is the resulting cubesurfer surface.

cubesurfer surface

This is the resulting mesh.

cubesrufer mesh

When selecting for non-manifold vertices, these are the non-manifold vertices and surrounding geometry.

non-manifold vertices

Zooming in, these are the non-manifold vertices up close

zoom of non-manifold vertices

$\endgroup$
  • 1
    $\begingroup$ perhaps a crazy solution (but might work) is to write a script to convert the particle locations per frame into a .pdb, and then send the pdb to PyMOL (a program that creates manifold surfaces by passing a solvent radius (ball radius) and surface quality (triangle density) . then import the resulting surface. PyMOL is pretty fast. github.com/MonZop/BioBlender/blob/master/… $\endgroup$ – zeffii Oct 23 '15 at 10:29
7
$\begingroup$

There is CubeSurfer addon for meshing sph particles. Metaballs in Blender were very slow, but they were optimized recently. It is worth testing which is faster.

I don't know if CubeSurfer guarantees manifold mesh. But I am 99.999% sure that it doesn't. Now 100% sure after your test.

I dealt with similar thing many times (booleaning fluid mesh to have smooth surface where it collides with glass - so it renders nicely).

The solution is to export the fluid mesh in frames where the boolean failes as .obj files, then manually edit those meshes so they are manifold, and substitute them in frames where the boolean failed.

The detection and exporting can be done automatically. Also the substitution if the files are named to indicate which frame they belong.

I don't know any algorithm for blender that can automatically fix a non-manifold mesh to be manifold. It would be quite complex, as it is not an easy task.

There is this paper about it, uses Cutting and Stitching.

The boolean modifier will not fail on every non-manifold mesh, only when the non-manifold piece intersects or is inside the booleaned mesh.

Also putting a smooth modifier before the boolean might cause the boolean to fail less. But it won't fix all the non-manifold problems.

So to solve it you would have to write your own particle mesher that guarantees manifold mesh. Or to hire someone to do it for you, or find a very good soul to do it for free. It's quite a job to do.

Or use a program that can do booleans on non-manifold geometry (which is totally possible, blender just uses open-source library for booleans that is not able to handle non-manifolds) or which can repair non-manifolds. Some programs that could do this are listed here.

Geometric Modeling Based on Polygonal Meshes

...this package provides source code implementing useful repairing algorithms such as Gueziec et al's cut-and-stitch for conversion to manifold (IEEE TVCG 2001)...

Also MeshLab is a nice package worth trying. It can be scripted for automation. With others I have no experience but they might be even better candidates. You just wan't them to be able to process a series of obj's.


Another approach you could take is not to boolean at all, but rather use a volumetric material with very high density with clipping. You just need to figure out the math that clips, depending on the shape you want to clip with. From your pictures looks like you need to cull with 2 planes, the planes face the camera with the local Z axis:

enter image description here

This though produces some wood-like artifacts:

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.