WIP - "FKIK manipulate bones" tool.

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

User avatar
capricorn33
Posts: 249
Joined: Sun Oct 02, 2005 9:49 am
Location: Finland
Contact:

WIP - "FKIK manipulate bones" tool.

Post by capricorn33 »

UPDATE


2.9.2011 version 0.91 (- now with BUG from 31.8 FIXED).

This is an update with some bug fixes from the previous version.


FIXES
- bone offset on frame 0 should function normally now.
- if there is any mismatch in the setup of .trg / .aim bone pairs, the scripts now will tell you so. If you get a message complaining about "missing aimbone" or "mismatch in trg / aim bones" you have to check that your bone pairs are named correctly.


- the tool script SHOULD now be completely backwards compatible with the function of the original LM manipulate bones script. Meaning that if you don't have any .trg- or .aim-bones in your bones setup the function of the tool should be exactly the same as the original tool.
EDIT 2.9.: ...this part had a little bug, but it should be all fixed now. :-)

You can download the updated files here (remember, you need BOTH):

the tool
https://dl.dropbox.com/u/19247240/FKIK% ... _bones.lua

the embedded script (necessary for exact interpolation between keyframes)
http://dl.dropbox.com/u/19247240/aim_bone_ik_hl.lua


Check out Gilles' blog if you want to see a tutorial on how to use these scripts:
http://gcharb2d.blogspot.com/2011/07/th ... on-my.html



And please tell me if you find any strange behavior in the script, it is still very much under development.
New versions coming soon.

cheers!



========================================
ORIGINAL POST FROM Wed Apr 20, 2011

Hello everybody! :)

So... now I have spent some time fiddling around with LM:s original "manipulate bones"-tool and combined it with a modded version of Heyvern's aimbone-script to work on the basis of inverse kinematics instead of single-bone-rotation, I have copied and pasted bits and pieces around and combined some of the "translate bone"- and "rotate bone"-code into the soup and finally come up with this;

a first beta-version ( version 0.9 ) of my "FKIK manipulate bones" -tool. Free for everyone to use (or steal or alter or whatever - be my guest! :) )

So far it has been developed and tested only in ASP6.2 - I have no idea how or whether it works in AS7 or any other versions.

the tool
http://dl.dropbox.com/u/19247240/hl_FKI ... _bones.lua

the embedded script (necessary for exact interpolation between keyframes)
http://dl.dropbox.com/u/19247240/aim_bone_ik_hl.lua

and a little demo file with a skeleton using IK feet
http://dl.dropbox.com/u/19247240/FKIK_v4_test.anme

I used the feet - hips connection as my example case since that is where my investigation started. But of course this kind of functionality can have a lot of other uses, I guess. It's up to everyone to figure out for themselves. :-)

But in this example-file that I included the feet are built in the form of free, unparented bonechains, where the topbones are named as "[somespecificname].trg" and the corresponding shinbones are named as "[somespecificname].aim" Following the naming convention of Heyvern's original script you must use the SAME NAME for the pair of bones that are to be connected. Bad naming or missing pairs will crash the script.

- Note that the tool works without the embedded script when you are posing and adjusting on any single keyframe, but for the bones to interpolate correctly between keyframes you need to activate the embedded script. If you don't you will notice that the connection between aimbone and targetbone will be momentarily lost while interploating between two keyframes, as the arc of the aimbone's tip won't follow the translation of the trgbone exactly.

- No scaling function is implemented yet, I'm planning to do so, though - but what would be the most useful way to do it?
I'd like to make this tool useful for all kinds of "aim-bone functionality" purposes... So what do you think should be developed to make this tool useful in that respect?


BTW
The code is still very messy, since this has been a kind of learning-project after all - "learning by dissecting". Just as a warning if you are actually trying to read the code... (I will tidy it up later, promise...)

The whole thing is still a work in progress, so of course all kinds of comments and suggestions would be most welcome.

cheers
cap
:-)
Last edited by capricorn33 on Thu Nov 01, 2012 8:59 am, edited 8 times in total.
capricorn ( - just call me "cap")
children's tv pro, character animator
tatrik
Posts: 28
Joined: Tue Aug 11, 2009 6:38 pm
Location: turkey

Post by tatrik »

