unity-voxel icon indicating copy to clipboard operation
unity-voxel copied to clipboard

Issue with the GPU Voxelization (partial voxelization)

Open kannebankai opened this issue 2 years ago • 3 comments

We use the GPU voxelization part on all types of meshs from primitives to more complex meshs. However, the voxelization can end up being incorrect depending on the voxelSize parameter.

For exemple with a voxelSize of 1 or 0,05 on the primitive cube instantiated at runtime the voxelization have no problem at all. But, if we try to do the voxelization of the same object but with a voxelSize of 0,1 this time it will end up creating only few faces depending on the cube position.

Here is an exemple of the voxelization with the parameter voxelSize equal to 0,1. The first image is from a cube in (0,0,0), the second is from a cube in (-6.7,0,1.2).

image

image

Do you have an hint for why does it act like this ?

kannebankai avatar Oct 21 '21 14:10 kannebankai

I think it has to do with the way the polygon tracing works in this particular package. Because there's no "Antialiasing" applied occasional an edge will be missed because it doesn't cover enough of a voxel.

image

Here's an example of how this can happen in 2D in some of the most common machine learning libraries. As you can imagine the image processing or multiple samples required to clean up these issues can be expensive. So its probably best to find the highest voxel resolution that works for your project while maintaining performance. Or conversely you could make the features of your model larger.

racer161 avatar Dec 02 '21 16:12 racer161

This could work but we have to let the users decide which voxel resolution they want, so ultimately we modified and rewrote the whole surface and volume voxelization behaviour to make this work as intended for us.

kannebankai avatar Dec 08 '21 08:12 kannebankai

@kannebankai, can you share what you modified?

Mitko88 avatar Jul 27 '22 06:07 Mitko88