What is a non-manifold mesh and how to fix it

02.10.2019 @ Tutorials(Blender, mesh)

In your jour­ney through the world of CGI, you have prob­a­bly come across the word non-man­i­fold once or twice. Maybe you got slapped with a “mesh is non-man­i­fold” error too and won­dered how your mesh became non-some­thing. Surely hav­ing a man­i­fold mesh is bet­ter.

But what does it mean to be man­i­fold?

A man­i­fold is a math­e­mat­i­cal con­cept relat­ed to space. In a man­i­fold space, objects resem­ble euclid­ean space up close even though they might look dif­fer­ent as a whole. For 3D, this means man­i­fold objects look like a plane when seen up close. Take the earth or any large sphere for instance. It looks plain when you are stand­ing on its sur­face, but the object itself is spher­i­cal.

The sec­ond fea­ture of man­i­fold objects is that they are con­tin­u­ous. They wrap with­out any end or begin­ning. Cubes, Spheres, Torus are exam­ples of man­i­fold objects while a plane is an exam­ple of a non-man­i­fold since it’s not con­tin­u­ous. Yep, the good old plane is a non-man­i­fold, who would’ve guessed?

Manifold space can have any num­ber of dimen­sions and it gets weird real fast. But we only care about 3D, so let’s stick to 2‑manifolds. Wait, 2? Remember we use 2D poly­gons to build 3D shapes, there­fore mesh­es are 2‑manifolds.

These con­cepts don’t apply only to com­put­er graph­ics. Our entire uni­verse and every object we will ever hold are 2‑manifolds. Life being 2‑manifold is what allowed tech­niques like UV unwrap­ping to work for CGI. Since we are build­ing 3D shapes from 2D shapes, we can cut them and unfold them into planes in 2D space.

Disclaimer: I’m not a math guy, so I’ve tried to avoid lin­go and keep it focused on 3D. If you are inter­est­ed in the hard­core stuff, check out the Wikipedia page for man­i­fold.

Non-manifolds ruin the fun

Non-man­i­folds com­pli­cate things. For one, they can’t be unwrapped with­out split­ting the mesh. Having islands in the UV Map for con­tin­u­ous geom­e­try is a recipe for a headache.

Boolean oper­a­tions can give you trou­ble too. This has improved by leaps and bounds with Blender 2.80, so it’s not much of a prob­lem any­more. Other soft­ware and algo­rithms may not take non-man­i­folds so kind­ly, though.

On the oth­er hand, Manifold mesh­es are an absolute require­ment for flu­id sim­u­la­tions. They need mesh­es that have a clear sep­a­ra­tion between inside and out­side, which Non-man­i­folds can’t give. Without a con­tin­u­ous sur­face, a mesh can’t encom­pass a closed vol­ume and have an inside.

The biggest issue, and prob­a­bly why you are read­ing this, is 3D print­ing. Remember how our uni­verse is 2‑manifold? Non-man­i­fold geom­e­try can’t exist in real­i­ty. We can’t print float­ing ver­tices or walls with no thick­ness. Even the thinnest piece of paper has some thick­ness. Thickness is also need­ed to have vol­ume, every object we print must have an inter­nal vol­ume. Even “open” objects.

That does­n’t mean non-man­i­folds are always ter­ri­ble, but if you are mod­el­ing for some­thing oth­er than ren­der­ing you will want to fix them.

But I still don’t know what a non-manifold mesh is!

Non-man­i­fold mesh­es aren’t always obvi­ous, but it’s often easy to see that some­thing about the geom­e­try is wrong. The most com­mon prob­lem is an edge con­nect­ed to more or less than two faces.

This also includes inter­nal faces, since one of their edges has to be con­nect­ed to three faces. Edges con­nect­ed to only one face are called Boundary edges and they are also a non-man­i­fold ele­ment. For instance, a plane is a non-man­i­fold with four bound­ary edges.

Separate regions con­nect­ed through a sin­gle ver­tex is what it’s called a bowtie. By regions, I mean mul­ti­ple faces and edges, though two faces alone shar­ing a sin­gle ver­tex can also form a bowtie.

Loose geom­e­try is also non-man­i­fold since it’s not con­tin­u­ous and often does­n’t form a sur­face.

The most obscure prob­lem is nor­mals point­ing in oppo­site direc­tions for adja­cent faces. This breaks the con­tigu­ous rule since one face is sud­den­ly point­ing the oth­er way as if the sur­face was being twist­ed.

Please tell me there’s an automatic fix

Nope. To fix a non-man­i­fold mesh you will have to get your hands dirty. But don’t wor­ry, Blender has your back.

Want to get start­ed right away? Use the select menu in the 3D view. Jump into edit mode and make sure all geom­e­try is des­e­lect­ed first, then go Select > All by Trait > Non-manifold Geometry. You can also select more spe­cif­ic prob­lems with loose geometry and interior faces.

Now that you know where the trou­ble is, you can use Blender’s mod­el­ing tools to per­form surgery on the mesh. You can delete (x) or sep­a­rate (p) loose geom­e­try, fix nor­mals (Ctrl+N) or merge ver­tices (Alt+M). Don’t for­get about Merge By Distance, which can auto-merge ver­tices that are too close. We used to call this Remove Doubles in pre­vi­ous ver­sions.

Interior faces can be delet­ed right away. Faces con­nect­ed to more than three edges and bound­ary edges may take more con­sid­er­a­tion. A quick way to fix bound­aries is to apply a solid­i­fy mod­i­fi­er or extrude inwards to cre­ate a vol­ume.

I also rec­om­mend installing the Mesh Lint addon. Mesh lint lives in the mesh tab of the prop­er­ties edi­tor high­light­ing all kinds of prob­lems. It even updates in real­time while you work! With this addon by your side, you can fix all non-man­i­folds and be sure you are not acci­den­tal­ly caus­ing oth­er issues like +6 poles.

As you can see, fix­ing a non-man­i­fold mesh is easy once you know what is mak­ing it non-man­i­fold. I hope you found this use­ful and are ready to tack­le non-man­i­folds!

All the posts you can read

No comments yet

Leave a Reply

Your email address will not be published.