Soft Objects

Blitz3D Forums/Blitz3D Programming/Soft Objects

Picklesworth(Posted 2004) [#1]
Has anyone gone and got their head around constructing a soft object deformation system to work alongside a physics engine like Tokamak?
The reason I'm asking this is because I realised that all games have a ton of objects that should be flimsy, but they are completely rigid. A bed, for instance, which is always in a game, may as well just be a stack of bricks. What I want to achieve is a system where stuff that should be soft is soft (ie: A giant rubber ball squeezes a bit before bouncing)
So - any ideas where I can get started with making soft object deformation? (possibly working under Tokamak, but I think I could figure that bit out myself).


Klaas(Posted 2004) [#2]
maybe "bouncer" can help you a bit ..
his "nano" game got beautifull soft objects

take a look here and download the demo:
http://www.blitzbasic.com/gallery/view_pic.php?id=640&gallery=&page=1


Picklesworth(Posted 2004) [#3]
Yes, those are quite nice :)


Sweenie(Posted 2004) [#4]
http://panoramix.ift.uni.wroc.pl/~maq/eng/index.php

Try out the Soft Body 3 application, it's awesome.


sswift(Posted 2004) [#5]
Making soft objects is relatively easy. What you need to do is make a mesh of vertices, and connect them with springs. The stiffness defines how stiff your cloth or ball is. You will need crossbar springs to keep the object from collapsing through. Ie, if you have a cube, you will need FOUR crossbar springs, one crossing each diagonal inside the cube. And for a sphere... Ouch!

There may be other ways of handling this problem though. For example, I think I read a paper once on simulating rubber balls using an air pressure simulation. The idea is that as you push on a vertex, it increases the pressure inside the ball. If the ball is floating in space, pushing it will not deform it at all. But if you're pushing it against a surface the different constraints would cause some vertcies to be limited by the floor which would cause others to bulge out when you press down on the top. If you combine this with a spring system connecting the overlying mesh of vertcies over the top to simulate the surface trying to keep itself intact, then you might get a really good simulation. You could press down on a single vertex as if with an ice pick, and the ball would get a dent in it, but other vertcies would be pulled down by the springs and the springs and pressure would in turn exert pressure back on the vertex you're pushing on. Meanwhile the vertices at the sides would move outward some from the pressure increase.

It might be hard to get this to work with a matteress shape though...

Perhaps what one needs is a desired shape. Instead of simply conencting all the vertcies with springs, what you could use is a special spring like construct. The idea is that the surface has a certain shape, and it wants to maintain that shape. Each vertex is connected to other vertcies, and it wants to maintain the shape of the surface those connections make in its local area. In other words, it's kind of like the entire surface of the object is a set of pyramids or cones which are built from vertcies connected by springs.

If you consider the case of a cube though, and you actually try to model this with springs and not some advanced type of spring like system, then you might actually end up with more springs than the first way I desribed.

In the case of a cube, each corner vertex would form the tip of a pyramid. There are three vertcies it is connected to. This pyramid if constructed from springs would need one for each side, and three at the "base". The "base" in this case is inside the cube, and these springs would be crossbars that run along the outside of the cube face diagonals instead of through the middle of the cube diagonals.

It is easy to see that this means that for this type of cubs, you'd need two springs for each face, and one for each edge. That would bring us to a total of... 12 + 12 ... 24 springs.

The original cube I suggested would require 12 + 4 springs... 12 edges, and four crossbars... 16 springs. Unless I have made an error.

But like I said, you may not need to simulate springs at all to make the surface desire to retain it's shape. You may need to just calculate how wrong the surface is at a point and use that as a spring factor to dtermine how much force to apply to pull it back into shape or something. But this is all theoretical.


Picklesworth(Posted 2004) [#6]
Thanks very much for the help so far!
I'll play with this stuff soon.