Skip to content

SaveNanoVDB: Fix voxel size/origin metadata on serialized index grids#490

Merged
swahtz merged 4 commits into
openvdb:mainfrom
swahtz:fix/issue_123
Mar 4, 2026
Merged

SaveNanoVDB: Fix voxel size/origin metadata on serialized index grids#490
swahtz merged 4 commits into
openvdb:mainfrom
swahtz:fix/issue_123

Conversation

@swahtz

@swahtz swahtz commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

This pull request improves the handling and preservation of voxel size and origin metadata in NanoVDB grid batches. The main change is the addition of logic to write per-grid voxel size and origin information during serialization of index grids. Grids we serialize to standard NanoVDB data grid types, because their data type and channel dimensions match a standard data grid type, were correctly writing this transform information but non-datagrid-compatible configurations were not. Comprehensive unit tests have been added to verify this behavior across a range of data types, shapes, and per-grid configurations.

  • Added parameterized tests in test_io.py to verify that voxel size and origin are preserved for all standard NanoVDB data types and channel counts.
  • Added tests to ensure preservation of voxel size and origin for non-standard shapes (TensorGrid/blind data path).
  • Added tests to confirm that batches with per-grid voxel sizes and origins correctly preserve each grid's transform after serialization and deserialization.

swahtz added 2 commits March 4, 2026 10:26
…ize and origin data to the NanoVDB grid.

- Added comprehensive unit tests to ensure voxel size and origin preservation across various data types and shapes.

This update fixes openvdb#123, ensuring that scalar and non-standard shape data maintain their voxel size and origin when saved and loaded from NanoVDB files.

Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
… `TestIO`. This change simplifies the test suite while maintaining coverage for standard NanoVDB data types. Related to issue openvdb#123.

Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
@swahtz swahtz requested a review from a team as a code owner March 3, 2026 21:35
@swahtz swahtz requested review from blackencino and sifakis March 3, 2026 21:35
@swahtz swahtz linked an issue Mar 3, 2026 that may be closed by this pull request
@swahtz swahtz changed the title Fix/issue 123 SaveNanoVDB: Fix voxel size/origin metadata on serialized index grids Mar 3, 2026
@harrism harrism added this to fVDB Mar 4, 2026

@harrism harrism left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@harrism harrism requested a review from Copilot March 4, 2026 02:03
@harrism harrism added enhancement New feature or request core library Core fVDB library. i.e. anything in the _Cpp module (C++) or fvdb python module labels Mar 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes missing voxel size/origin transform metadata when serializing NanoVDB batches through the “index grid + blind data” path, and adds unit coverage to ensure transforms are preserved across standard NanoVDB grid types and nonstandard tensor shapes.

Changes:

  • Write per-grid mVoxelSize and mMap (origin + scale) metadata when serializing index grids with blind data.
  • Add parameterized unit tests validating voxel size/origin preservation across standard NanoVDB data types/channel counts.
  • Add tests covering nonstandard shapes (TensorGrid/blind data path) and per-grid differing voxel sizes/origins.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/fvdb/detail/io/SaveNanoVDB.cpp Adds transform metadata writes for the blind-data serialization path.
tests/unit/test_io.py Adds parameterized tests to confirm voxel size/origin preservation across serialization/deserialization paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/fvdb/detail/io/SaveNanoVDB.cpp Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
@swahtz swahtz enabled auto-merge (squash) March 4, 2026 07:50
Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
@swahtz swahtz merged commit 2654fb0 into openvdb:main Mar 4, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this to Done in fVDB Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core library Core fVDB library. i.e. anything in the _Cpp module (C++) or fvdb python module enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Saving data grids doesn't include voxel size/scale

3 participants