Jump to content

Wrap mesh around another object


Recommended Posts

Would it be possible to wrap a mesh around another one?  I'm thinking of cloth here.  So if you put a dress on a girl and parts of the dress are too small and go into the waist, you'd be able to programmatically push those vertices outwards so they are not inside the mesh.

Is this possible?

Link to comment
Share on other sites

Hi again OzR, good to see you.  Slow replies, eh?  I delayed THIS reply by 16 hours... just to see if smarter people than I... would reply.  :)  You already know that I'm more talk than action, and I'm often wrong/mis-directioned.  But what the heck... I'll throw some opinions at ya.  My PM buddy @gryff, author of the BJS "Blue Lady" demo (and many other great demos)... might have some good info, too.  He stands pinged.  :)

Physics cloth is the way to do this.  Physics particle/point impostors not only ATTEMPT-TO escape collision with meshImpostors ON THEIR OWN (without needing a VERY INTELLIGENT algorithm to avoid cloth-body overlaps), but they will also provide cloth hang-weight and flow-yumminess.  But, have you got a Cray XMP5 or Silicon Graphics Onyx?  :)

SOME of the problem is with... WHERE to be skin-tight, and where to be looser-fitting... all on the same garment.  Mesh-skinning on skeletons... uses weightedVertices to determine what will happen to Suzy's sloppy cellulite hip flab... should her skeleton/bones attempt to do a sit-up.

Ideally, your garment vertices should also "listen-to" bone transformations.  In a way, a garment is a second layer of skeleton skinning... yes?  But with things like dresses, and even pants, the fit is often tighter in the waist, butt and crotch, but looser towards the bottom. 

Have you seen the Blue Lady demo on the BJS main site?  I think it uses bone-transformation-listening weighted vertices to make her dress fit/move rather nicely.  But there is no physics involved there, so the dress cloth won't flow/swing correctly when she does unexpected moves or when the winds blow.  It fits well, but it doesn't "act" like cloth.

Many of the "better" cloth and hair sims (physics-active/weighted flowing things) that we see from time to time... are rendered to video.  The playback shows smooth flows, and it looks great.  But doing that in real-time (non-video)... with the physics reacting to mouse moves, and lots of points/resolution in your cloth for max "liquidity"... that is asking a lot of a computer, JS-based or not.

And, PLACING the cloth on the body will be tough, too. Then having overlap detection and correction code, while still honoring the garment's tendency to fit tighter on the top, looser on the bottoms, wow, that would be one hell of a project.  It would almost be wiser to REQUIRE Spandex-like skin-tight clothing on all your models.  :)  Essentially, paint-on clothing.

Sorry if this all seems like bad news.  But I have watched you perform some "holy crap"-level miracles with BJS, so you certainly have a reasonable chance at doing this, too.

These are some of the issues.  But there are MUCH smarter people than I... for this subject.  Let's hope they give better advice.  Be well.

Side Note:  Attention all BJS forum users:  Be sure to help others... whenever you get a chance.  Thanks!

Link to comment
Share on other sites

Thanks for the wise words @Wingnut 

If I have separate clothing on an animated avatar  I always rig the clothing with the same skeleton so it moves with the avatar.  I'm trying to avoid physics cos its too  heavy on the processor.  I'm not expecting anything perfect, but if I had a guy wearing a shirt and I wanted to make the guy a bit fatter then I want the shirt to increase in size as well.  Actually I made a little demo here http://punkoffice.com/measurements/  for dynamic bodyshapes.  I could probably apply the same changes to the shirt.

Link to comment
Share on other sites

*nod*  Very good!  Yeah, I was a bit off-topic, sorry.

Have you done some time in 3DSMax?  Back in the 30's when I worked with Max alot (wink)... vertex selection was "the deal".  If you could highlight ONLY the points that need adjusting, then you had a chance at scaling ONLY those points.  The "vertex selecting" panel was quite a monster.  See all those choose-able selection-type buttons at the top.  Select by face, by edge, by cross-section, by vertex, all different ways of selecting.

You would need the same sort of thing, I guess.  Once you can select ONLY the points that need adjusting, THEN you might be able to apply scaling.  Not easy, I don't think.

In a way, I guess you are seeking an automated "overlap finder and corrector"... and/or a "too-close-to-overlapping finder and corrector".  :)  Something that iterates thru all the clothing verts, and checks how near they are... to the adjacent "skin" point "beneath" them.  Phew.

That's SO FAR over my head... that it's a hazard to aviation.  heh.  Sorry.  I hope I didn't screw-up the thread by sticking my nose-in.  :)  Nice tool idea, though.  I hope you/others can create something that works.

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.

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.


  • Recently Browsing   0 members

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