Search Unity

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

Discussion in 'Tools In Progress' started by arkano22, Jun 30, 2015.

?

Performance vs compatibility

Poll closed Oct 9, 2015.
  1. I don't care about performance, keep my data intact please.

    0 vote(s)
    0.0%
  2. I don't care if I have to re-do some stuff, as long as it runs faster.

    14 vote(s)
    100.0%
  1. Billie391

    Billie391

    Joined:
    Mar 16, 2019
    Posts:
    1
    Hi, Why can't I edit skin radius and all the other parameters about skin in Particle editor? I use Skinned Mesh Renderer and have activated the Obi Skin Constraints both in the object and the solver. Could you help me?
     
  2. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    JUst want to drop by to say Thanks again for that tools. Even though I still barely touch it due to other R&D stuff!
     
    arkano22 likes this.
  3. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,929
    Make sure that the ObiCloth component is added to the same GameObject that contains the SkinnedMeshRenderer, and that the SkinnedMeshRenderer contains actual skinning data (Unity will generate it automatically for you when instancing any object with skeletal animation). Only then will the skin constraint per-particle parameters be editable in the particle editor.
     
  4. GWStudio

    GWStudio

    Joined:
    Sep 27, 2016
    Posts:
    109
    hi everyone i keep getting these errors :
    Can't remove ObiTearableCloth (Script) because ObiParticleRenderer (Script) depends on it
    Can't remove ObiDistanceConstraints (Script) because ObiTearableCloth (Script) depends on it
    Can't remove ObiBendingConstraints (Script) because ObiTearableCloth (Script) depends on it
    Can't remove ObiAerodynamicConstraints (Script) because ObiTearableCloth (Script) depends on it
    Can't remove ObiPinConstraints (Script) because ObiTearableCloth (Script) depends on it
    using unity 2018.3.11 with obi cloth 4.0.1 .... another Q how to make cloth not collide with specific collision layer or tag.
     
  5. jose_pedro_didimo

    jose_pedro_didimo

    Joined:
    May 2, 2018
    Posts:
    15
    Hi, I am facing weird issues when using a proxy to drive the simulation on a garment with pockets and belt loops.

    Could you provide guidelines to try to solve (prevent) these issues at modelling stage, and any other advice?
    The skin map editor is very simple and the tutorial hasn't helped much further.

    upload_2019-4-12_16-30-41.png
     
  6. jose_pedro_didimo

    jose_pedro_didimo

    Joined:
    May 2, 2018
    Posts:
    15
    Just leaving a note that we ended up developing our own proxy deformer to overcome this issue. You can consider this issue closed for us.
     
  7. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    Just bought the asset today after staring at it for a couple years.....lol. Finally needed to get tearable cloth back for a project that I am working on.

    Any advice on how to get a simple Cardboard/Paper target? The tearable cloth in the sample scene I cant seem to get it to act stiff like a piece of paper/cardboard target. it is too "thin" and "springy/flexible".

    Here is what I am trying to do. This is a video of a prototype I made many years ago...
    but I def want to make it a little stiffer and more cardboard like.

    I think I have made a way to determine if the player has shot out all of the red star.... but first I have to get the cloth working. :)

    Thanks for any advice anyone can help with.

    Kevin
     
    arkano22 likes this.
  8. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    I cant get any example to act like a generic piece of cardboard/paper. Why is everything set to max 1 and still "stretchy" and "bouncy" for the defaults? Adjusting the "Iterations" and "Relaxation" is like feeling around in the dark and is not at all intuitive. Is there somewhere with at least some starting points for different types of cloth, paper and textiles? Anything?

    And am I crazy or did I pay $47 bucks for an asset that was $19 a week ago? I had it in my shopping cart for a month and never bought it @ ~$19.00 (With Pro Discount). I came back to buy it a few days ago and it was $47 now?
     
  9. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,687
    It might have been in the May Madness sale.
     
    arkano22 likes this.
  10. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,929
    Yep. It was included the May Madness sale. The Asset Store simply gives developers the choice to opt in or out of a sale, if the developer chooses to participate they reduce the price during the sale and then automatically reset it to the original price after the sale ends. The normal price is 47$ and has been for quite a long time. I'm not a fan of randomly changing the price of an asset, in fact I try very hard to squeeze in new features for free.

    Regarding stretchiness and bounciness, this is something common to all iterative solvers in existence (which pretty much account for 100% of all game engines, including both Obi and Unity's physics engine). Low iteration counts abort simulation before it has converged to a solution, and this "error" shows up as stretchiness. Some other engines simply blow up or become a jitter fest at low iteration counts (ever tried to make a chain/rope using rigidbodies and joints with Unity's default physics settings?), but Obi keeps things nice. See: http://obi.virtualmethodstudio.com/tutorials/convergence.html
    http://obi.virtualmethodstudio.com/tutorials/obisolver.html

    Cranking up the amount of constraint iterations and/or substeps improves convergence speed, and the solver will be able to reach higher effective stiffness.

    I know Obi exposes very low-level parameters, and it assumes quite some previous experience with physics engines. It's the only way to give the user control over both performance and quality, so the result can be fine-tuned for each use case. Exposing "presets" for cloth types/textiles works for offline simulators where a slight performance hit is not the end of the world. But when your budget for simulation is maybe 3-4 ms/frame you need to know where each processing cycle is being spent and why.

    No one wants their artist to increase the stiffness of a cloth and suddenly get a massive fps drop, with no clue of what the engine is doing under the hood. So a "stiffness" parameters of 1 for all constraints tries to get things as stiff as possible, within the current iteration budget. More iterations will allow to reach better quality (i.e, less stretchy) simulations, at the cost of performance.

    In your specific case, setting substeps to 2 and/or increasing the bending constraint iterations to 6-8 might get you closer to your desired result. Both parameters can be found in the ObiSolver component.

    PD: quite some time ago I wrote an article about convergence and iterative solvers. Some of it made its way back into Obi's manual. You can find the original article here:
    http://blog.virtualmethodstudio.com/2017/11/physics-101-3-solvers/
     
    Last edited: Jun 4, 2019
    devotid likes this.
  11. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    Thank you for the explanation of the pricing.

    I have been using Unity hinges and the old cloth system for over 7 years in productions games and I thought this would behave like the old one and I simply found no way to get it to act like paper or any stiffness at all without cranking the damping. (and thats not very realistic cause it works so slowly).

    Its no big deal... I think I was I was expecting too much of the plugin. It simulates AMAZING Stretchy Cloth and thats how you advertise it. So I just assumed that I could make it act like stiff paper and then tear it.

    So I have abandoned using ObiCloth for now on this game and will just use it later in the game for something else. I have some cool fun ideas that come to mind. :cool:

    For the Machine gun Carnival Game I ended up using a raycasting/Quad decal system and then scan a Png screenshot of it and check for "red" pixels. Seemed to work fine as I am not Zoomed in as much as I thought I would be.

    Here is a little vid of the target system I used...
     
    Last edited: Jun 5, 2019
  12. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,929
    Hi!

    Afaik, Obi's underlying physics paradigm is exactly the same used by Unity's old cloth (position-based dynamics), only with more exposed controls. After all, it was initially created as a replacement for it. Increasing the amount of substeps (roughly equivalent to increasing solver frequency in the old cloth) allows stiffness to go pretty high... here's a video of something akin to a thin metal sheet in ObiCloth:



    Anyway your solution looks darn good, and is cheaper performance wise. So it was the right call imho.
     
    devotid likes this.
  13. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    Ok..... Now that is pretty close. Thank you very much for the reply. :)

    I have moved on to using Obi for some cool clothing and goodies for the main characters. This could get out of hand. lol

    Kevin
     
    IsDon likes this.
  14. Tomza

    Tomza

    Joined:
    Aug 27, 2013
    Posts:
    596
    Hello,

    We are considering to buy the Obi Cloth asset. Please tell me if I can import any cloth mesh and make it working with your asset. And can I resize the cloth at runtime and fit to the body mesh. It is important. In general, I'm interested in functionalities that can be done at runtime.
     
  15. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,929
    Hi,

    Only 2-manifold meshes are supported. Also, cloth cannot be scaled at runtime, in the sense of applying an affine transform (since deformable objects are not rigid, so rigidly transforming them does not make sense).
     
  16. PROTOFACTOR_Inc

    PROTOFACTOR_Inc

    Joined:
    Nov 15, 2009
    Posts:
    4,054
    Hi, Considering the purchase of OBI Fluid. However i have a few questions that I need to get answered before pressing the trigger.

    Can Obi Fluid interact with unity terrain or not? I tried looking on the forum but didn't see anything. There was an older review title saying "terrain not supported" so not sure what to understand.

    Thanks
     
  17. amoka

    amoka

    Joined:
    Dec 18, 2015
    Posts:
    58
    Hi, I am also reading about OBI Fluids before choosing a tool to buy.

    Is OBI Fluids deterministic in a way that the subsequent plays of the simulation will have the same fluid motions? I need this for an offline video renderer which requires to do a second run for saving alpha channels separately.
     
  18. freenomon

    freenomon

    Joined:
    Mar 21, 2019
    Posts:
    35
    Hello Arkano,

    My boss bought me Obi cloth and I finally got to try it out with some cloth and colliders. For the most part I really like it. I wish it could use a regular skinned mesh collider but I guess for performance that's impossible.

    Now, when I increase the particle numbers to 10,000 and use a heavier mesh, the fps drops quite a bit.

    Is there a cpu that you recommend that would increase it's performace? I currently use an i7 6580k with 6 cores.

    If I were to get a higher core CPU (12 or even the 32core Ryzen) will the performance increase a LOT more as to make my purchase of a new CPU worth the cost? Will it go from 10fps to 30-60fps?

    btw, I am using Unity and obi cloth to make 3d animations and not games, so I don't need real time. I just want faster performance.


    Any plans on making obi cloth GPU based? I've seen some incredibley fast GPU cloth..on regular body deformed collider


    thanks

    KC
     
  19. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    @arkano22 Would you be able to add a feature for characters that allows the softbody physics to be determined by the character's default weight painting?
    What I hope to use it for:
    • See realism in each footstep like a shock wave ripple through muscle and Fatty tissue- more obvious on large characters.
    • Be able to put animated objects inside the character such as animated lungs, heart, veins,Muscles or even another creature or hand moving inside pushing out. If there is a threshold where the skin breaks from either inside or outside things like gunshot damage or a medical operation with a cavity added with organs etc would be pretty decent.
    I've made this request on the reallusion feedback tracker recently and talked with support and they seem to be very interested in developing this. People only have a limited number of votes they can use up so it's rare that people vote even if its ideal. https://www.reallusion.com/FeedBack...reas-are-to-determined-by-weight-map-painting

    Anyway if you can help out with this it could help create a solid pipeline for realism.
     
  20. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,929
    Hi Ascensi,

    You can already have parts of animated characters "wobble" based on vertex-painted values. Many games do this. You can achieve it with ObiCloth, and there's also less performance-heavy (also less detailed) alternatives in the store, like VertExmotion.

    The other ideas are good, if very technically challenging. For things like hands visibly pushing out from the inside of a character, you'd need both crazy high mesh resolution (higher than any current gen engine can reasonably support for a character) and extremely detailed collision detection/resolution. Obi, being a particle-based physics engine, uses particle-based contact resolution, which is nowhere near enough for this task. You'd need mesh-mesh continuous collision detection and patch-based contact resolution, both of which are very expensive in terms of performance.

    When talking about breaking the skin, that's also quite complex as it involves keeping track of and updating the mesh topology as it tears. New mesh data (uvs, normals, tangents, bone weights, etc) would have to be derived for newly created vertices which is not trivial at all, and again, pretty expensive. If you look at out Obi Cloth plugin, you'll see that tearable cloth is quite limited as it can only be torn at existing topology edges. This is to keep topological changes to a minimum, but results in artificial-looking edges unless you have crazy high mesh resolution.

    We'll eventually get there, but imho there's just not enough spare processing power in consumer-grade devices yet to justify having these things in a game.
     
    Last edited: Sep 13, 2019
    Ascensi likes this.
  21. anomas

    anomas

    Joined:
    Jul 3, 2016
    Posts:
    47
    Hi i have the old version of Obi Cloth(before it became a new asset and required a new purchase) and am considering buying the upgrade but i'd like to know if anyone had any experience with UMA2 and Obi Cloth. Does it work at all?
     
    Last edited: Sep 14, 2019
  22. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    Thanks for the info! I think the holes could be done with a screen space effect but I've seen meshes rip like nothing at various points with the cloth physics without having to recreate new normals, or vertices, bone weights etc well yes new bone weights - another texture that acts as a mask to deform a particular area.
    This currently works in iClone's cloth physics but I can apply that to a character as well and it's skin can tear off and tear off in areas not pinned and looks real enough but yes the mesh density has to be thick.. tessellation works. In regards to hands moving inside, I'd only have hi res contact points or tessellation, not the whole model being made physically dense or if the model isn't going to be visible and stay in inside maybe just collision data. Anyway thanks for considering it.

    On a side note, here is an idea that you might like to adapt to your fluid system using screen space collision.
    Perhaps to increase density/performance even further some of the particles could potentially be screen space as well perhaps in the center.


    It doesn't seem like the developer has an plans to release it.
     
  23. DigitalAdam

    DigitalAdam

    Joined:
    Jul 18, 2007
    Posts:
    1,211
    @arkano22

    Hey, so I'm creating a VR game in which the player can move cloth around, such as drapes and a tablecloth. What do you recommend as far as settings for a tablecloth, say I would like the player to be able to either reach their hand underneath to lift it up or possible pinch and grab to do see what's underneath?

    Thanks!
     
  24. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,929
    Well, you can simulate rips/tears in texture space, or screen space, but these aren't actual physical tears, so there's no need to involve the physics engine in that. If you want the actual geometry to be torn, you need to update its topology, no way around that.

    Also, screen space collisions for a fluid physics engine is not a good idea at all since you also need to consider offscreen contacts. Screen space is good enough for eye candy systems with lots of independent particles that only collide with the scenery, that's unfortunately not our case. We need to consider offscreen contacts, backfacing contacts, inter particle contacts, etc. (we do perform all fluid rendering in screen space, though).
     
  25. mrinali1

    mrinali1

    Joined:
    Feb 25, 2019
    Posts:
    2
     
  26. mrinali1

    mrinali1

    Joined:
    Feb 25, 2019
    Posts:
    2
    I am importing the asset but it says dll could not be imported
     
  27. OnlyVR

    OnlyVR

    Joined:
    Oct 5, 2015
    Posts:
    55
    Hi arkano22,
    I am testing the latest version. I just started and have one question for now. I noticed that gravity works like in object local space. If I rotate a character then gravity force is still directed from head to legs direction, even the character is up side down. How can I set the gravity force in the word space?
     
  28. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,929
    Hi,

    Generally I do not check the Unity forums, question like this should be directed to support (because you'll get an answer quicker, you might not even get an answer here!).

    Gravity is expressed in the solver's local space. To change gravity at runtime simply do:
    Code (CSharp):
    1.  
    2. solver.parameters.gravity = <your gravity>
    3. solver.UpdateParameters();
    4.  
    In your case, you want to provide a world-space gravity, so:
    Code (CSharp):
    1.  
    2. solver.parameters.gravity = solver.transform.InverseTransformVector(<world-space gravity>);
    3. solver.UpdateParameters();
    4.  
     
  29. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,085
    For the new ObiCloth how do you change the scale of a plane mesh cloth from square to rectangular? It seems local space is no longer available in the Solver.
     
  30. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,366
    Anyone can show me velvet cape?
    I think velvet dampens the elasticity a lot. Obi is good for elastic cloth I believe
     
  31. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,929
    Increase the amount of substeps. You’ll get non-elastic cloth. In the manual you have a pretty in depth explanation of how the solver works and what iterations and substeps are:http://obi.virtualmethodstudio.com/tutorials/convergence.html

    Alternatively, if your cloth is attached to something, you can use tether constraints to eliminate stretching at virtually zero cost.

    cheers!
     
    Last edited: Jan 12, 2020
  32. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,366
    Now that's documentation!
    I was asking to see if buying this will allow me to render the cinematic all pretty without unity cloth assploding on me.
    Got some various example of cloth fabric?
     
  33. unitywlp

    unitywlp

    Joined:
    Jan 3, 2014
    Posts:
    146
    @arkano22
    I am trying to access individual particle and apply fade to to it using color, but was not affecting the color for some reason.
    i tried to go through documentation but documentation did not contain information related to that.
     
  34. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,929
    Hi there!

    There's a docs page dedicated to getting/setting particle properties:
    http://obi.virtualmethodstudio.com/tutorials/scriptingparticles.html

    To set the color of a particle, you do:

    Code (csharp):
    1.  
    2. // solver index of the first particle in the actor.
    3. int solverIndex = actor.solverIndices[0];
    4.  
    5. // use it to set the particle's color
    6. solver.colors[solverIndex] = Color.red;
     
  35. unitywlp

    unitywlp

    Joined:
    Jan 3, 2014
    Posts:
    146
    i tried this and its not working for me i am not sure if i need to change some settings.


    actor = GetComponent<ObiActor>();

    for (int i = 0; i < actor.solverIndices.Length; ++i)
    {
    actor.solver.colors[actor.solverIndices[i]] = Color.red;
    }
     
  36. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,929
    Works perfectly for me. What are you using this with? cloth, ropes, softbodies, fluids? How do you intend to visualize particle colors? keep in mind that only ropes pass the particle colors to the mesh vertices (and even then, you need to use a shader that actually supports vertex colors!). Fluids also allows to visualize particle colors, because particles are used directly when rendering the fluid surface. Softbodies and cloth don't because there's not a 1-1 correspondence between particles and vertices.

    Also, there's a support forum and support email, I'd prefer if you wrote there so that I don't have to be checking this forum too.
     
  37. Kubold

    Kubold

    Joined:
    May 10, 2012
    Posts:
    359
    Hi,

    The Cloth plugin works quite well for me, except I can't add another piece of clothing per character.

    I have a character with shirt and pants. If I add Obi Skinned Cloth and Obi Skinned Cloth Renderers to BOTH of them, the clothes freeze. I can either have pants or shirt simulated, both don't work at the same time. The shirt and pants are separate meshes.

    And that's a bummer, I also need to have hair and scarf on the same character :) How to add more than one skinned cloth to the same character?
     
  38. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,929
    Hi there,

    Known and fixed bug, the patch will be introduced in the next update. Replace Obi/Scripts/Cloth/Actors/ObiSkinnedCloth.cs with the one I'm attaching.

    let me know how it goes!

    Note: We don't look at the Unity forums often, you were lucky. Write to our support email or our support forum if you need further help! (http://obi.virtualmethodstudio.com/contact.html)
     

    Attached Files:

  39. Kubold

    Kubold

    Joined:
    May 10, 2012
    Posts:
    359
    Thank you, it works fine now.

    About the note: I beg to differ. Look at this thread, you seem to respond on every post here in couple of hours :) But I understand you prefer support e-mails for bugs and such, I'll use that next time. Thanks!
     
  40. Ibizanhound

    Ibizanhound

    Joined:
    Jun 20, 2014
    Posts:
    18
    @arkano22 Hello!!
    I just saw this really impressive muscle system and I thought you would be interested in it : )
     
    rrahim and arkano22 like this.
  41. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,929
    Thanks! the VIPER extension to elastic rods has been in my R&D inbox for a while :).

    Should be fairly straightforward to add to Obi rods, if somehow limited for use in actual games. I don't know much games that need to simulate their character muscles in realtime, and while undoubtably cool (and useful for other things aside from muscles), it takes away a huge chunk of your per frame time budget (10 ms/frame for a couple dozen objects is more than 50% of a typical 16 ms budget, and that's on a GPU implementation)

    So the question is: is anyone willing to spend resources for this in a game, and to what extent? (It has huge potential to speed up evaluation of offline character muscle rigs, however)
     
    Last edited: Apr 7, 2020
  42. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Glad this thread popped up... are you still developing Obi Cloth?
     
  43. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,929
    Yes, still at it. Currently porting the core engine to Burst, to make Obi compatible with any platform that Burst can compile for. Will also allow people to modify the core, and add new custom constraints if they wish to. :)
     
  44. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,048
    Just starting to work with OBI Cloth. Any reason I should not use Unity 2019.3.6f1 or newer?
     
  45. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,929
    Nope, should work just fine.
     
  46. Tarodev

    Tarodev

    Joined:
    Jul 30, 2015
    Posts:
    190
    Can't seem to find how to constrain a position axis like a traditional rigidbody. I must be missing some key documentation or something.

     
  47. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,929
    If you're looking for 2D simulation, there's a global toggle in the ObiSolver component.

    Otherwise, there's no built-in axial constraint controls in-editor, because unlike rigidbodies, deformable objects do not move rigidly as a whole. You can have some parts moving in one axis, and some other parts moving in another. Would not make much sense to constrain entire objects to specific axis.

    You can iterate over particles though, setting their positions/velocities as you see fit.
     
  48. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Fighting games for once, or hero moments/shots in other
    It's basically like hair/cloth simulation, if we can have it, life will find a way, but ultimately neither are that useful, they are visual candy, also next gen is happening.
    Also entire game can be based on their appeal, like gang beast style physical interaction, to have visceral visual impact.
     
    hopeful likes this.
  49. ibbybn

    ibbybn

    Joined:
    Jan 6, 2017
    Posts:
    193
    You could just drive blendshapes via bone rotation to get muscles to look more realistic. Like most movie studios do it. There's not really a need to simulate that kind of stuff more precise imho.
     
  50. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,929
    I agree that while for some very specific cases in which gameplay is heavily influenced by muscle dynamics, it can make sense. However it is a pretty expensive effect, and faking it (using blendshapes for instance) would look just as good most of the time.

    Not that we are not faking cloth or hair in current-gen AAA games: it is often just a bit of heavily hand-authored dynamics on top of a source animation. That's how Obi does it, and all other realtime cloth engines too. "Proper" character cloth, (with body-cloth collision detection, multilayered garments, etc) practical enough for its use in games, is still years away.