Jump to content

Cloth animation


jorditantadiaz
 Share

Recommended Posts

Hi @jorditantadiaz.  Take a look at THIS browser-bogging playground. http://www.babylonjs-playground.com/#1J3WEP#117

First, notice the demo uses CannonJS physics engine, and not the default Oimo physics engine.  (line 5-6)

CannonJS is currently the ONLY 3rd party physics engine for BabylonJS... that allows meshImpostor.

meshImpostor is how to get a physics impostor... that perfectly "matches" a complex shape such as a manikin.  So, your manikin MUST use a CannonJS meshImpostor... for its physics impostor (like I did with the torus knot... which is a complex shape).

Now for more bad news.  meshImpostors ONLY interact-with sphereImpostors!  OH NO!

Thus... notice I changed particleImpostor... to be sphereImpostor... for the cloth (line 53)?   I had-to.   When it was particleImpostor, the cloth drops "thru" the shape.

And notice the speed of the demo?  Browser killer!  :D  4-5 FPS?  Nod.

But, this is your challenge.  Cannon MeshImpostor on the manikin, sphereImpostor-based sim-cloth for your garment.  I don't mean to discourage you, but your hopes... are rather large.  :)

What you MIGHT wish to code... is a custom collision system.  Perhaps it will be much less powerful and detailed than Oimo or Cannon, yet it will allow you to place garments upon manikins with SOME body-contour-following accuracy (spandex).  But even then, garments and manikins are NOT simple bounding boxes, so simple mesh intersect testing/checking... is difficult.  Now if you want to use "weighting" on the entire surface of the garment (so you can see how a dress or sport coat "hangs" on a person)... you will need many many many weight points and calculations (for proper-acting clothing).

This is a big challenge for Javascript.  Interesting, though.  I figged I would tell you some little things about meshImposters and complex shapes.  Perhaps others may comment.  The "super-hero" move would be... get particleImpostor... working with meshImpostor  (deep Cannon.js hacking and native-method calls).  That would be essentially the same as coding your own custom collider/intersecter.  You would essentially be creating "CannonJS For Clothing"  ... also a big project, I suspect.  :)

I'm no expert, though, ok?  I could be wrong about anything, anytime.  :)

Link to comment
Share on other sites

Sps system might be able to pull off cloth.   One of my projects I wanted to do was soft body simulations in real time but have had like no time to work any any "want" projects...

let me know what you dig up in this area there would be a few ways to accomplish this.

Link to comment
Share on other sites

Hi @Deltakosh, i check it, Maybe not in depth, but i did it and i got similar problems when i do it with ThreeJS or WhiteStorm, and that is because i use a concave mesh + cloth effect ,and because according to what i investigate, cloth is only for plane geometry:

My problems when i do sometring like the demo are:

Mesh deformed
Collision with itself
And i need some controll on the behavior of the cloth effect

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...