Hi everybody, I've made a video tutorial on my method of simulating soft body blobs and would like some feedback. I will probably be redoing them with better quality but would like to hear what questions people have before I do. My blobs only require springs on the outer edges. There are no internal springs that might cause it to collapse. And each frame, volume is preserved, exactly.
Here are some videos that show what it looks like:
">High res with Self Collision
">Self Collision
">Earlier video
There are many more of these blob videos on my channel.
And here are the links to the tutorial:
">Tutorial 1
">Tutorial 2
Blob Physics Tutorial
It is purdy. Interested in how you did the spring structure. Any chance this could work in fixed-point?
The springs are just along the edges. If you're interested in fixed point there's a game called Gish Mobile that uses a variation on this method which I helped derive. So I guess it should be possible.
My YouTube channel: http://youtube.com/kotsoft
Hello Kotsoft,
There's no doubt you've developed a really good soft body implementation, but honestly I think a video tutorial is not the right media for this kind of thing. A slide show or illustrated pdf would be easier to follow, and you would avoid the "oops, what I ment was..." glitches. In short, the content is great, but the presentation of it could be improved.
Since I've developed a similar method of my own, using the polygon area equation in the second part of your tutorial, I didn't find the math too hard to follow. But I'm not sure the physics novice would find it equally easy, and I assume he's the one you're aiming this at.
Besides, a number of questions popped up while watching this:
First, it appears that - as opposed to most physics simulations around - you move particles by manipulating their position directly, and not by applying an impulse or force on them. Maybe you could explain in a little more detail how this position-based physics works and what its advantages are?
Also, even though your blob simulation is good, I'm more impressed by your collision detection method. Itseems to be able to handle a very large number of objects in real-time, which I've also also seen in your SPH fluid simulations. Perhaps you could explain how this is done in a similar tutorial?
Finally, I've spent some time adding angular springs to my soft body simulation, so you can give it a distinct shape. Also, I've added a global damping algorithm which preserves linear and angular momentum, enabling more viscous, dough-like blobs. Here is a download link for full cpp source and windows exe:
www.jernmager.dk/stuff/cpp/softbody_glfw.zip
Maybe you would be kind enough to also share some of your source code?
Cheers,
Mike
There's no doubt you've developed a really good soft body implementation, but honestly I think a video tutorial is not the right media for this kind of thing. A slide show or illustrated pdf would be easier to follow, and you would avoid the "oops, what I ment was..." glitches. In short, the content is great, but the presentation of it could be improved.
Since I've developed a similar method of my own, using the polygon area equation in the second part of your tutorial, I didn't find the math too hard to follow. But I'm not sure the physics novice would find it equally easy, and I assume he's the one you're aiming this at.
Besides, a number of questions popped up while watching this:
First, it appears that - as opposed to most physics simulations around - you move particles by manipulating their position directly, and not by applying an impulse or force on them. Maybe you could explain in a little more detail how this position-based physics works and what its advantages are?
Also, even though your blob simulation is good, I'm more impressed by your collision detection method. Itseems to be able to handle a very large number of objects in real-time, which I've also also seen in your SPH fluid simulations. Perhaps you could explain how this is done in a similar tutorial?
Finally, I've spent some time adding angular springs to my soft body simulation, so you can give it a distinct shape. Also, I've added a global damping algorithm which preserves linear and angular momentum, enabling more viscous, dough-like blobs. Here is a download link for full cpp source and windows exe:
www.jernmager.dk/stuff/cpp/softbody_glfw.zip
Maybe you would be kind enough to also share some of your source code?
Cheers,
Mike
Yes I'm still figuring this tutorial stuff out. It takes more time than I thought :) I've been quite busy this summer so I don't get much time to work on these tutorials. But eventually I'll probably redo them all and write more stuff out. Would you be interested in collaborating on a tutorial article?
As for your questions:
I'm basically just using Verlet integration. A well known article using it would probably be Jakobsen's Advanced Character physics. But I don't think it would be that much different to just use the displacement vectors calculated as a pressure force. Anyway, mine is a more geometrically based solution. It will solve how much to offset by arbitrary vectors to achieve the desired area.
For the collisions, each of the points of the blob is just a circle, and I do circle circle collisions. The particle neighbors are quickly found using a uniform grid. I have a tutorial on that on my channel as well.
As for your questions:
I'm basically just using Verlet integration. A well known article using it would probably be Jakobsen's Advanced Character physics. But I don't think it would be that much different to just use the displacement vectors calculated as a pressure force. Anyway, mine is a more geometrically based solution. It will solve how much to offset by arbitrary vectors to achieve the desired area.
For the collisions, each of the points of the blob is just a circle, and I do circle circle collisions. The particle neighbors are quickly found using a uniform grid. I have a tutorial on that on my channel as well.
My YouTube channel: http://youtube.com/kotsoft
Quote: Original post by kotsoft
Yes I'm still figuring this tutorial stuff out. It takes more time than I thought :) I've been quite busy this summer so I don't get much time to work on these tutorials.
Sounds familiar :-)
Quote: Would you be interested in collaborating on a tutorial article?
Sure, why not. I've already started writing an article on this, but still need to finish it. It's written as a heavily expanded and improved version of Maciej Matyka's paper on gas filled soft bodys:
http://physics.hardwire.cz/mirror/GasFilledBody.zip
http://panoramix.ift.uni.wroc.pl/~maq/soft2d/howtosoftbody.pdf
Some time ago I also wrote a spring tutorial which received a fair amount of positive feedback.
Quote: I'm basically just using Verlet integration. A well known article using it would probably be Jakobsen's Advanced Character physics. But I don't think it would be that much different to just use the displacement vectors calculated as a pressure force. Anyway, mine is a more geometrically based solution. It will solve how much to offset by arbitrary vectors to achieve the desired area.
Ok, now I understand. I know the article and have implemented these types of methods, but I prefer setups with explicit velocity.
Quote: For the collisions, each of the points of the blob is just a circle, and I do circle circle collisions. The particle neighbors are quickly found using a uniform grid. I have a tutorial on that on my channel as well.
I saw your tutorial, and to my surprise this is almost exactly the same method I use - except my implementation isn't as fast as yours. I'll take a second look at your algorithms and look for ways of optimizing my code.
Cheers,
Mike
For my grid I use a custom array. Basically, I wanted a data structure where I could remove particles quickly from the cell if they changed cells. I only remove and add when they actually change cells. This gives the advantage that I don't have to loop through each grid cell and zero them out so the grid doesn't add any time no matter how big it gets. Instead of using a linked list, I use just a normal array. When I remove an object from the middle I just fill it in with the last element in the array. Each particle stores their index in the array for a O(1) removal. This only works because there is a 1 to 1 mapping. Each particle only has one cell.
Anyway, I have not done any benchmarking on this so I don't know if this will really change the speed. There may be some other thing but I can't think of it because my implementations are all really just standard so I don't know why you would get a slower speed. Just in case it's the machine, my computer is 2.4ghz Core 2 Duo, but the code is single threaded for now while I figure out some load balancing.
And here's some source for the grid cell:
Anyway, I have not done any benchmarking on this so I don't know if this will really change the speed. There may be some other thing but I can't think of it because my implementations are all really just standard so I don't know why you would get a slower speed. Just in case it's the machine, my computer is 2.4ghz Core 2 Duo, but the code is single threaded for now while I figure out some load balancing.
And here's some source for the grid cell:
public class Cell { public Particle[] particles = new Particle[4]; int length = 4; public int count = 0; public void Add(Particle p) { if (count < length) { p.cellIndex = count; particles[count++] = p; } else { length += 4; Array.Resize<Particle>(ref particles, length); p.cellIndex = count; particles[count++] = p; } } public void Remove(Particle p) { particles[p.cellIndex] = particles[--count]; particles[p.cellIndex].cellIndex = p.cellIndex; } public void Clear() { count = 0; }}
My YouTube channel: http://youtube.com/kotsoft
I agree with h4tt3n about the tutorials you linked - but don't take me too seriously, I neither did articles nor papers nor videos. I can only imagine the amount of work needed to make it "consumable" :)
On the other hand, your collision tutorial is fantastic! Never saw a better explanation/visualization of the O(n2) problem, for instance.
(Off topic: I'm still struggling with different approach for fluid dynamics, and so I'm glad to know about an alternative using particles, thanks).
I got some suggestions for your spatial grid. I'd check against a full-clear-and-refill, I think you could gain something:
- No need to store the indices (I think)
- No need to check for a cell change
- I wonder how advantagous the exploit of the coherence is , especially if you got lots of fast moving particles
- Simple parallelization: Take two grids, one thread clears, another one fills
Thanks to both of you for your work and good luck with the tutorials.
unbird
On the other hand, your collision tutorial is fantastic! Never saw a better explanation/visualization of the O(n2) problem, for instance.
(Off topic: I'm still struggling with different approach for fluid dynamics, and so I'm glad to know about an alternative using particles, thanks).
I got some suggestions for your spatial grid. I'd check against a full-clear-and-refill, I think you could gain something:
- No need to store the indices (I think)
- No need to check for a cell change
- I wonder how advantagous the exploit of the coherence is , especially if you got lots of fast moving particles
- Simple parallelization: Take two grids, one thread clears, another one fills
Thanks to both of you for your work and good luck with the tutorials.
unbird
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement