Thursday, July 26, 2012

Hair Script - Progress #6 / What ever happened to that hair script?

Is what I'm sure you're wondering.

I'm still working on it, but I ran into a problem that, for the longest time, I had no idea how to solve.  I asked for help on CGTalk, but no one ever responded.  Here's how far I got on my script before I ran into a titanium wall:

Create a UI (done for testing purposes, but as I add to/delete code, I'll update the UI to reflect these changes)
Duplicate the hair mesh, group it
If the hair is made of polygons, convert them to NURBS, group the NURBS
Get the surface curves
Allow the user to choose which way the hair is growing (if in the U direction, select all U spans and the leading V span.  If in the V direction, choose all V spans and the leading U span.  The leading span [or "root" as I've been calling it] is the span the hair grows from, and then the hair length follows the "growing" spans.)

That all works, and moving the original polygon hair and/or the updated NURBS hair effects the position of the curves perfectly, meaning, once the hair is rigged, you can animate the hair and the dynamic hair curves will follow.  So what's the problem?

If a modeler modeled a characters hair on one side, then mirrored it, the direction of the curves changes.  If they deleted the history then I'm SOL ("sadly" out of luck).

Note the image above.  Both of the highlighted spans are technically the U spans, but because one was mirrored, U now looks like V and V looks like U.  I've been looking for a way to automatically detect if the spans are uniform and heading in the same direction, but I haven't had any luck.  Then I figured I'd just go for a dirty solution.  I hate it, but I really don't have much of a choice.  My solution is to have the user select the pieces of hair where the curves were going in the wrong direction and press a Switch Direction button.  It would use the Reverse Surface Direction command, which is pretty self explanatory.  In essence, it will switch U and V spans and all will be right with the world.

This is what would have to happen in my Switch Direction proc:
Store the name of the curves, groups, etc. that have been created for this piece of hair
Delete EVERYTHING the script has created for this piece of hair so far
Reverse Surface Direction command
Recreate and restore the names to everything in the proper order
Make sure everything goes to the proper group

I looked in the GMH script that a reader recommended to me and got my hands on it.  It's a pretty darn fantastic script and I learned a LOT from it, but it has the same flaw mine currently has.  If the user mirrored some of their hair, the script will fail and there is no way to fix it.  But I THINK with the steps I outlined above, I can fix the problem.  Now that I'm getting a little more comfortable with Python, I think I can use a mix of MEL and Python to do this efficiently.

I think...

I'm open to thoughts and suggestions.


SIGGRAPH is a GO! 9 days and counting!

One months salary later and... it's official.  I'm going to SIGGRAPH this year!  Will anyone else be there?  I hope I get to meet some more hair/cloth TDs.  I'll be there from Sunday to Thursday and I plan to do as much as I can while I'm there.  I'm ridiculously excited!  I'm almost ready to go.  I just need to make sure everything on my list is checked off.

  • Finish new demo reel and upload it
  • Print business cards
  • Update Resume
  • Create a few self playing DVD's with my demo reel/other information in case someone wants it
  • Buy clothes that fit (yeah, I kinda lost 120lbs and my clothes situation is pretty crazy)
  • Print out everything I need for the flight, hotel and SIGGRAPH
  • Pack
  • Contact some studios/companies before hand and setting up an interview (done to a small extent)
  • Make sure my $$$ is in order

I'm cutting it pretty close with some of those things, but my schedule has been beyond intense these past few months so my progress with this has been slow.  Oh well.  I'll get it done.


Monday, July 23, 2012

Reposting: Brave New Hair

If you're interested in hair simulation at all, I'm begging you to read this article.  But be aware, there are one or two small SPOILERS.

I was very inspired (and intimidated) by this article.  There's so much I have to learn and getting a job where people know this much would be amazing and terrifying.  Well, that's the fun of it all, isn't it?


Thursday, July 5, 2012

Cloth tutorial - Cloth Attributes Explained

nCloth Attributes Explained

I think this document was created by a man named Joel Stutz, but I'm not sure.  If I'm wrong, please let me know and I'll make any necessary corrections to this post.

He created a document that explains what 95% of the nCloth attributes are and what they do.  If you're an nCloth novice, or if Maya's help docs are confusing to you, I highly implore you to read it.