I want to decrease the voxel density of an openvdb grid. Inspired by this answer, I tried the following code:
const auto dim = grid->evalActiveVoxelDim().asVec3i();
std::cout << dim.x() << " " << dim.y() << " " << dim.z() << std::endl;
T::Ptr dest = T::create();
dest->setTransform(openvdb::math::Transform::createLinearTransform(1.0f));
openvdb::tools::resampleToMatch<openvdb::tools::BoxSampler>(*grid, *dest);
const auto dd = dest->evalActiveVoxelDim().asVec3i();
std::cout << dd.x() << " " << dd.y() << " " << dd.z() << std::endl;
The printed output with the grid I tried is the following:
86 93 82
8 8 6
I don't understand what this means. With scaling 1.0 I expected the same voxel density. Does the original grid include some scaling that I need to consider?
Also, is there a way to do this operation multi-threaded?