SaveNanoVDB: Fix voxel size/origin metadata on serialized index grids#490
Merged
Conversation
…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>
Contributor
There was a problem hiding this comment.
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
mVoxelSizeandmMap(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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
test_io.pyto verify that voxel size and origin are preserved for all standard NanoVDB data types and channel counts.