hi
I am very much interested in your fkik rig. I think this will solve the slippery feet problem in anime studio. I tried the current version of the script that i downloaded from the other anime studio forum. However it is not working with offsetting seperate layers type of rig, since its not working in frame 0. When I offset the bone positions at frame 0, the bones are aiming at the pre-offset position of the target bone at frame 1. So it is now only working with point binding type of rigging. Is it possible to solve this problem? Thanks for this useful script. İ think this technique should be included in the future releases of the software as a tool or script.
User avatar
GCharb
Posts: 2202
Joined: Mon Oct 10, 2005 2:31 am
Location: Saint-Donat, Quebec, Canada
Contact:

Post by GCharb »

Thanks capricorn, will have a look as soon as possible :)
User avatar
capricorn33
Posts: 249
Joined: Sun Oct 02, 2005 9:49 am
Location: Finland
Contact:

Post by capricorn33 »

Tatrik,
I'm glad to hear you find my idea in development useful. :-)

Thanks for your observation with the offset problem. As you probably can guess I use almost exclusively the point binding method myself...

I will continue working on this script (since I really need this kind of functionality myself) but at this moment I am very busy with other stuff, have to put it on hold for a while...
But I hope I can get a chance to sit down and work on it, soon. And then I will have a look at the offsetting problematics too.

As soon as I do I will let you know. Stay tuned. :-)
capricorn ( - just call me "cap")
children's tv pro, character animator
tatrik
Posts: 28
Joined: Tue Aug 11, 2009 6:38 pm
Location: turkey

Post by tatrik »

Thanks for your reply. Till you fix the problem, I guess the only solution is offsetting the bones with translate bone tool at frame 1. I hope other scripters will help you through the development. Keep up the good work.
User avatar
capricorn33
Posts: 249
Joined: Sun Oct 02, 2005 9:49 am
Location: Finland
Contact:

Post by capricorn33 »

tatrik wrote:Thanks for your reply. Till you fix the problem, I guess the only solution is offsetting the bones with translate bone tool at frame 1.
There you go! That is a good workaround for now.

tatrik wrote: I hope other scripters will help you through the development.
Sure, anyone interested is welcome. Actually, for me it's just a matter of getting this damned thing to work. :-)
But my own time is a little limited right now, as I said before.

cheers
capricorn ( - just call me "cap")
children's tv pro, character animator
User avatar
GCharb
Posts: 2202
Joined: Mon Oct 10, 2005 2:31 am
Location: Saint-Donat, Quebec, Canada
Contact:

Post by GCharb »

I havn't spent allot of time with it yet, but what is the difference between this and your aim-at script as I have shown it in my walk cycle video tut?
User avatar
capricorn33
Posts: 249
Joined: Sun Oct 02, 2005 9:49 am
Location: Finland
Contact:

Post by capricorn33 »

Gcharb,
You refer to it as the "aim at"-script, but it's the exact same script and version we are talking about here. I just call it "FKIK manipulate tool"...

