Blender extension for volume meshes


This is a call for Blender science/engineering community people: I’ve been wondering about possibility to use Blender for creating, viewing and editing of volume meshes. That would make Blender a preprocessor for finite volume or finite element analysis (for various kinds of scientific computing and simulations). Blender already has good capabilities for editing surface meshes (vertices, edges and faces), but I wonder how hard it would be to adapt the framework to include also polyhedral cells (volume elements). This involves the concept of “internal” faces, edges and vertices, which are shared by neighboring cells, and “boundary” faces, edges and vertices, which are not. Has anyone already considered or tried this?

I´m not sure what do you mean with volume meshes, but if I´m right what you want could be done with the implementation of OpenVDB, there is some implementation going on made by Tangent Animation, and in theory it will be pushed to master at some point.

I´m not sure how much of the OpenVDB toolset is being implemented anyways, but if you know some developers that could help with this implementation this would be something very welcome by the community, since OpenVBD it´s awesome for some tasks :slight_smile:

Cheers !

Thanks for the reference, but it looks like OpenVDB is using (more or less?) structured grids, which is great if your domain is a hexahedron. Unfortunately this is not the case for irregular shapes, which benefit from unstructured grids. Here is one example. Note: The inside of the volume is meshed (divided into small volume elements using different polyhedron shapes).

I think I understand the idea you propose but I’m not familiar with the details. 3d primitives are traditionally vertex, edge and face, but a 4-vertex volume can be a beneficial data structure to utilise for some types of equations, notably, volume calculations and stress testing etc. Is this the idea you are proposing?

As for the suitability in Blender, since it is something which really only applies to the scientific field of 3d, it would be a difficult argument to make it enabled by default for everyone as it would likely end up confusing a lot of users. That being said, it would be very interesting to have something like this implemented.

Roughly speaking, yes, that’s the idea. Although in addition to tetrahedrons (4-vertex volume elements) I’m thinking about all kinds of polyhedra, cause different simulation programs use those.

Currently, I just wonder if anybody has given a thought to using Blender like this, since Blender is powerful in 3D surface modelling and editing, also for precision modelling and not just free-form organic modelling. There are many many specialized software out there for volume meshing, but they all have their pros and cons, and no single software fits all cases. They tend to have their own 3D-modellers, which are buggy, and often not very powerful. Also, there have been times I have thought that if only I could be able to alter manually that one part of the mesh, then my problems would be solved, and I would not have to make trade-offs to make a volume mesher work right and wait overnight for completely new mesh being generated from scratch.

Certainly this is a niche application area and falls outside of Blender core target of artists, so most likely it would not be included in official source. Instead, it could maybe be a branch (patch set), or a separate add-on. That is, if the modelling framework bends to this task at all. If it doesn’t bend easily, then it’s a no go.

This is my concerns as well. I don’t know that area of the Blender code very well, but it seems like a really cool idea. I think implementing the base structure might not be too hard, but then integrating it with everything else that exists in Blender would be a true nightmare, I think, given that everything is built around the assumption that ‘face’ is the highest-dimensional structure it has to deal with. I think this is difficult even if Blender was perfectly suited to it.

Anyway, I’m looking forward to hearing what others think about this - it seems interesting. Maybe it could be an addon or branch, as you said.

FYI I’m working on import-export add-on for VTK file format for Blender. It currently supports only VTK polydata (polygon surface meshes) in legacy ASCII format, but it’s WIP. I’ve thought about trying to extend it so that it could read VTK unstructured grids (polyhedron volume meshes) into Blender, keep track of cell info, and then export cells back to VTK. Here is the idea how it could work, please feel free to comment:

Unstructured Grids (UG) for Blender

  • Only vertices are imported into Blender mesh object
  • Unstructured grid cell info is kept separately in Python lists
  • Only special operators which keep those lists up to date are supported (besides moving vertices)
  • Import step 1: Generate vertices into an empty mesh object
  • Import step 2: VTK cell types are read into one Python list variable “ugc_types” (integer list)
  • Import step 3: VTK cell vertice indices are read into another Python list variable “ugc_verts” (list of integer lists)
  • Import step 4: Boundary faces (faces that are not shared by two cells) are generated into mesh
  • Import step 5: Edges are generated between connected vertices (to illustrate cell connectivity)
  • Internal faces are not created/visualized
  • Implement operator UG Select Cell (Adds vertices of cell number X into active vertex selection)
  • Implement operator UG Check Status (Checks that mesh object data and unstructured grid data are OK and in sync annd there is no leftovers)
  • Export: vertices with coordinates are exported from mesh object, and ugc_verts and ugc_types as such
  • Saving in Blender format: Convert ugc_types and ugc_verts maybe as Blender text objects, include in .blend file.
  • Modification operations (besides moving of vertices) must be limited to special operators that keep ugc_types and ugc_verts up to date
  • Implement operator UG Extrude (Extrudes new cells from all selected faces)
  • Implement operator UG Face Delete (Deletes all cells attached to selected faces)
  • Implement operator UG Vertex Delete (Deletes all cells attached to selected vertices)
  • Extend operator UG Extrude to initialize ugc_types and ugc_verts if user is starting from scratch in Blender

PS. If you work with VTK pipelines and want to do visualization in Blender, see also this thread on Blenderartists.

Update: I decided to extend the UG description to support OpenFOAM PolyMesh, which is more general than VTK unstructured grid (supports arbitrary polyhedrons, boundary patches, face and cell zones) and now I got a proof-of-concept level add-on to share!