Obi Particle Based Physics (Cloth, Rope, Fluid) thread

EDIT:

This is a long thread covering all updates on all Obi Assets currently available on the asset store.

See all of them in our website: http://obi.virtualmethodstudio.com


Hi all!

I´ve been working on this:

<<-Video not available anymore->> Find our youtube channel here: https://www.youtube.com/c/VirtualMethod

It´s a full implementation of the original paper (Matthias Müller) that spawned the old PhysX cloth, adding a few improvements on the way: triangle-based bending constraints instead of dihedral angle constraints, better friction model, better self-collisions, virtual particles for rigid body collisions just to name a few.

I really needed to get the old cloth physics working in Unity 5.x for a project i’m developing so I hope this will help those with the same need. Will be available on the Asset Store in a few days for a low price (around 20$) and with full C# source included, i’m just finishing up the documentation and tidying up things.

Suggestions are welcome, my current roadmap for this in order of priority is:

  • Multithreading

  • Ability to drive a transform using a particle or group of particles.

  • Proxy lattice system to drive hi-poly meshes using a low-poly simulation.

  • Rope physics with LRAs (long-range attachments)

Cheers!

19 Likes

Well if you need it stress tested on about 200 objects in a sailing game, count me in!

1 Like

Well that is a good stress test indeed!. We’d probably need some sort of simulation LOD system to accomplish that though. Not a good idea to simulate all 200 sails at full detail even if they`re all at once on screen.

Adding that to the roadmap! :wink:

Looks awesome my friend keep going!

looks good, quite a few people need old cloth back, that can simulate with wind… including myself

I will be interested how it handles double sided meshes. The current U5 cloth just craps out on the double sided normals and makes the cloth go completely screwy.

When you talk about double sided meshes, are you referring to “thick” double sided meshes as in two sets of faces with normals in opposite directions, or a double sided material for a single-sided mesh? If it is the latter, there’s a double sided version of the Standard shader included that reverses normals for the backfaces, meaning you get correct lighting on both sides of your mesh.

Having double sided meshes (“thick” geometry) simulated as-is is no good: It means twice the geometry and forces you to have self-collisions turned on to avoid interpenetration, which skyrockets the computational cost. You could use a single-sided mesh simulation as a proxy, using its results to drive the movement of an arbitrarily complex mesh. That ability will come in an update.

1 Like

You can make a mesh with the faces on both sides so it is still a single set of vertices but two faces. Mind you, I am not a modeler but the modeler for our group showed me how that worked with normals going in both directions of a face. Knowing the computation cost on using two distinct faces, there is hardly another option since all of the single sided shaders that render double sided do not allow for things like SSAO to work since it renders right over them. A lot of those post process effects will render on top of the backside of a single sided mesh with double sided shader so it just kills any cloth rendering. Example: http://puu.sh/ilvza.png

I was able to get our bidirectional normal mesh to work, but the built in Unity cloth component split it up into two separate meshes and made it go completely crazy. Static, however, it looks great because it does not allow the SSAO effects through the object.

Wow, that sounds a lot like non-manifold geometry. Which is bound to cause problems in a lot of rendering and simulation situations.

I would recommend doing the following: assign two materials to the same mesh: one renders front faces, the other renders backfaces with flipped normals. Most “double sided” materials actually do not flip the normals, so a lot of lighting/shadowing computations (like SSAO) look funky or just stop working. I can do this for you if you want, test it out and tell me the results.

Here. This is a Standard shader variation that automatically renders back faces with correct lighting/shadowing. Haven’t tested it with SSAO but should work fine.

www.josemariamendez.com/storage/BackfacesShader.zip

Grab any single-sided mesh, set the Materials array size to 2 in the editor, and assign a material with this shader to the second slot. The first one should be your regular front-faces material.

This also allows you to have completely different looks to your front and back faces.

1 Like

Great, thanks! If this works then I will have to get the Rust team to add it to Alloy since that is how we are doing the transmission shading on the sails.

1 Like

That is closer than I have been so far! Now to just get that function working in Alloy and it will be good to go.

1 Like

Great! I haven’t used Alloy, but the theory should be the same: two materials, a regular one and a second one that renders backfaces (Cull front) with the normals flipped (multiplied by -1).

Hi
I can apply the physical fabric of the bottom of a jacket with this tool?

Yes you can. Just assign a cloth component to the jacket and pin those vertices that you don’t want to simulate.
Once the tool is out (currently being reviewed) I will publish a few tutorials explaining how to perform common tasks with it.

1 Like

Magnificent, i wait this asset:)

Oh my. I just spent a week creating a procedural bone-based system to simulate ad-hoc cloth vertex anchoring the way it was done in <5.x with attached colliders. And it’s really shoddy. So I’m going to be heavily on board with your plugin the moment it’s out.

@daterre … it came out yesterday.

Hi everyone,

The plugin came out yesterday as Hopeful just pointed out, though an update is already on its way. The update features:

  • Adjustable world velocity scale, so you can fine tune how much of the character movement translates to the cloth. This is a must have for character clothing, so there you go.

  • Independent solver iteration amount controls for each kind of constraint. This allows you to solve stretch constraints 5 times per frame, while solving bend constraints only 2 times, for example. The solver automatically interleaves them so no biasing is introduced due to evaluating each constraint a different amount of times.

  • Parallel constraint solving mode (warning: nothing to do with multithreading!), which cranks up stability, at the cost of convergence speed. Sequential mode (which most solvers use) is available too.

I´m at full speed writing documentation and examples/tutorials now!

Good job arkano22 on this cloth asset! It would be a great addition to my game, but I got one question first: does it work with animated characters?

If yes, It would be cool if you could add simple skinned mesh renderer demo and show how to connect cloth vertices to it.