#Positions Based Dynamics in Unity

1 messages · Page 1 of 1 (latest)

stuck saffron
#

I'm in the process of writing a PBD engine for unity. The current focus is softbodies simulation. The ultimate goal is PBD driven softbodies and fluid simulation that play nice with unity's built in physics.

#

Above is a tetrahedralized icosphere mesh that is animated with PBD.

The main idea is that each object contains a set of particles and a set of constraints. Each vertex is a managed particle. Forces are applied to particles and their positions are then updated.

Once the new positions have been set, the constraints are projected one after the other.

In the joined video, there are 2 types of constraints. A distance constraint which measures the distance between 2 given particles and tries to maintain that distance, and a volume conservation constraint which measures the volume of a tetrahedron and tries to conserve the volume of said tetrahedron.

More precisely, there is a distance constraint for every edge and a volume conservation constraint for every tetrahedron.

stuck saffron
#

Here's a clip of the stanford bunny having the time of its life!

Compliance is basically the inverse of the typical stiffness parameter. Edge Compliance defines how strictly edges constraints are enforced. In the clip, you can observe the bunny's softbody behaviour change in function of the compliance value.

The next element on the roadmap is collisions with kinematic primitives, and wrappers to sample the matching unity colliders.

stuck saffron
#

1 way collisions with spheres!
First half is stiff bunny, second half is soft bunny

stuck saffron
stuck saffron
stuck saffron
coral hinge
#

Very interesting and cool. Are you using compute shaders or doing it in the CPU. Do you think such a system would be suitable for character clothes simulation? Are you planning on going open source or selling it as an asset?

stuck saffron
# coral hinge Very interesting and cool. Are you using compute shaders or doing it in the CPU....

Thank you!

No optimizations whatsoever in the current state. Plan is to go burst/jobs. This is essentially a tool to use in my hypercasual/midcore games and CPU is, more often than not, under-utilized in my games.

Yes, Matthias Müller, one of the founding fathers of PBD developed many, many cloth sims.

Vellum in houdini is made with PBD. Obi the unity plugin is based off of PBD as far as I know.

Joined a little example. This is using the same configuration as the other clips above so it's not great. I put it together with what I had, but cloths require different things. Typically cloths have no volume preservation to worry about, so tetrahedralized meshes are not a great design, and cloths also have self collision to be concerned about. None of this is present here. Maybe I will get around to doing cloths at some point but I admit I find it far less interesting than softbodies/fluids/ropes.

Eventually I will release this open source, but it might take a bit.