topskychen / voxelizer

A fast parallel CPU-based surface & solid voxelizer.
MIT License
76 stars 20 forks source link

How to fill the inside voxels? #14

Closed HEROhaoyu closed 2 years ago

HEROhaoyu commented 2 years ago

Hello! I run your project on Linux. When I use - solid mode, I find that the result generated by using is still hollow (my model is a sphere). And I want to fill the inside voxels. What's the problem? clipboard

topskychen commented 2 years ago

Thanks for trying the voxelizer. I have a quick try and it works for me, as shown in the below information. Especially we can see the solid mode has much more voxels are written out than surface mode (13176 vs 3656).

Solid Mode:

./bin/voxelizer --input=../data/sphere.obj --output=../playground/sphere_solid.binvox --verbose=true --grid_size=28
voxelizer init...
mesh number: 1
faces : 960
vertices : 679
voxel size: 1.428579, 1.428579, 1.428579
grid size: 28, 28, 28
space: (-20.0001 -20.0001 -20.0001), (20.0001 20.0001 20.0001)
mesh bound: (-20.0001 -20.0001 -20.0001), (20.0001 20.0001 20.0001)
voxel bound: (0 0 0), (27 27 27)
init output bound done.
Init done.
voxelizer initialization consumes 340 ms.
-------------------------------------------
surface voxelizing...
done.
surface voxelization consumes 1 ms.
-------------------------------------------
solid voxelizing...
round 1...
round 2...
done.
solid voxelization consumes 1 ms.
-------------------------------------------
writing voxels to file...
dim : 28 x 28 x 28
wrote 13176 set voxels out of 21952, in 2346 bytes
bounds are: (0 0 0), (27 27 27)
writing file consumes 2 ms.

Surface mode:

./bin/voxelizer --input=../data/sphere.obj --output=../playground/sphere_surface.binvox --mode=surface --verbose=true --grid_size=28
voxelizer init...
mesh number: 1
faces : 960
vertices : 679
voxel size: 1.428579, 1.428579, 1.428579
grid size: 28, 28, 28
space: (-20.0001 -20.0001 -20.0001), (20.0001 20.0001 20.0001)
mesh bound: (-20.0001 -20.0001 -20.0001), (20.0001 20.0001 20.0001)
voxel bound: (0 0 0), (27 27 27)
init output bound done.
Init done.
voxelizer initialization consumes 332 ms.
-------------------------------------------
surface voxelizing...
done.
surface voxelization consumes 1 ms.
-------------------------------------------
writing voxels to file...
dim : 28 x 28 x 28
wrote 3656 set voxels out of 21952, in 4526 bytes
bounds are: (0 0 0), (27 27 27)
writing file consumes 2 ms.

May I have more information?

  1. What is the command line you used to run the voxelizer?
  2. What is the log information produced by the voxelizer?
  3. Do you use the testing file in this project? If no, could you give the test file to me for further testing?

Archive.zip Attached is the binvox files the voxelizer generated.

HEROhaoyu commented 2 years ago

Thank you for your answer! When I try, I just follow readme step by step without special commands. In addition, I checked the files you provided and found that both output files are hollow. What I want to achieve is that voxels are filled into the interior of physics, not just the surface.

topskychen commented 2 years ago

May I know which software you are using to check the output binvox file?

HEROhaoyu commented 2 years ago

I refer to this project https://github.com/EchoTHChen/binvox_vox_obj first convert binvox format to Vox format, and then use magicavoxel to convert it into obj file.

topskychen commented 2 years ago

Do you mean that you are viewing the obj file? If you are, usually it is a mesh object (only the surface is left).

HEROhaoyu commented 2 years ago

Thank you for your reminding. I didn't realize this problem before. Then I'll study it further.

topskychen commented 2 years ago

Cool. I will close this issue. Welcome to reopen if there is still an issue.