Open
Description
Environment
Operating System: Win 10
Version: VDB 12.0
Describe the bug
I'm building an nanovdb::IndexGrid
from an openvdb::FloatGrid
. It encodes voxel values as blind data that can be accessed with a
nanovdb::ChannelAccessor<float, nanovdb::ValueOnIndex>
, there everythings works as it should.
But when using an openvdb::VectorGrid
and the accessor nanovdb::ChannelAccessor<nanovdb::Vec3f, nanovdb::ValueOnIndex>
the channel ptr is empty.
To Reproduce
using SrcGridT = openvdb::FloatGrid; // replace by opevdb::VectorGrid
using DstBuildT = nanovdb::ValueOnIndex;
using BufferT = nanovdb::cuda::DeviceBuffer;
nanovdb::GridHandle<BufferT> idxHandle = nanovdb::tools::createNanoGrid<SrcGridT, DstBuildT, BufferT>(*floatGrid /* *vectorGrid */, 1u, false , false, 0);
idxHandle.deviceUpload(stream, false);
const auto* gpuGrid = idxHandle.deviceGrid<DstBuildT>();
launch_kernels(gpuGrid, toSample, stream);
Then a cuda kernel is launched to access the grid on the GPU.
__global__ void gpu_kernel(const nanovdb::NanoGrid<nanovdb::ValueOnIndex>* gpuGrid, const float* data) {
const nanovdb::ChannelAccessor<float /* nanovdb::Vec3f */, nanovdb::ValueOnIndex> acc(*gpuGrid);
if (!acc) {
printf("Error: ChannelAccessor has no valid channel pointer! (null)\n");
return;
}
const uint32_t idx000 = acc.idx(0, 0, 0);
printf("Idx at Coord 0,0,0 : %u\n", idx000);
}
Additional context
I tried different configurations such as adding 3u
channel with the VectorGrid and trying to access each component individually but it didn't work.