Fix USD volume range and skip NanoVDB grids with no active voxels#200
Fix USD volume range and skip NanoVDB grids with no active voxels#200apaaris wants to merge 1 commit intoNVIDIA:next_releasefrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses rendering issues with NanoVDB volumes that contain no active voxels, which previously appeared as dark blocks. The fix adds validation to skip empty grids and ensures proper value range initialization for USD volumes.
Changes:
- Added active voxel count validation for NanoVDB grids to skip empty volumes
- Fixed USD volume value range initialization to use field's computed range as default
- Added conditional check for transfer function domain validity
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tsd/src/tsd/io/importers/import_USD.cpp | Initializes value range with field's computed range and validates transfer function domain |
| tsd/src/tsd/io/importers/import_NVDB.cpp | Adds active voxel count check to skip empty NanoVDB grids |
Comments suppressed due to low confidence (1)
tsd/src/tsd/io/importers/import_NVDB.cpp:1
- In the FpN case on line 46, the code incorrectly uses gridnanovdb::Fp16() instead of gridnanovdb::FpN(). This will return the wrong grid type's active voxel count for FpN grids.
// Copyright 2024-2025 NVIDIA Corporation
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| if (!hasActiveVoxels) { | ||
| logStatus("[import_NVDB] no active voxels, skipping '%s'", filepath); | ||
| scene.removeObject(field.data()); |
There was a problem hiding this comment.
The field object is being removed from the scene after it was just created. Consider skipping field creation entirely when there are no active voxels to avoid unnecessary object creation and cleanup overhead. Check for active voxels before creating the field object.
|
@apaaris I am not sure that the change is the intended behavior. As far as I understood, an inactive voxel is expected to return the configured background value. In common cases, that could be 0 or any value that maps to a fully transparent value in the transfer function, which would mimic the behavior that you implement there, by actually skipping that "empty" space. Now if that value does not map to a fully transparent color, then we'd be creating block-shaped holes in the rendering. I would suspect that an invalid data range is what could be creating that black rendering you observe. Maybe setting the range to the background value ( |
Hi everyone,
this PR fixes a bug that I've encountered when loading a large dataset composed by many nanovdbs. What happened is that when a nanovdb had no active voxel, it was rendered as a dark block.
With this PR I implemented a check that skips nanovdb volumes with no active voxel, effectively solving the problem. I think this should be fixed at source, not writing empty nanovdbs in the first place, however it is convenient in my opinion to also have this safety check in tsd.
@jeffamstutz @tarcila I'm happy to discuss the matter further if you would prefer a different solution
Have a great day,
A.