Anim8or Community

General Category => ASL Scripts => Topic started by: Navek on February 24, 2011, 02:42:58 am

Title: Facial Rigging
Post by: Navek on February 24, 2011, 02:42:58 am
Recently I've started playing around with controller scripts. As a little side project I've been working on a way to get around anim8or's bone system, which I've always had some trouble with.
My solution so far is to come up with a way to use morph targets that can be controlled in real time without the need to input values into boxes. By using "controller objects"(the little green circles) I think I've managed it pretty well. The result so far is just a face rig along the lines of something i saw in a blender tutorial, but i hope to expand it to a full system soon.
Its a pretty simple system once the scripts are in place. By manipulating the "controller objects" (moving them if they have up/down points, scaling them if they have horizontal points) one can change the value of the morph target, thus changing the shape of the face.

The An8 files attached bellow for anyone who want to take a look, comments/suggestions/criticisms would be much appreciated.
Title: Re: Facial Rigging
Post by: neirao on February 24, 2011, 05:02:39 pm
hi Navek  :D

you are a genius!!
amazing idea! very helpfull! :o
Time ago i send a suggestion/request like this, but nobody could implement!
my old post( SCRIPT REQUEST: Object to Influence points)

thanks for share this! :)

Title: Re: Facial Rigging
Post by: headwax on February 25, 2011, 01:28:40 am
hey  nice work you are a  genius :)
Title: Re: Facial Rigging
Post by: Janro on February 25, 2011, 03:10:38 pm
This is... amazing. Indeed reminds me of Blender and other programs out there.

Now if only this method can be applied to a body with a head attached. Is it possible to apply something like this to an existing figure or would there be a need to tweak the model in ways to facilitate this (such as the eyes)?
Title: Re: Facial Rigging
Post by: neirao on February 25, 2011, 09:01:27 pm
we can too switch the controls for "Targets"
this way,  in render the targets automating are "invisibles"  :)
Title: Re: Facial Rigging
Post by: 3D Joe Wiltshire on February 25, 2011, 10:26:29 pm
Cool system and it actually works! Never tried faces cause of rigging issues but this might help me give it a go!   Will probably help with phonetic timing or whatever aswell if you can make one with an open mouth! :D
Title: Re: Facial Rigging
Post by: Navek on February 25, 2011, 11:01:44 pm
Thanks for the support everyone.
neirao: Thanks for showing me your topic. I'm hoping to eventually have a script that acts much more like the one you described, but i think thats still a little beyond me.
Janro: It should defiantly be able to be applied to an existing figure, the only change that should needed is to make the morph targets you want to be controlled. then all you have to do is in scene mode add an object to be a control, then enable expression for the morph target and input either of the scripts.

For moving to change value:

point3 $alpha;
$alpha= GetAttributePoint3("[the name of your control object]", "position");

$morph.[name of your morph target] = ($alpha.[axis you want move the object]-[current position of your object])/4;

For Scaling to change value:

$morph.[name of your morph target]  = GetAttributeFloat("[the name of your control object]", "scale")+1;

Note: the /4 and the +1 on the end of both the scripts just effect how much of a change to the objet is needed to make a change to the morph target. it takes some tweaking to get right.

3D Joe: I wish I'd had a model with an open mouth, but I'm not the greatest at modeling faces. I made that one awhile ago in sculptris (it took me forever!) and, as you can see, only got about half way through doing re-topology in blender.
Title: Re: Facial Rigging
Post by: Janro on March 01, 2011, 04:22:48 pm
Oh... I'm DEFINITELY gonna try this one out :D This will make lip syncing so much easier!

I'll report back my findings and eventual results.

Title: Re: Facial Rigging
Post by: Maximilianibus on March 19, 2011, 04:12:54 pm
i made a test:
Title: Re: Facial Rigging
Post by: daniel99 on April 02, 2011, 12:03:23 pm
Great ideea. I usually use this graphing (don't know it's name) and it works well.
Hope to see your project finished soon.
all best.

Title: Re: Facial Rigging
Post by: davdud101 on April 09, 2011, 01:15:26 pm
Navek, this is officially the high point of my day. I'm actually learning Blender, and I can't get around trying to use all these hotkeys. But I've seen in tutorials how there are controllers and stuff for facial rigs. This is really cool, and you're pure GENIUS!
Title: Re: Facial Rigging
Post by: Janro on April 11, 2011, 03:06:52 pm
This is working marvelously for me so far.

Ok I've got one hiccup I need to fix and I don't know coding(in general nor ASL specific) to solve my problem. My fourth year highschool's C coding is the closest I got. And I barely remember it.

So for now I've rigged my eyes to morph and react to the placement of the target.

Morph Up
Morph Left

It works marvelously when I move the controller in that quadrant. However when I move it to the right and down it doesn't work since morph targets here go in a straight line.

Anyway to set the morph to zero for my Morph Up/Left and transfer it to Morph Down/Right? I've tried toying around with If statements but I'm not getting anywhere.


So I finally had time to do a quick animation with a simple facial rig (minus cheeks and follow through for ears,)


Feedback: This really quickens the time moving about morphtargets. :D It's amazing.
Title: Re: Facial Rigging
Post by: neirao on April 13, 2011, 10:43:04 pm
excelent your facial rig test janro!! :)
Title: Re: Facial Rigging
Post by: Janro on April 14, 2011, 10:31:34 am
Thanks ^^

Another thing  I like about this is that it saves the keyframes on another layer so to speak for morph targets. So now when I need to do lipsynching, I can tweak both the facial expressions and movements of the body independently.
Title: Re: Facial Rigging
Post by: Navek on April 14, 2011, 11:32:25 pm
The test looks great Janro! I'm glad this is actually being helpful to people! As for your question about the eyes, with mine I made the eyes separate objects and changed the orientation to 'Facing Other' so no scripting required for that. However I am working on updating the script so that limits can be set and so that multiple morphs can be controlled with one control object. Hope to have that up soon.
Title: Re: Facial Rigging
Post by: Janro on April 16, 2011, 09:09:50 am
Yeah I understood that it was a seperate object. Since my eyes are attached to the figure the same method couldn't be used. Though I guess you guessed that already.
Title: Re: Facial Rigging
Post by: Navek on April 20, 2011, 01:47:17 am
ahh, I missed that sorry. I'm hoping to have that updated version up by the end of the week, I'm still messing around with 'if statements' and making the whole script look user friendly and not like a pile of code!
Title: Re: Facial Rigging
Post by: Janro on April 21, 2011, 10:55:33 am
Awesome! I can't wait. My attempts at coming up with the if statements myself failed miserably. XD  Thanks for this Navek!