Obi Official Forum
Physiology model - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: General (https://obi.virtualmethodstudio.com/forum/forum-5.html)
+--- Thread: Physiology model (/thread-2433.html)



Physiology model - jagiellonczyk14 - 19-08-2020

I am thinking about creating an advanced Physiology model  in the span of 1-2 years .
I will need to buy all your packages and I understand that until I will pay for your expertise I will not get detailed answer (and it is fair), I just need to know is it possible at all .


[Image: jbyPvTw3UZysn3F_bt8aCv4hP6iwwnAu7Gw0xJ-J..._TdiBrRvgA]
Those blue shapes are cells I would like to use cloth and water package to simulate situation that :
    1. pressures in the cells are changing hence they can stretch, and this stretching will affect cells around
    2. I would like to program how strongly cells are connected (glued) together so after reaching some threshold they will lose contact
    3. Stretching of the cells should also affect space between them, so for example obstructing small blood vessels.
I want cell membrane (cloth around cell) to be destructible
    1. I would like to be able to regulate the force threshold after which it will burst , so different cells may have different strength
I want to mimic fluid/blood flow 
    1. As you can see i this space between cells in the center as a model of blood/lymphatic vessels - i would like to get situation that a fluid will flow through the vessels only when pressure of fluid (blood) exceeds pressure in the cells (bulging cells should obstruct flow)
    2. In case of obstacles (for example like this yellow shape at the bottom) I would like to make the fluid flow turbulent hence less effective
    3. I would like also to be able how much of blood is flowing through some area in order to estimate how much for example oxygen it had brought
    4. If possible I would like to be able to model adhesion so I have some force of flowing blood depending on pressure I have some force that causes body (blood cell) to attach to the vessel wall as shown here[Image: sYxiCKkA46vk2tyCzcaima3r4lkfk_TSWa80JaCQ...cYL10Vsdqv] Obviously if blood flow is too fast the cell should not be able to attach to the vessel wall if blood flow is slower, and adhesive force big enough should adhere.
External forces
    1. There may also be external forces like gravity - so will need to model that pressure in tissues lower is higher than those that are higher …
    2. External poking, incisions … so it will disintegrate or not depending on programmed factors like cell toughness and force of connections between cells
Cytoskeleton
    1. Cells also have some cytoskeleton that gives them some elasticity so they behave more like a soft body with variable elasticity , However when cell membrane is ruptured it behaves more like a balloon ruptured.  And when it swells it is partly constrained by the elastic cytoskeleton partly  by the cell membrane.So I would like to program elasticity of the cells.
Hard tissues and tendons
    1. As the amount of cells progresses I would like to also mimic the behaviour of soft tissues around bones connected with tendons (your rope package).
Optimizations
    1. Model will start from single cell in that case I will wrap all in cloth and keep internal organelles as soft bodies that are floating in fluid - should be manageable as far as I had seen your animations
    2. Later on as amount of cells will increase the computations needed to manage it all will be unsustainable so i would want to

      1. Replace actual physics of inside of the cell with prefabricated animation and keep it just as a sacks of fluids that are connected with some preprogrammed force and that has some pressure inside the same in whole section
      2. Than if amount of cells will further increase get animations of whole sections and just animate sections of tissues as soft bodies
      3. Or is it possible to programmatically dynamically reduce the granularity of physics control when zoom pit and Ingress when zooming in ?
Buoyancy
    1. Also organism as a whole will be suspended in water so i need to keep buoyancy correct (Although I suppose that It will be relatively simple)
Cross Section
    1. if I would make it as 3d model I will need to show cross sections through some areas  (this may also be a problem because I would need to make visible some layer of the cell , hover physics would need to keep behaving as having organism as a whole so for example I would like to get cross section through blood vessel and show it to user but blood should not flow out until it is actually ruptured, also when looking at cross section of the cell physics needs to behave consistently.
2D/3d
    1. Obviously it will be far more realistic  to make it as 3d model but obviously it will require far more computational power, However I do not know How much more, so if I think about desktop computer (Let’s make it probable desktop computational power in 4 years) will it possible to manage what I intend in 3d if not in 2d? Does your library work in 2d?

My Background: I am programming for 4 years now (Kotlin, javascript, java, python, some C#) , However I did only tiny game in Unity, so my knowledge in area of games, animations, physics modelling  is limited for now However learning is something that I am well practiced in , I am also lecturer at university where I teached between others physiology, neurology, pathophysiology  and anatomy. 


You are advertising also as a CPU library, to be honest I do not understand why it is so good (surely my question is caused by my ignorance) but from math perspective I suppose that physics animations are like highly advanced complex matrix operations, and matrix operations are usually better suited to GPU 


Also I want to stress that it will be used for educational not scientific purposes so I do not need absolute correctness , just to make it look and behave quite realistically. I know that some models are already present and possible to purchase by universities but They do not show all of the things that I would like to implement, Hence my inquiry. I intend to  first do some demo and then try to get on its basis funding to hire some help. However first is it possible to do in unity what i describe below using your technologies. 


RE: Physiology model - josemendez - 21-08-2020

Hi there!

Getting this to run in realtime using a particle-based engine is a challenge to say the least. If I understood correctly, the space around cells (interstitial?) is filled with fluid, but in many cases the gap is so thin you'd need crazy high resolution (very small particles) to accurately model it. Also, the inside of the cell is filled with fluid too, so the entire scene is represented by particles.

Going 3D instead of 2D adds to the challenge, as it is many times more expensive. The cost of the simulation grows proportional to the amount of particles, so if you need -say- 10.000 particles to fill one square unit (100x100), you'd need one million (100x100x100) to fill one cubic unit. That's a lot. Current state of the art in GPU based PBD simulations (Nvidia Flex) can simulate comfortably up to around 65.000 - 80.000 particles, more than that starts to be a problem.

In short, this is a significant amount of work (months, if not years), and completely out of Obi's reach. I'd recommend looking for a customized solution, that can benefit from shortcuts/optimizations specific to your use case. It would also be beneficial to consider alternative, non fully lagrangian (not fully particle-based) simulation methods. I'm talking about MPM/FLIP/PIC. These use a combination of grids/particles, where equations are solved on a grid, and quantities transferred to particles for advection. This allows for less numerical dissipation and way more particles in the simulation, as particles do not directly interact with each other (see this for an example: https://www.youtube.com/watch?v=z2ASmsHRMpc). It also lends itself well to elastic/viscous behavior. It's not unconditionally stable like XPBD (the method used by Obi), but in your case this is not a showstopper as very high velocities or violent motions are not expected.

Doing this kind of simulation on the GPU is not always immediately beneficial. Running anything on the GPU has a high fixed cost. If your simulation is small enough, it will run slower in the GPU, up until you reach a given amount of particles and CPU performance starts to degrade. In addition to this, the GPU is already quite busy with rendering tasks in a typical game. For these reasons, in many games where simulation is not the main feature it's better to use the CPU. Not in your case though, as simulation is the focal point of the project and you can probably get away with very simple rendering, so if possible this should be implemented in the GPU.

The author of the video in the link above, Grant Kot, is an expert in MPM so he might be able to give you advice.

Let me know if I can be of further help,


RE: Physiology model - jagiellonczyk14 - 21-08-2020

I am extremely gratefull for shared expertise. I will investigate path that You suggested  and get back with some results, so all would benefit. One more time thanks!