Skip to content

FEZ-Finite-Element-Zurich/Blender_remeshing_guide

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Blender Mesh Cleaning Guide

For FEA (finite elemenet analysis) and also other goals such as animating or 3D printing, it is important to have clean meshes. This guide offers step by step instructions to clean your meshes in the freeware Blender, which can be downloaded here.

This guide was created for Blender 2.9. Other versions might have slightly different settings

Aims of Mesh Cleaning: By cleaning a mesh, we want to make it watertight (e.g. no holes) and manifold. Manifold meshes mean that there are no problems such as faces with 0 area, edges connecting more than 2 faces, several vertices occupying the same position, etc. For finite element analysis, we also want to have the elements of the mesh be fairly uniform in size, and to avoid sharp triangles (angles of < 20 degrees and > 150 degrees). This practical guide will teach you how to create a mesh meeting all of these conditions.


Before we get into the mesh cleaning, here are some useful Blender shortcuts and tips:

Useful Blender hotkeys:

  • H Hide
  • Alt + H Unhide all
  • Shift + H Hide all except selected
  • Alt + dragging MMB (middle mouse button) - switch between orthogonal views top, front, bottom, side, etc
  • Edge loop select: hold alt, select edge with LMB
  • In Edit mode, press 1,2,3 to switch between vertex, edge, and face selections
  • Press tab to switch between object and edit modes
  • For more hotkeys see this list
    • for Blender 2.8 but many hotkeys are still the same
  • W to change selection mode (from box select to circle select to lasso select)
  • In edit mode, it can be really useful to hide specific faces so you can look at internal geometry etc. To do so, select them with the lasso tool and then press H. Use ALT + H to unhide all.
  • Hold down SHIFT to select multiple elements
  • F3 will pull up the search menu, so you can type in the same of any tool to search for it
  • When you press the Delete key, you get several options. If you want to delete all of that selected geometry, select "Delete Vertices" because if only delete edges or faces the vertices will remain. Deleting only Faces or edges can be useful when you are adjusting the mesh.

Some useful shortcuts/tools/settings:

  • Tool option dialogue: Notice that sometimes the dialogue box for a tool won’t show up, or only after you apply the tool? You can fix this by pressing F9 to immediately see the mathematical options (for example if you want to rotate by 90 degrees about the X axis, you can type these values in the dialogue box).
  • You can make your own shortcuts by right clicking on the operation in the menu, and clicking “assign shortcut”
  • Tip: if you rename your object, your mesh will often still have the old mesh. (The object is indicated by the orange upside down triangle in the hierarchy, and the mesh (indicated by the green upside down triangle). To set the name of all meshes to be the same as the object, go to scripting mode and paste the following Python script in the console:

for name, obj in bpy.data.objects.items(): obj.data.name = name

Before starting:

*Make sure you enable the statistics module. Click on this symbol: alt text and then check Statistics. This will let you know how many elements are selected (which is very useful for your mesh checks).


Full Remeshing

Instead of cleaning your mesh (see below) you can just remesh the entire mesh. This is useful but might also cause loss of thin structures, geometry etc. Therefore, if you choose this option, carefully check your model to ensure no features have been smoothed over. In general I have found the voxel remesher to work well.

Voxel Remesher Press F3 to bring up the search bar, then type in "voxel remesh". The voxel remesher will create a new mesh based on the volume of your old mesh, ensuring even vertex spacing (which is really useful for FEA analyses).

Voxel Remesher via Remesh Modifier For a bit more control over the voxel modifier, you can apply it via the remesh modifier. This can be found under the modifier tab under the wrench symbol when the object is highlighted in the object hierarchy. alt text

Note that you need to "apply" any modifiers before exporting this mesh. Applying the modifier means the initial mesh is destroyed and the modifier cannot be adjusted anymore, so make sure the mesh is how you want it before pressing "apply" (under the little downward pointing arrow next to the camera symbold). Before applying the modifier, you can only see the changes in object mode (the mesh in edit mode is only changed once you hit apply).

The voxel remesher gives the option of adjusting the voxel size for the new mesh.

There are also other options in the remesh modifer (block, smooth, and sharp). Octree depth = 12 sometimes works well but in general the voxel remesh produces much better models.


Smoothing Sculpting Tool

The smoothing sculpting tool (in Sculpt mode) can be really useful if you want to locally smoothe an area (for example if there is jagged geometry). There is even an option to mirror the effects, so if your model is symmetrical about the X axis for example, you can select this: alt text and then all of your smoothing that you perform on one side of the model will also be performed on the other side.


Fixing Non-Manifold Meshes

You can check for non-manifold elements in Edit mode under Select > Select by Trait > Non-manifold. This can be done for both ertices and edges. A little window will pop up so you can check the different types of non-manifold issues. Sometimes it helps to move edges or vertices in the problematic areas around, so see if maybe the issue is duplicate vertices or edges in the same spot. This is where the Statistics view option comes in handy - you can see how many elements are non-manifold. When you are done cleaning your mesh should have 0 non-manifold elements.

  • To solve duplicate vertices, you can use the "merge by distance" tool (Mesh > Clean up > Merge by Distance and adjust the values so you only merge those vertices.

  • You can also remove duplicate vertices or edges or faces that are floating with the Mesh > Clean up > Delete Loose option.

  • To remove zero area faces and zero length edges, use Mesh > Clean up > Degenerate Dissolve.

  • If you have any holes in your mesh, you can try the automatic cleanup tool under Mesh > Clean up > Fill holes. You can also manually select the surrounding vertices and then fill the gap by pressing F. If you have a big hole bordered by many edges, see section Manually creating New Faces below. You can also create a new edge between two selected vertices in the same way.

  • Depending on the geometry of your gap, you might also want to fill it using "vertex snapping". Select one vertex and drag it over to the vertex you want to connect it to. Select this option alt text and then in the dropdown menu select what you want it to snap to, in this case vertices. Make sure to merge the vertices after snapping them using the Merge by Distance Tool.

  • If you have floating bits outside of your model (maybe from your segmentation) then you can remove these by clicking on a vertex or face in the main model (the part you want to keep), then Select > Select Linked (or use CNTL L), and then Select > Invert (or use CNTRL I). This will select only the floating elements that are not connected to your main model. You can delete them (Delete > Vertices).


Selective Smoothing of Vertices

The vertex smoothing tool makes the vertices and angles more evenly spaced. Select the vertices of interest and then Vertex > Smooth Vertices. You can adjust the level of smoothing. You can also select the entire model (press A) and then smooth all vertices. If you do the latter, you should check to make sure no fine structures are lost.


Creating new faces and edges to fill large holes

There may be cases where you deleted some vertices (for example if there was a spiky geometry) and have a big hole that you need to fill, rather than a single triangle. Instead of selecting all of the edges in the perimeter one by one to fill the gap, you can select a single edge and then go to Select > Select Loops > Edge Loops. This will select the perimeter. Then press F to fill the gap. You now will have a big, non triangular gap:
alt text

You now have two options - 1) you can Triangulate Faces (Face > Triangulate or CNTRL T) or 2) you can manually position edges.