(because my plan is to put all the functionality under one button when it's finished. - oh... one button AND one embedded script, I mean)

As you can see, Gilles, I haven't done anything about it since I first posted it here and on the other forum. Sorry 'bout that. :-(
capricorn ( - just call me "cap")
children's tv pro, character animator
User avatar
GCharb
Posts: 2202
Joined: Mon Oct 10, 2005 2:31 am
Location: Saint-Donat, Quebec, Canada
Contact:

Post by GCharb »

capricorn33 wrote:Gcharb,
You refer to it as the "aim at"-script, but it's the exact same script and version we are talking about here. I just call it "FKIK manipulate tool"...

(because my plan is to put all the functionality under one button when it's finished. - oh... one button AND one embedded script, I mean)

As you can see, Gilles, I haven't done anything about it since I first posted it here and on the other forum. Sorry 'bout that. :-(
LOL I see, and I was hurting my brain here! :)

I still think it is a very useful script and plan on using it tons.

I have at least 2 tutorials coming for this baby, as soon as my current work is done!

Thanks for it bro!
User avatar
GCharb
Posts: 2202
Joined: Mon Oct 10, 2005 2:31 am
Location: Saint-Donat, Quebec, Canada
Contact:

Post by GCharb »

One thing that would make the script much more useful is a strength attribute, for things like knee aim at constraint, to avoid the flipping (gimbal lock).

As it is, if I use a bone and aim the knee at it, the knee goes all the way to the bone, even if constraint have been set to the heels, it is just too strong at 100% for knee constraint.

I will put up a scene if you want to have a look at what I mean!
User avatar
capricorn33
Posts: 249
Joined: Sun Oct 02, 2005 9:49 am
Location: Finland
Contact:

Post by capricorn33 »

Yes, if you could do that, please. It would help me understand what problem you are having here, more specifically.

You want something similar to a pole vector in 3D software, is that it? I'm not convinced such a thing is needed at all, but you are welcome to try and make me think otherwise. :)
capricorn ( - just call me "cap")
children's tv pro, character animator
User avatar
GCharb
Posts: 2202
Joined: Mon Oct 10, 2005 2:31 am
Location: Saint-Donat, Quebec, Canada
Contact:

Post by GCharb »

capricorn33 wrote:Yes, if you could do that, please. It would help me understand what problem you are having here, more specifically.

You want something similar to a pole vector in 3D software, is that it? I'm not convinced such a thing is needed at all, but you are welcome to try and make me think otherwise. :)
What I think would be useful is to have a strength setting for the bone influence, so that it could be used as a knee or elbow constraint to avoid the Gimbal Lock(bone flipping) problem with IK.

Here is a sample file with a bone set at the knee, if you go at frame one, the scripts gets activated and the bone goes to the knee, it is too strong to act as a knee constraint.

http://www.mediafire.com/?5z5f08c492w6m3t

Image
Last edited by GCharb on Mon Oct 17, 2011 10:33 pm, edited 1 time in total.
User avatar
capricorn33
Posts: 249
Joined: Sun Oct 02, 2005 9:49 am
Location: Finland
Contact:

Post by capricorn33 »

Hi Gilles

Actually I might be wrong here - please correct me anyone if I am mistaken - but I don't think there is any way to use a script to affect what's going on inside the IK chain in AS.

(All IK calculations in these FKIK scripts are directly based on LM's original IK solve algorithm. And that function is like a black box, no way for scripts to get inside it and change the way it works...)

So taking that limitation into consideration - what you are asking for, to add another aim bone inside an already existing aimbone chain (or IK chain, because that is what it actually is) is impossible. Why? Because you would have to somehow put in an extra influence inside the existing IK chain. You would have to break into that black box, so to speak.
This is simply not possible using LUA scripts.


AND furthermore, for this example you presented I don't think such a thing would even be needed.

All you have to do to correct a "flipped IK bone" in a normal leg rig with two bones is to use the rotate tool directly on the thigh bone and push it in the direction you want it to be until it snaps into place. LM's algorithm takes the rotation value (of the thigh bone in this case) into consideration and adjusts the IK chain shape and flips it over to the "correct" side...
This rotation value change adds an extra key for the rotation value, of course - but I think it's much smarter and cleaner than having to write extra scripts for the functionality and having to add an unnecessary "knee aim bone" into the rig, and then you would have to animate it as well, to get it into proper place...

Using the "FKIK manipulate tool" you don't even have to change tools BTW... you just click on the thigh bone and drag it directly until it snaps into place.)
So for this particular example there already is a simpler way to get the job done.

The whole thing gets of course much messier the moment you are dealing with longer IK chains, consisting of three bones or more.... Then it's harder to get precise control over the exact movement of each bone in the chain. You just have to pull and twist it until you get the shape that you want..... :-/


But for this particular use - flipping knees - there is IMHO no need for any "aim bone stregth" parameter.

All you riggers out there - correct me if I'm wrong! (Or enlighten me what a strength parameter could be useful for, applied to the tip of the single IK chain... (NOT inside it) because THAT would somehow be possible to achive, I think. :-)


cheers
capricorn ( - just call me "cap")
children's tv pro, character animator
User avatar
GCharb
Posts: 2202
Joined: Mon Oct 10, 2005 2:31 am
Location: Saint-Donat, Quebec, Canada
Contact:

Post by GCharb »

Whoa, slow your horses there Matey! :)

I was asking since this would improve workflow, instead of having to correct the flipping bones all the time.

We used to have to deal with flipping bones in 3D for a decade and one of the first solution we had was to use an aim at constraint for the knees, which used a strength value most of the time.

I am not saying it is feasible in ASP, just throwing a line here to see if this could be done!
User avatar
funksmaname
Posts: 3174
Joined: Tue May 29, 2007 11:31 am
Location: New Zealand

Post by funksmaname »

you could give the thigh bone a rotation constraing so it doesn't buckle on itslef? (so the knee can't bend backwards)
Post Reply