Skip to content

Minimum Viable Product for Half Grid Support#2106

Merged
apradhana merged 32 commits intoAcademySoftwareFoundation:masterfrom
apradhana:feature/half_grid_support_mvp
Oct 30, 2025
Merged

Minimum Viable Product for Half Grid Support#2106
apradhana merged 32 commits intoAcademySoftwareFoundation:masterfrom
apradhana:feature/half_grid_support_mvp

Conversation

@apradhana
Copy link
Contributor

This PR is trying to offer a Minimum Viable Product for Half Grid Support in OpenVDB 13.

Things covered in the PR are:

  • Native HalfGrid registration in the OpenVDB library.

Copy link
Contributor

@danrbailey danrbailey left a comment

Choose a reason for hiding this comment

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

This looks good in general. However, if we do go this route and split this into two separate PRs, this first PR should disable anything for which we need a compute type algorithm, for example BoxSampler::sample(). There should be a static assert ensuring that it is not a half tree, otherwise this will (currently) do trilinear interpolation at half type which will ultimately change behavior when we subsequently add compute type.

Copy link
Contributor

@danrbailey danrbailey left a comment

Choose a reason for hiding this comment

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

I did a more thorough review of this yesterday. I think this all looks good, but my main concern remains that we are not explicitly disallowing half support for some algorithms where we haven't figured out compute type yet. I appreciate that the goal is to do like what you have done with level set sphere and to switch these algorithms from std::is_floating_point to openvdb::is_floating_point and that makes sense to me, but not all algorithms that are designed to work with floating-point grids have a static assert for std::is_floating_point unfortunately.

One such example is the LevelSetAdvection class, this currently works with any grid type and doesn't even validate that the grid must be a level set. As a result we are implicitly breaking backwards compatibility if we subsequently adapt this algorithm to use float as the compute type for HalfGrids in the future. I would be happy if we at least audit the tools and add explicit static asserts for half for any tool that doesn't already have a std::is_floating_point static assert.

ghurstunither and others added 18 commits October 29, 2025 12:47
Migrate over core changes from PR 1730

Signed-off-by: ghurstunither <62885595+ghurstunither@users.noreply.github.com>
* Removes ComputeType from tree & grid.
* The same method still work with half grids.
  * Only now they infer the ComputeType through ComputeTypeFor<ValueType>::type.
* A lot of methods now let the user choose the compute type through an optional template argument.
  * Defaulting to ComputeTypeFor<ValueType>::type when user omits the parameter.

Note: The grid sampler's method sample (BoxSampler, etc) can now take an optional compute type template argument. I think this breaks backward compatibility on users with custom samplers because the GridSampler class will pass in the compute type to SamplerT::sample() now.

Signed-off-by: ghurstunither <62885595+ghurstunither@users.noreply.github.com>
…lied.

Restrict ComputeType to be computed, rather than optionally user supplied.

Signed-off-by: ghurstunither <62885595+ghurstunither@users.noreply.github.com>
Whitespace

Signed-off-by: ghurstunither <62885595+ghurstunither@users.noreply.github.com>
Uses ComputeType during Renormalization to prevent catastrophic error with small voxel size.

Signed-off-by: ghurstunither <62885595+ghurstunither@users.noreply.github.com>
ComputeType computations for finite differences.

Signed-off-by: ghurstunither <62885595+ghurstunither@users.noreply.github.com>
Compute and return finite differences and other operators in terms of ComputeType.

Signed-off-by: ghurstunither <62885595+ghurstunither@users.noreply.github.com>
Removes incorrect template arguments.

Signed-off-by: ghurstunither <62885595+ghurstunither@users.noreply.github.com>
Explicitly return halfs.

Signed-off-by: ghurstunither <62885595+ghurstunither@users.noreply.github.com>
double to float.

Signed-off-by: ghurstunither <62885595+ghurstunither@users.noreply.github.com>
Fixes unused-local-typedef errors.

Signed-off-by: ghurstunither <62885595+ghurstunither@users.noreply.github.com>
Correct variables.

Signed-off-by: ghurstunither <62885595+ghurstunither@users.noreply.github.com>
Fixes more unused-local-typedef errors.

Signed-off-by: ghurstunither <62885595+ghurstunither@users.noreply.github.com>
Correct return types.

Signed-off-by: ghurstunither <62885595+ghurstunither@users.noreply.github.com>
Signed-off-by: apradhana <andre.pradhana@gmail.com>
Vec3.

Signed-off-by: apradhana <andre.pradhana@gmail.com>
Signed-off-by: apradhana <andre.pradhana@gmail.com>
Signed-off-by: apradhana <andre.pradhana@gmail.com>
Signed-off-by: apradhana <andre.pradhana@gmail.com>
Signed-off-by: apradhana <andre.pradhana@gmail.com>
Signed-off-by: apradhana <andre.pradhana@gmail.com>
Signed-off-by: apradhana <andre.pradhana@gmail.com>
Signed-off-by: apradhana <andre.pradhana@gmail.com>
Signed-off-by: apradhana <andre.pradhana@gmail.com>
Signed-off-by: apradhana <andre.pradhana@gmail.com>
Signed-off-by: apradhana <andre.pradhana@gmail.com>
…e instantiation.

Signed-off-by: apradhana <andre.pradhana@gmail.com>
Signed-off-by: apradhana <andre.pradhana@gmail.com>
Signed-off-by: apradhana <andre.pradhana@gmail.com>
Signed-off-by: apradhana <andre.pradhana@gmail.com>
@apradhana apradhana force-pushed the feature/half_grid_support_mvp branch from 501ffc8 to 80e48d2 Compare October 29, 2025 20:21
Signed-off-by: apradhana <andre.pradhana@gmail.com>
Signed-off-by: apradhana <andre.pradhana@gmail.com>
Copy link
Contributor

@danrbailey danrbailey left a comment

Choose a reason for hiding this comment

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

Thanks Andre, looks good! Squash before merge please. :)

@apradhana
Copy link
Contributor Author

Thank you for shepherding @ghurstunither and I to get this in, @danrbailey and @Idclip . Appreciate all the code reviews and comments.

@apradhana apradhana merged commit c69404e into AcademySoftwareFoundation:master Oct 30, 2025
43 checks passed
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.

4 participants