First of all, I am following kitware medical solutions,Vtk, IMSTK, Pulse ngine.
I was very excited when I saw IMSTK as a Unity asset. But when I tried to use it in unity, I faced some technical problems. One is tethedralization process. I couldn’t tethedralize my 3d model format like fbx. is tetrahedralizationis only working for Vtk file.
Second issue is physics based problem. For example when I move the heart in your tutorial scene, after the simulation is completed, it doesn’t continue to simulate the physics. Or I can’t move other physics based objects with unity’s transform property.
First of all thanks for trying out the iMSTK plugin. It’s our first release
With regards to tetrahedralization, yes right now the process is somewhat convoluted, the unity asset is not able to do the tetrahedralization itself, we use GitHub - Yixin-Hu/TetWild: Robust Tetrahedral Meshing in the Wild. to create the tetrahedra and https://gmsh.info/ to convert it to vtk. iMSTK recently gained
.msh file support but that isn’t included in the unity asset yet.
With the second question, no once the simulation is running you won’t be able to move deformable objects through the unity transform system. Even though things look like they are stopped we are still simulating the objects, in the examples the simulation is never really “completed”.
Was there a specific reason to move the object around or were you just experimenting ?
TetWild and TetGen have copyleft licenses meaning you cannot include them in private/closed commercial projects. This copyleft license also means it can’t be included in iMSTK directly as iMSTK is free for commercial use (apache2.0).
You can still use these externally. Call them on the commandline. Supply it an obj surface mesh and set the ideal length. TetWild’s “.msh” output can be read by iMSTK directly, though I’m not sure this change has made it to Unity yet as this was recent. Alternatively gmsh (a UI tool) can be used to convert tet file types (to .vtk).
Feel free to contribute to the Unity plugin, its still in beta but is open source. If you were to go about adding this to the Unity plugin and I would suggest something like a UI box with a field where the user can provide the path to the tet tool they installed separately (and iMSTK-Unity would remember it), which would write the mesh and issue the simple system call to TetWild. Avoiding any license issues.
Alternative you may want to use distance and dihedral constraints to simulate a thin tissue mesh without tetrahedralization. Which may approximate a hollow organ well.
Thank you very much for your fast response. We have VR based procedural surgical simulation project that is funded by sccientfic and technical council of Turkey. We are planining to use IMSTK plugin.
Your Question: Was there a specific reason to move the object around or were you just experimenting ?
There is no specficic reason. For example I run down soft object, when it collide rigid surface. It should be vibrate. We tried this. We couldnt manage it.
Thank you for tethedralization and convert to vtk informations.
In iMSTK-Unity you have access to a C# wrapped version of iMSTK (though not every bit is exposed at the moment).
From the iMSTK component on your GameObject in Unity you may do:
// Get the iMSTK APIs dynamical model
Imstk.PbdObject pbdObject = Imstk.Utils.CastTo<Imstk.PbdObject>(myPbdModelComponent.GetDynamicObject());
Imstk.PbdModel model = pbdObject.getPbdModel();
// Apply external force
model.getConfig().m_externalForce = new Imstk.Vec3d(1.0, 0.0, 0.0);
This should apply to all vertices (moving them right), so here you could throw some random or cos forces for jitter. This external force is reset at the end of every iMSTK scene update/advance. There is a more convaluted way to move specific vertices if that’s what you’re after.
Note: This has changed in C++ iMSTK slightly to allow for multi body PBD (mulitple deformable and rigid bodies in one unified solver) and will soon be:
Deger, this is still very much a work in progress and we are currently working on updates to catch up to the iMSTK master. While it will require building iMSTK, the github repository of the will be more up to date than the asset on the asset store.
If you need more information please reach out to me at email@example.com, i’m looking forward to seeing your progress !