Skip to content

Add VDB export for 3D simulation data#53

Draft
QuentinWach wants to merge 4 commits intomainfrom
claude/add-vdb-export-Dofaw
Draft

Add VDB export for 3D simulation data#53
QuentinWach wants to merge 4 commits intomainfrom
claude/add-vdb-export-Dofaw

Conversation

@QuentinWach
Copy link
Copy Markdown
Owner

Add VDBExporter class to export 3D volumetric field data to OpenVDB format (.vdb files) for visualization and animation in Blender and other VFX software.

Features:

  • Export any combination of field components (Ex, Ey, Ez, Hx, Hy, Hz)
  • Configurable export interval (every N simulation steps)
  • Optional normalization to [-1, 1] range for Blender shader compatibility
  • Preserves voxel spacing from simulation resolution
  • Stores metadata (time, step, field name) in VDB files
  • Integrated into Simulation.run() with save_vdb parameter

Usage:
sim.run(save_vdb='vdb_output', vdb_fields=['Ez', 'Hy'], vdb_interval=10)

Add VDBExporter class to export 3D volumetric field data to OpenVDB format
(.vdb files) for visualization and animation in Blender and other VFX software.

Features:
- Export any combination of field components (Ex, Ey, Ez, Hx, Hy, Hz)
- Configurable export interval (every N simulation steps)
- Optional normalization to [-1, 1] range for Blender shader compatibility
- Preserves voxel spacing from simulation resolution
- Stores metadata (time, step, field name) in VDB files
- Integrated into Simulation.run() with save_vdb parameter

Usage:
  sim.run(save_vdb='vdb_output', vdb_fields=['Ez', 'Hy'], vdb_interval=10)
@QuentinWach QuentinWach added the enhancement New feature or request label Jan 12, 2026
This commit introduces a new example script demonstrating a compact 3D MMI waveguide splitter. The example includes detailed documentation on the physical principles, geometry, and parameters of the design, as well as instructions for exporting simulation results to VDB format for visualization in Blender. The simulation setup and execution are integrated, allowing users to visualize wave propagation and power splitting in the MMI structure.
This commit modifies the VDBExporter class to check for the availability of both pyopenvdb and openvdb libraries, allowing for greater compatibility across platforms. The pyproject.toml file is updated to include installation notes for openvdb via conda for users on unsupported platforms. Additionally, voxel size handling is improved for better visualization in Blender.
This commit updates the VDBExporter and Simulation classes to support exporting electric field magnitude |E| with optional logarithmic scaling for better dynamic range visualization in Blender. The default export behavior now includes magnitude fields, which reveal wave structures more effectively than individual components. Additionally, new parameters for log scaling and epsilon handling are introduced, along with comprehensive updates to the example script to reflect these changes. Documentation is enhanced to clarify the benefits of using magnitude fields over component fields.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants