Closed yuanming-hu closed 4 years ago
The blender does not have tools for creating a voxel grid. You will have to create these tools yourself. And how did you get the voxel grid when you created this example?: https://raw.githubusercontent.com/yuanming-hu/public_files/master/graphics/mls-mpm-cpic/armodillo.gif
Taichi used to have a ray-casting based voxelization system. However, the ray-casting stuff depends on Intel Embree and leads to some portability issues. Therefore I removed that functionality... Let me think about an alternative way to do this.
There seems to be a Block
modifier that does voxelization: https://www.youtube.com/watch?v=l31iUlFiciI
This modifier converts the mesh to voxels, but the mesh is still output. You will have to convert this mesh to voxels (although it will be easier than converting the original mesh). It seems to me that it is better to copy the voxelizer from another simulator. You can see how voxelization occurs in these repositories: https://github.com/rlguy/Blender-FLIP-Fluids https://github.com/doyubkim/fluid-engine-dev Or you can see how this modifier works in the source code of the blender.
There is no data type such as volume in the blender (this data type appeared in 2.83). Therefore, I do not think that it is possible to implement conversion to voxels using standard blender tools.
Thanks for the info! I prefer not to introduce a C++ voxelizer since that will make this solver less portable (and will prevent people from trying it). With everything considered, I decided to write a voxelizer in Taichi.
#triangles x 9
, where each column has 3x3=9 float numbers, representing 3x3D coordinates of that triangle.I can do 2 and 3. Could you help with 1? I can start with an external numpy array of triangles so no rush on 1. I'm recently quite occupied, therefore I need 1-2 weeks to finish 2 and 3.
good, I will write the first paragraph. I can do today. If there is something wrong, then I will have time to correct the errors.
I made the first point. All triangles are stored in the triangles list: 7667cdf2871abbe42ce3970a12d837afb3c975f7 If I did something wrong, let me know.
Thanks! This is really helpful.
On my end, voxelizer done. A layer-by-layer view of voxelized Suzanne (gif file may take a while to load):
(There are two floating components. Not sure if it is caused by the fact that the mesh isn't watertight or there's some precision issue in the voxelizer. Will fix later.)
I will proceed to 3 in a couple of days.
Great job!
Yes, Suzanne is an open mesh (Non-Manifold Mesh). Such meshes are not suitable for voxelization. You can try to close the holes in the eyes or use another mesh.
How long does voxelization take? And at what resolution?
At 256^3
it takes 0.013s
. I wouldn't worry about its performance too much :-)
You can try it on your end, if you download and unzip triangles.zip, then run voxelizer.py
Done. See demo_3d_mesh.py
: https://www.youtube.com/watch?v=vWVQ0KICUkc&feature=youtu.be (We should use a manifold mesh next time :-)
Btw could you please integrate this new feature into Blender? I believe we will end up with an awesome simulator!
It is very cool!
I will try to integrate this function into a blender.
At the moment, seed from geometry has been made. I think you can close this issue.
To do this it's better to first voxelize the geometries in Blender, and then pass the voxel grid to Taichi. Not sure if there's a voxelization modified in Blender (https://docs.blender.org/manual/en/latest/modeling/modifiers/generate/remesh.html)