With option 1), you will likely get sharp triangles:
alt text

You can fix these sometwhat with the "smooth vertices" tool (see above), but the number of triangles is set, so we still don't get super even triangles:
alt text

It is up to you to decide if these are good enough for your model - often they will be, but sometimes you might want to manually create the faces. To do this, fill the hole as above, then use the knife tool to draw edges (enabling the vertex snap option helps with this). Here you can see how I started to draw in the new edges with the knife tool:

alt text

*Sometimes the knife tool might not work well - I think this is when the faces are not planar, so first go to Mesh > Clean up > Make Planar Faces.


Checking for Sharp Triangles and Fixing Them

Thank you to Niccolo Fioritti for helping write the angle selector code

First, make sure your mesh is a tri mesh instead of a quad mesh. To triangulate faces, in Edit mode press A with the select tool active to select all faces, then go to Face > Triangulate Faces

To select angles < 20 or >150, go into object mode, select your object, and then run this script by copying and pasting it into the Python console (in Scripting mode). Then go into edit mode to view the angles. You can then manually move vertices by clicking on them and dragging them around with the move tool. You can also select the problematic vertex and some surrounding vertices and apply the selective vertex smoothing tool (see below). You can also use the vertex smoothing tool on the whole model but ensure that no details are lost (see below).

I usually go through the angles one by one to fix them (either with selective vertex smoothing or manually). If you decide to fix the angles one by one (instead of using the vertex smoothing on the whole model), then it helps to save the results of the script using vertex groups. Vertex groups essentially allow you to save a group of selected vertices (so in this case, once you've fixed on angle, you don't need to rerun the script to select the remaining angles, but can just select the vertex group. The angles you fixed will still be part of the vertex group but it should be easy to see which ones are still problematic (i.e. very sharp triangles). I usually use the vertex group, fix several angles, and after a while re-run the script, and save the selection again as a vertex group to work through the remaining issues.

To create a vertex group, in Edit mode (with the vertices selected by the angle script), go to the vertex properties tab and press the plus icon: alt text

Type in the name for the group (for example "sharp angles"). Then press "assign" to assign the problematic vertices to the vertex group. If you want to update the vertex group (after cleaning some sharp angles), in the vertex group go to select, then remove. Now your vertex group is empty and you can rerun the script and assign the remaining sharp angle vertices to that group.

Keep fixing vertices until the script results in 0 selected vertices (this means no angles are > 150 or < 20 degrees). As mentioned above, make sure the Statistics view is enabled so you can see the number of vertices selected by the script.


After all your mesh adjustments, run the non-manfold checks again to make sure no errors were introduced during your mesh cleaning.

About

preparing meshes for FEA using Blender by Eva Herbst

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published