cuda_voxelizer icon indicating copy to clipboard operation
cuda_voxelizer copied to clipboard

Axis-aligned surfaces problem mentioned in util.h

Open conceptclear opened this issue 4 years ago • 6 comments

Hi,@Forceflow I have found the reason which caused the problem that you mentioned in util.h. In cpu_voxelizer.cpp Line 133 to Line 135 and voxelize.cu Line 131 to Line 133 The positions of z and x in these lines of code are wrong. The modified code could be

float d_xz_e0 = (-1.0f * glm::dot(n_zx_e0, glm::vec2(v0.z, v0.x))) + glm::max(0.0f, info.unit.z * n_zx_e0[0]) + glm::max(0.0f, info.unit.x * n_zx_e0[1]); float d_xz_e1 = (-1.0f * glm::dot(n_zx_e1, glm::vec2(v1.z, v1.x))) + glm::max(0.0f, info.unit.z * n_zx_e1[0]) + glm::max(0.0f, info.unit.x * n_zx_e1[1]); float d_xz_e2 = (-1.0f * glm::dot(n_zx_e2, glm::vec2(v2.z, v2.x))) + glm::max(0.0f, info.unit.z * n_zx_e2[0]) + glm::max(0.0f, info.unit.x * n_zx_e2[1]);

After modifying these codes, the problems mentioned in https://github.com/Forceflow/cuda_voxelizer/issues/7 should not happen again :)

conceptclear avatar Nov 26 '20 17:11 conceptclear

Interesting, looking into this. If I can get rid of the hacky little epsilon perturbation, would be nice.

Forceflow avatar Nov 27 '20 11:11 Forceflow

@conceptclear this doesn't fix the problem unfortunately. I added this, and removed the ugly fix in util.h - the problem returns.

Tried it on the problematic model from issue #7 and it still has holes along the edges.

Forceflow avatar Dec 02 '20 17:12 Forceflow

I have tried this on my own computer and it could solve the problem as shown below: Screenshot from 2020-12-03 16-35-57 Screenshot from 2020-12-03 16-36-46 The origin model in https://github.com/Forceflow/cuda_voxelizer/issues/7 has been deleted from the server so that I am not sure whether it could solve it.

conceptclear avatar Dec 03 '20 08:12 conceptclear

Could you make a PR with the exact changes?

Forceflow avatar Dec 03 '20 18:12 Forceflow

OK, I have made a PR to dev

conceptclear avatar Dec 04 '20 07:12 conceptclear

Here's the problem model. problem.zip

Forceflow avatar Dec 04 '20 16:12 Forceflow