Skip to content

Add fields components (implemented using openvdb) - #5

Open
damienmarchal wants to merge 12 commits into
sofa-framework:masterfrom
CRIStAL-PADR:pr-add-openvdb
Open

damienmarchal wants to merge 12 commits into
sofa-framework:masterfrom
CRIStAL-PADR:pr-add-openvdb

Conversation

@damienmarchal

@damienmarchal damienmarchal commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

OpenVDB is the industry standard to manipulate sparse volumetric grids of scalar and vector field.

The PR:

  • adds a loader component named GridVDBLoader, that loads an openvdb file (can be easily created from blender)
  • adds a container component named SparseGridField, that hold and expose as a ScalarField the content of an openvdb file with getValue(), getGradient() and getHessian
  • adds an engine named SparseGridToGrid, that convert a SparseGridField into a dense one.
  • adds an engine named SparseGridToSurfaceMesh that convert a SparseGridField to a surface mesh using the openvdb function. This component may be seen as redundent (because meshing can be done using FieldToSurfaceMesh to directly mesh a SparseGridField)... but the algorithm implemented in openvdb are adaptive and it is worth evaluating their performance compared to the good old Marching Cube used in FieldToSurfaceMesh.

With the PR it become easy to generates openvdb content with blender and use that in a sofa simulation.
In the following video, a distance field is generated from a mesh, loaded into a SparseGridField. The field is used a input of a ScalarFieldMapping mapping computing the field value at the mechanical points. The 1d distance field value is then used for a collision response using the field as measure of a constraint violation by a StopperLagrangianConstraint.

Vidéos:
Example 1
Example 2

(This PR is based on the #3)

@damienmarchal damienmarchal added pr: new feature Implement a new feature pr: status wip Development in the pull-request is still in progress labels Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: new feature Implement a new feature pr: status wip Development in the pull-request is still in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant