Sunday, March 25, 2012

Hair Script - Progress update #1 (kinda)

I've been working on a hair script for a while, and talking about it even longer.  I guess this is a good place to officially start the progress report that no one will read.

I've been working on a MEL version and a Python version of a tool that I'm calling Hair Do.  It will take a modeled set of Polygon or NURBS objects and create a realistic hair style based on the look of these modeled objects, henceforth referred to as "patches".  These hair patches can also be rigged with this tool with the click of a button, allowing animators to position and animate the hair however they like, or they can leave the hair dynamic, or they can blend and switch between the two modes.  If the user decides they want realistic hair, it can be driven by the animated hair patches meaning if the patches are animated, the realistic hair will follow.

Hopefully I'll think of a more concise way of saying this.

I've been making real progress with the MEL... I've been chickening out on the Python.  I wanted to do this in Python to force myself to get comfortable with it.  I'm a sink or swim kind of girl.  Diving in the deep end of the pool is the fastest way to learn how to swim.  But when progress was slow I started to do it in MEL, then "translate" it to Python later.  Now, I realize I haven't done anything in Python for over a week.


I'll get back on it.  I want to honestly say I have a good grasp on Python if someone ever asks me.

So far, by the things I've crossed off my to do list, I'd estimate that my script is about 8% - 10% done.  I know that seems small, but there's a LOT of ground to cover, and that ~9% represents a couple hundred lines of code, so I can't complain.  I'm working super hard so that I can include a working version of it on my demo reel.  So far, I've come across two really difficult things.

1.  Converting polys to NURBS.   That in and of itself isn't hard.  You just do Polygons to Subdiv, then Subdiv to NURBS.  Then you can rebuild the NURBS object with a user specified value for the U and V spans.  It's making the end result look good that's making this whole process a pain in the... booty.  So far my results on semi-complex patches have been horrible at best.

2.  If the user wants to keep their polygon hair and rig it, I still need to figure out a way to automate the rigging process.  I think I have a solution, but it's still a pretty jumbled in my head. I think I can do this:

  • Use the method outlined in #1 to create NURBS surfaces, identical to the polygon meshes.
  • Create then extract the center curve of each NURBS surface.
  • Add/delete knots so that the number of CVs matches the amount of joints the user wants on their rigged hair.
  • Place a joint on each CV.
  • Smooth bind the joints to the polygon patch.
  • Delete the unwanted NURBS objects (or keep it, depending on other things).

Then my script will just pick up, doing what it does which is - make it possible to manually AND dynamically animate this hair, and make it possible to switch and blend between manual and dynamic mode.  Funny as it sounds, THAT'S the easy part!  But that bullet list just looks crazy to me.  There HAS to be a more efficient way of doing this.  I guess it doesn't matter as long as it works, but I'll keep looking into it.

Anyway, I've been up all night working on this.  I'll have come back to it with a set of fresh eyes.

Working with MEL all night on a Saturday night...
Pretty much.


No comments:

Post a Comment