-
Notifications
You must be signed in to change notification settings - Fork 463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Soft body support #390
Comments
Hello, Soft body support is definitively on the todo list, but I first need to read up on the subject and decide how it would fit in, so there's nothing concrete I can say about it yet. |
This would a great addition in my opinion, especially if it can be done efficiently on the CPU, if I'm not mistaken PhysX 5 introduced soft body support but only on CUDA capable GPUs, I would love to see a soft body simulation working on the CPU as opposed to the GPU. |
also, bulletphysics had it implemented, but it had its own physics world, and the gpu implementation was done with openCL |
Will be great to implement it as a shape. Jolt already has modifiable shapes, also rigid body is special case of soft body. Bullet implementation has a rigid body and soft body separated, it is not the best solution. |
I will make it work together with the standard rigid bodies, but it will not be a regular Shape/Body but more its own world just like Bullet. Although theoretically you could do rigid bodies with soft bodies, soft bodies are much more expensive to compute, so it doesn't make sense to handle them all in the same system. |
@jrouwe just curious how you're planning on implementing soft bodies? I know that it's common to implement it using compute shaders, just curious if you'll be going down that route as well? |
The first version will definitively be CPU based (I first need to get the API defined and have a stable simulation, that's much easier to achieve on CPU). Later perhaps there will be a GPU version too. |
Thanks for the info. It probably matters from an internal implementation point of view. I am a game engine developer, it will be more understandable and more logical for users to work with one Body class and different types of shapes inside. Separating into two classes in the Bullet complicate their interaction. They can't just replace a type of shape, harder to work with constraints. Ivan) |
I don't know exactly what the API will look like, have yet to start on research, but I'll keep your suggestion in mind. |
PBD is very friendly to the simulation of softbody, for example, a simple solver written in js without any parallel optimizations can easily handle softbodies with ten thousands vertices. If the constraints between vertices are well parallely handled, it could be cheap enough to impl softbody and rigidbody in the same world. Since jolt works really well on multiple threads, it's not a difficult thing. Moreover, proxy mesh can make softbody simulation even cheaper, which should also take into account. |
To chime in on the subject of PBD, there are some excellent publications on the cutting edge of PBD, termed XPBD, authored by a variety of Müller et al, which I'd recommend if I were implementing any of the soft body stuff. This page provides a number of them: https://matthias-research.github.io/pages/publications/publications.html Interestingly, as ODtian mentioned, this can be extended to handle rigid bodies too quite nicely, offering a unified physics model. Details can be found in the third paper down on that page I linked (third at time of writing), which is here: https://matthias-research.github.io/pages/publications/PBDBodies.pdf I might add to this: There is a youtube channel with three videos so far, in which the creator implements XPBD in C++. It's still pretty early in development, and this might not be appropriate reference material, but it's cool to see at least, and offers a parallel explanation of some of the math involved: https://www.youtube.com/@blackedoutk/videos |
Thanks for the links! I was aware of this research and I was planning to use it as a basis for soft body in Jolt. |
Very early implementation: softbody.mp4 |
Now with friction, restitution, pressure (orange sphere) and mesh terrain collisions: softbody2.mp4 |
Starting to work on interactions between rigid bodies and soft bodies: rigidbodyinteraction1.mp4rigidbodyinteraction2.mp4 |
Is https://github.com/jrouwe/JoltPhysics/commits/feature/soft_body the branch for this? |
https://github.com/jrouwe/JoltPhysics/tree/experiment/soft_body_inherits_from_body has the most complete implementation at the moment (but it is very much WIP) |
That's awesome! Can't wait to be able to use it in my engine. Is there a roadmap for this? I'd love to follow every development step of this feature. |
I'm hoping that in the next couple of weeks I will merge a first version into the master branch. If you want updates then just follow this issue. |
Awesome work! However I noticed some weird behavior, when shooting an object (B) they do affect the soft bodies but don't seem affected by them, is this normal? |
The ball you shoot with B use a density of 1000 kg/m^3 so weighs 4000+ kg. The soft bodies default to 1 kg per vertex so the soft body sphere is only around 160 kg, so it is not heavy enough to push the ball away. |
Seems legit 😄 however it would be nice to be able to change the density of thrown objects. I encountered an assertion failure when playing around (shooting convex shapes through the soft body cloth from the first sample), it seems to happen when a soft body pushes away another body. |
I ran into the same assert. Issue is fixed now. |
A first implementation has been merged into the master branch: Things to be aware of with this implementation:
|
Hi, I want to see if the way this paper accelerates softbody is compatible with your approach. Video https://dl.acm.org/doi/10.1145/3528223.3530085 Sourcehttps://github.com/fire/preconditioner-for-cloth-and-deformable-body-simulation |
Thanks for the link! I'm using XPBD, which solves the linear system using a very simple iterative loop. I think your article describes a different solution to the same problem (and maybe a more accurate one), but I don't think the two could be combined. |
hi,
soft bodies are useful for something like soccer and/or basketball nets, cloth, roaps, etc.
it would be cool if jolt supports it.
thanks for such an awesome physics library (I am still learning it, and its code is well organized, written with good comments, etc) and for your generous time that you devote answering questions and helping others.
The text was updated successfully, but these errors were encountered: