Page 1 of 29
Bone morph dials script
Posted: Mon Aug 03, 2009 4:29 pm
I whipped up a quick proof of concept script for my idea of using bones as animatable morph dials.
I've uploaded a video of it in action on YouTube at AnimeStudioPro - Morph Dial Script Demo
and I'll try and post the lua and anme files when I get the chance.
Like I said in the puppeteer thread, it operates on actions (both single and multi-frame) and it's differential, so it's good for combining expressions and lip-sync with head turns. At the moment, it only operates on point and bone channels, but the bake button tool, which creates keyframes for the morphs instead of doing it real time using layer scripts, could theoretically operate on every channel.
What I really like about this technique is that you could do all your facial animation using a dummy head like this one and then create your actions on your final head later and substitute it in. I guess you could do the same thing with a bone rig, but it would have to be very complex meaning a much longer setup time.
I've also created separate functions for generating the morph weights and applying them. This means that it would be easy to plug in other scripts for generating the weights which use different types of bone control structures, like the puppeteer one for example. What I'd like to be able to do is use both kinds of control seamlessly together on the same bone layer.
OK, here are the "MorphDial" scripts as they currently stand:
http://users.on.net/~alexical/Anime%20S ... s_v0.3.zip (Updated 26 July 2011)
- Made bake automatically update current frame.
http://users.on.net/~alexical/Anime%20S ... s_v0.2.zip (Updated 17 June 2011)
- Made current frame even if all dials are set to 0.
http://users.on.net/~alexical/Anime%20S ... s_v0.1.zip (Updated 18 August 2009)
- Removed need for rt_gen_morph_dials.lua embedded script and now supports multi-threaded rendering with Anime Studio Pro 8.
I really wanted to do a few demos on how to use the CreateMorph button to tweak both single and multi-frame action morphs, but haven't had the chance yet. Hopefully, it'll be reasonably intuitive and you can always ask me specific questions on how to do something. Also, here are some other things that I think would be helpful to know...
1. The bone layer containing the morph dials has to be called "MorphDials" (by default).
2. The layers you want to control should be at the same level as the "MorphDials" layer. If any of them are group type layers then it's children will also be controlled. In theory, it's possible to control one "MorphDials" layer with another one, but it hurts my head to think about it.
3. The MorphDials layer needs to be embedded with "rt_gen_morph_weights.lua" and the layers you want it to control with "rt_apply_morph_weights.lua". Because you want the weights to be calculated before you apply them, you have to put the "MorphDials" layer below the controlled layers.
Other than that, hopefully the demos and the sample anime file will be enough to get you started. I have't done nearly as much testing as I would like, so any feedback would greatly appreciated.
By the way, I only tested these scripts for version 6.0, but it should work with version 5.6 without changing too much (probably just the collect_garbage() call in rt_apply_morph_weights.lua)
Posted: Mon Aug 03, 2009 7:03 pm
It sounds awesome!
I want to be beta tester! can I? can I?
I have a doubt, you said your script works with actions of more than 1 frame, how can that be possible? can you explain the process, please?
Thanks again, Rudiger. Your scripts are awesome.
Posted: Mon Aug 03, 2009 8:02 pm
Hehe, once it gets out of minus omega testing, you'll be the first on my list, Selgin. To be honest, I'm very eager to see what you could do with it.
If you watched the YouTube video, then you witnessed multi and single frame action blending with your own eyes, as the lip-sync animation was a multi-frame action, but the rest were all single-frame. It's actually very simple, at a given frame n,
where the W(n)s are the weights that comes from the bone morph dials and ActDelta(n) = ActPos(n)-Pos(0). If an action is only a single frame then ActPos will always be the same, otherwise, it'll be different for each frame.
This means you could have a Tweak action where you could make extra adjustments to the result of the morph at a given frame. With the help of another script, you could adjust the points/bones in the main timeline and then automatically calculate the required adjustment to inject into the Tweak action to get the desired final result.
Posted: Mon Aug 03, 2009 11:48 pm
This is cool as heck! Amazing stuff! I am all a twitter with excitement. You said this works with point AND bone actions correct? My head is spinning with possibilities.
It's so weird. I am working on a scripting addition for my head rig that is a bit similar. Too many bones is my problem. The new code "blends" or averages the positions of many bones and applies that to other bones... like having multiple bone constraints on one bone. It cuts down on the number of bones. So one bone can rotate or translate like 4 or 8 or 20 other bones. Each bone's position is averaged and applied to the constrained bone.
My code for is VERY basic and I am embarrassed to even suggest it but if any of that code would be helpful for this let me know... actually I'm looking with interest at that little equation you posted... my math is very stinky.
Posted: Tue Aug 04, 2009 12:03 am
Sorry for posting again but I had some additional thoughts.
The first thing that hit me is how much "easier" this will be to set up than my head rig. Then... my second thought was using my head rig to CREATE poses for this set up to create a simpler file. THEN my third thought was adding in control bones to "drag" for controlling those other bones. So instead of animating the up/down bones separately you have a single bone that rotates them by dragging that one bone. Same for other things like squetch.
As I found with my own head rig this seriously cuts down on the number of keyed bones in the rig you need to keep track of. That's the beauty of set ups like this, limiting the number of keyed objects to juggle in your brain. For squetch you could link the two bones together controlled with one bone. For the turning head just one bone is keyed instead of 2.
It's great to see this kind of amazing development even if it does make my stuff practically obsolete. I have to admit it makes me sad and happy at the same time
. I am blown away you are doing this with ACTIONS!!! I had almost given up on script control of actions.
Posted: Tue Aug 04, 2009 1:06 am
Thanks for the good ideas, Vern. I love having independent control of each action. It's sort of like an image editing program and each action is a layer and you are superimposing them with variable opacity to get your final image. However, like you said, there are certain morphs that you would like to integrate, where it doesn't make sense to have multiple active at once, like head turns and expressions.
While you could do it with control bones, I was also thinking of making the script interpret a sort of multi-morph dial directly. My idea is to position the bones 45Up, 45Down, 45Left and 45 Right on the boundary of a circle and have a bone in the middle labeled 45Up:45Left:45Down:45Right. The angle of this bone would then control which morph was being selected and the scale would control its strength. It would then be very intuitive to control head turns as the central bone would be effectively pointing in the same direction as the head.
Posted: Tue Aug 04, 2009 3:50 am
Another trick I started using is setting up my bones so I can have BOTH. A full control for multiple bones PLUS being able to individually tweak bones. So the best of both worlds would be controlling say the "squash and stretch" globally with one bone AND then tweaking each one separately. Sometimes you do want to have individual access to each. They don't always need to be balanced. I use this set up for eyes now with no scripting. I have a global control for both eyes and sub bones for individual control of each eye separately.
I was also thinking of making the script interpret a sort of multi-morph dial directly. My idea is to position the bones 45Up, 45Down, 45Left and 45 Right on the boundary of a circle and have a bone in the middle labeled 45Up:45Left:45Down:45Right. The angle of this bone would then control which morph was being selected and the scale would control its strength.
Oh cool! This sounds sort of like my "aim bone" script. The idea could be that dragging a bone rotates that "center" morph bone you described. So you move the bone and the "turn" bones rotate to follow it. Move the bone further away would SCALE it WHILE rotating it.
All in all it doesn't matter in the end. If this thing works the way you've shown in that sample it kicks arse!!!! Once you "release it" into the "wild" things could be added to it. It's all personal preference.
This thing really excites me because there is one missing point in my head rig. There is just no way to do a side view. I've tried to figure out how to use a switch layer to somehow incorporate a side view... THIS thing though... this could be my Holy Grail for getting a side view in using actions.
Your script could do full, perfect head turns, from side to side.
I like being able to do 4 different things with one bone!
I hate having to go to all that trouble of switching tools just to scale and rotate and translate different bones and keeping track of more than one channel. I mean for goodness sakes... hitting that key on the key board to change tools can cause carpal tunnel syndrome.
That's why my head rig is 99.999% based only on bone translation (I only use rotation for smiling and frowning).
Posted: Tue Aug 04, 2009 4:43 am
I'm glad you find my script intriguing, and I'm pretty sure it could do full 360 degree head turns, if I added my shape sort script to it, but let's save that for another time. I'm going to release it pretty soon, but not maintain it, so people can take it apart and do whatever they want with it.
I know virtually nothing about bone rigs, so are you saying that you could have a master bone for squash and stretch that would automatically set the squash bone to 0 and the stretch bone to 90 when it was set to 180, squash to 90 and stretch to 90 when it was at 90, and squash to 90 and stretch to 0 when it was a 0, all without scripting?
Posted: Wed Aug 05, 2009 7:28 am
It just occurred to me that, because this script operates on bones, it could be used recursively. What I mean is you could create actions on the bone control layer and then blend these actions together on another bone control layer. Yeah I know, it made by brain explode too. I guess it's a bit screwy, but who doesn't want to follow the dream of doing an entire animation with a single bone!
I think a much more sensible idea is to integrate the pose array / puppeteer script. It is looking like it will slot in very nicely.
Posted: Sun Aug 09, 2009 5:22 pm
...and slot in nicely it did!
Although I forgot to demo it, you can still rotate each of the bones in the pose array and it still functions as a morph dial, which could be useful for trimming the final pose.
Also, having multiple pose arrays like this really does open up some possibilities. For example, the expressions understandably get a bit distorted at the extremes of head movement. What you could do is place the same corrective morph at both Right45Up and AngryEyes, so it only becomes prominent when both control bones are near it.
I would post the script as well, but it's just too late. Hopefully, tomorrow night.
Posted: Sun Aug 09, 2009 8:45 pm
That's very impressive,:shock: yes post the script I really would like to try it!
Posted: Mon Aug 10, 2009 8:23 am
I can't wait to have a play with this script. It seems to answer a whole lot of needs.
Posted: Wed Aug 12, 2009 4:24 am
Yeah, still haven't got around to posting the script yet, but I did add what I think is a pretty cool feature. I was sick of having to tweak the final blended result by going into an action, tweaking the points and then checking the result over several iterations. I now have a button tool that lets you sculpt the final result you want directly on the main timeline, and then automatically push the exact correction required onto either a new or existing morph. Should be a great time saver!
Posted: Tue Aug 18, 2009 5:25 pm
OK, here are the "MorphDial" scripts as they currently stand:
This post has now been merged with the first post of this thread.
Posted: Fri Aug 21, 2009 7:46 pm
Can't wait to try this out!