PDA

View Full Version : Soft body dynamics, volume estimation, swamped...

Thisissparta
11-04-2010, 06:30 AM
Hope this is the right forum - hi everybody!
I'm working on creating a rigid & soft body simulation as a term project for my Computer Graphics class. The subject is fascinating! I got a basic rigid-body physics engine working including basic collision detection and am starting work on the soft-body part and I'm swamped. For the soft-body part I plan on using the "Spring-Pressure Soft Body Model" described in many papers I've found (i.e. verteces connected by springs & volume filled with gas to satisfy PV=nRT to compute forces).

I'm now completely stuck with approximating/computing the volume of my deformable solid. Obviously it's an easy formula when the volume starts as a sphere, but once deformed I have no idea where to go... I was considering using a bounding box with verteces (X,Y,Z)min to (X,Y,Z)max, but that's way too inaccurate.

Any ideas? Please don't solve the problem for me, but do point me in some direction as I'm obviously going through a major brain fart :D

Thanks!

Diggsey
11-04-2010, 06:41 AM
If you only need an approximation, and the shape is roughly spherical, you could find the average distance from each vertex to the centre of the body, and use that as the radius in the volume of a sphere formula.

edit:
This paper also has a couple of ways to calculate the volume:
http://panoramix.ift.uni.wroc.pl/~maq/soft2d/howtosoftbody.pdf

Thisissparta
11-04-2010, 06:56 AM
Uh, that's good! Average 'radius' then compute volume of sphere. I'll try that, thanks!

That's one of the papers I'm using to develop my soft-body model and I had not seen the appendix at the bottom - DUH! Thanks for pointing it out. Now on to figure out how to implement that method for a 3D object.

blink
11-04-2010, 07:08 AM
Like you said, bounding volumes would be inaccurate, try convex hull.
If it is not enough, you could try slicing the mesh and calculating volume for each slice, that way you can get the highest accuracy since it is the math way, but you need to get your hands dirty for this :)