Skip to content

added vdb option to -soup2ls action and improved error handeling - #2266

Open
kmuseth wants to merge 1 commit into
AcademySoftwareFoundation:masterfrom
kmuseth:improve_shrinkwrap
Open

added vdb option to -soup2ls action and improved error handeling#2266
kmuseth wants to merge 1 commit into
AcademySoftwareFoundation:masterfrom
kmuseth:improve_shrinkwrap

Conversation

@kmuseth

@kmuseth kmuseth commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

I've made two improvements to the vdb_tool:

  • Better error handling when the voxel size exceeds the bbox of the input mesh
  • Added an option, namesd"vdb", to the action -soup2ls. It is used to specify what vdb grids to output. By default "vdb=0", but you can add more, e.g. "vdb=0,1,2", or all "vdb=*".

Signed-off-by: Ken Museth <ken.museth@gmail.com>

@swahtz swahtz 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.

Changes look good, I would just request we have some tests for the fixed crash when the requested voxel size is too coarse for the input and a basic test for the output vdb=* and vdb=0,1,2 new features.

// index produces a clean error with no partial output on the stack.
for (const int lvl : levels) {
if (lvl < 0 || lvl >= count) {
throw std::invalid_argument("soup2ls: requested output grid vdb=" + std::to_string(lvl) +

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.

💡 suggestion: ‏Use OPENVDB_THROW to be consistent with other throws

mGrids.push_back(this->offset(dx, offset_mode));
}

// The loop above produces no grids when mMinVoxelSize > mMaxVoxelSize (i.e. the

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.

☑️ todo: ‏We should have a test for this case now that it's fixed.

auto myProgress = [&](const std::string &s){if constexpr(!std::is_same<ProgressT,void>::value) if (progress) (*progress)(s);};

// Fine to coarse offset generation
for (float dx = mMinVoxelSize; dx <= mMaxVoxelSize; dx *= 2.0f) {

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.

❓ question: ‏ This loop doesn't produce any grids when mMinVoxelSize>mMaxVoxelSize but the assertions in the constructor fire when mMinVoxelSize>mMaxVoxelSize/2, is that the correct behaviour here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants