NVIDIA / gvdb-voxels

Sparse volume compute and rendering on NVIDIA GPUs
Other
672 stars 144 forks source link

is it possible to perfrom collision checks Whether there is collsion between a given volume box and gvdb-voxels? #118

Open jediofgever opened 3 years ago

jediofgever commented 3 years ago

Hi I am wondering whats the most efficient way to perform collision checks within gvdb-voxels? I look through whole documentation and API but didn't see anything related to it.

ramakarl commented 3 years ago

You could write a kernel to do this. Pass the bounding box min/max into a voxel compute kernel. Then for each voxel above your threshold check if its inside the test volume. Each thread can write a single bit/byte into a global array as out (0=no hit, 1=hit). Bring back the output array to CPU. Then perform a compute reduction (sum all 1 entries) on the global array, that will tell you whether there is a collision and also the amount of collision (volume integral). There is no build-in function to do collision tests, but the function for reductions is there.