InteractiveComputerGraphics / PositionBasedDynamics

PositionBasedDynamics is a library for the physically-based simulation of rigid bodies, deformable solids and fluids.
MIT License
1.89k stars 358 forks source link

What's the right way to use `TetGen`? #97

Closed Xayah-Hina closed 2 years ago

Xayah-Hina commented 3 years ago

Hi~

I'm working on a FEM simulation on PositionBasedDynamics and get trapped by the right way to convert a obj mesh to a tet model.

In the example scene DeformableSolidCollisionScene, I learned that .ele file and .node file are required to get a tetrahedron model, they're produced by the tool TetGen.

But unfortunately, I found that TetGen seems not to support a direct approach to convert a .obj file to .ele and .node TetGen doc, it seems only support .off .ply .stl .mesh. And there is a command tetgen -pqa5000.0 Armadillo_UV_low.off at the last line of the files armadillo_4k.ele and armadillo_4k.node, which hints that a .off is required, but I don't know where can I get the .off file...


So my confusion is that,

more specifically,

Best regards~

korzen commented 3 years ago

Hi, you can convert obj to ply and/or stl using e.g. free MeshLab.

TetGen has great documention http://wias-berlin.de/software/tetgen/1.5/doc/manual/manual006.html#sec88

Xayah-Hina commented 3 years ago

@korzen Oh yes, I used MeshLab. my question now is: why don't the visFile in xxxScene.json directly support ply or off format?

and btw, if I want to realize dynamic tetrahedralization and fracture like this -> Adaptive Tetrahedral Meshes for Brittle Fracture Simulation, I wonder if there is any convenient approach for PositionBasedDynamics framework?

Sorry to bother you for my personal problems~ I'm new to physics based animation, and really appreciate your help! \~(≥▽≤)/\~

janbender commented 3 years ago

@korzen Oh yes, I used MeshLab. my question now is: why don't the visFile in xxxScene.json directly support ply or off format?

The simple answer is: because nobody had time to implement this yet ;-)

Xayah-Hina commented 3 years ago

@janbender I see it~ thank you guys for this awesome work~ ଘ(੭ˊᵕˋ)੭

Xayah-Hina commented 3 years ago

@korzen I feel so sad that I still can not convert correctly using TetGen. T.T

in fact, I can successfully convert some simple model like sphere.ply and dragon_vrip_res4.ply using tetgen -pq mymodel.ply command. But when it comes to some complex model like bun_zipper.ply and my branch model branch.ply, it can't work properly any more...

terminal message:

p1

output files:

p2

my models: models.zip

I really wonder why ToT... Apologize to bother you but could you please offer me some advice for my confusion? Thanks a lot!

janbender commented 3 years ago

I'm no expert in using TetGen but maybe TetWild can give you better results:

https://github.com/Yixin-Hu/TetWild