Forceflow / cuda_voxelizer

CUDA Voxelizer to convert polygon meshes into annotated voxel grids
MIT License
597 stars 98 forks source link

GPU mode yield inaccurate result #61

Open CuberMessenger opened 2 years ago

CuberMessenger commented 2 years ago

I just voxelized a simple cube, defined as (obj file): v 150.100006 400.100006 550.099976 v 550.099976 400.100006 550.099976 v 150.100006 800.099976 550.099976 v 550.099976 800.099976 550.099976 v 150.100006 800.099976 150.100006 v 550.099976 800.099976 150.100006 v 150.100006 400.100006 150.100006 v 550.099976 400.100006 150.100006

f 1 2 4 f 1 4 3 f 3 4 6 f 3 6 5 f 5 6 8 f 5 8 7 f 7 8 2 f 7 2 1 f 2 8 6 f 2 6 4 f 7 1 3 f 7 3 5

The CPU mode generate fine result, but the GPU mode yield something inaccurate:

image

31 32 33 The first image is the voxelization result visualized by marching cubes algorithm and meshLab, some glitch appears along the diagonal line. The latter 3 images are 3 continuous 2-D plane of the voxelization result, the middle one shows that the glitches comes from the voxelizer.

I barely know about cuda programming and the voxelization algorithm, just point out this issue, maybe someone can fix it. Still very nice voxelizer 😃 !

Forceflow commented 2 years ago

Yeah, I think this is an artifact of the bounding box of the model perfectly aligning with the model itself. Probably a numeric instability. Will look into it.