i have a script request! (Poses)

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

Moderators: Víctor Paredes, Belgarath, slowtiger

User avatar
Víctor Paredes
Site Admin
Posts: 5655
Joined: Wed Jan 26, 2005 12:18 am
Location: Barcelona/Chile
Contact:

Post by Víctor Paredes »

i have an idea for lipsync using poses script.
it's using the ramón's script lipsync with actions (you can download it in the last ramón's post, on the word "here").

you create poses for all the phonemes, and then create actions for each one. but in each action you, instead of moving the boneselector (it stays seated), you move the pose bone close to boneselector.
and create a keyframe for the rest of bones (taking care that just the pose bone you want be close to boneselector).

the lipsync with actions script will use the actions you have created instead of a switch layer.

lipsync with poses.zip
here is an example about what i'm talking, i hope i have been clear.
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

I am so glad Genete took this one on! I would never have come up with a solution as good or as fast. Holy cow! This IS AMAZING!!!!!

This is like.. like... "non-linear mix and match blended switch layers". Switch layers are cool as heck but this really really cool. Actions are great this is even better.

What AS needs now is a "pre-roll" function like many other animation apps. The ability to have set up frames BEFORE frame 0 just for this type of thing.

-vern
DarthFurby
Posts: 510
Joined: Sat Jul 29, 2006 1:34 pm
Location: New York City
Contact:

Post by DarthFurby »

This script is one of the most amazing things I have ever used. I love it! It's very easy to build complex models(although it takes longer to put together), and VERY easy to use. In about 30 minutes I converted my old sideview headturn girl artwork into a working 2.5D model using the new script. You only need a single control bone to move the head around, although in this case I only have the side and 3/4 view angles done.

Here is the file:

http://darthfurby.com/as/modeltest.zip

So far I have two problems:

1) Anime Studio crashes whenever I move the control bone around too much. The model is made of 11 vector layers so maybe it's too much for the script?

2) I've lined up the pose bones in a horizontal line, but when I move the control bone from one pose to the next, it doesn't morph smoothly between poses. For instance, when I move the control bone from pose1 to pose2, the interpolation will pause in the middle, move slightly back to pose 1, then move all the way to pose2. Not sure why this is happening.

I'm still experimenting, but I'll let you know If I there is anything else to report.

This script has so much potential!!!!
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

AAAAAAHHHHHHHHGGGGGGGGG!!!!!!

YEEEEEHAAAAAAA!!! WOOOOOHOOOOO!!!

Genete you are a FREAKING GENIUS!!!!!


:)

I can be easily excited because I drink a lot of coffee... but still... I don't think this is an overreaction. DO YOU HAVE ANY IDEA HOW COOL THIS IS???

By moving the pose bones you can achieve UNLIMITED COMBINATIONS! Holy freaking cow jump over the moon I have fallen off my chair in a dead faint... <thunk>

------------

There is a tiny mistake in the opening comments of the script:

Code: Select all


-- bonelesector
It should be:

Code: Select all

-- boneselector
I am sure anyone with 2 brain cells could figure that out. I just thought I would mention it. ;)

-vern
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

DarthFurby wrote: 1) Anime Studio crashes whenever I move the control bone around too much. The model is made of 11 vector layers so maybe it's too much for the script?
Since the bones don't control the points try releasing all the points. I noticed a slow down when moving the bone real fast. it didn't crash but was annoying. When I released the points it seemed to stop doing this. It could be my imagination though.

(EDIT: NOT my imagination. Releasing points does smooth it out.)
(EDIT2: This doesn't work I was wrong. The slow down and "near" crash for me seems to be almost random. I can move the bone around like crazy with no problem then suddenly it starts to slow down and then stops as if processing something then the bone pops into position and everything is fine again.)

My test file has 10 poses!!! Anime Studio DEFINITELY needs a "pre-roll". ;) Imagine having an unlimited number of poses all nicely tucked away behind frame 0.

-vern
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

:mrgreen:

Thank you guys! I'm glad this small script has been so enthusiastically received :D
We would give 50% of congratulations to seglin, who made the feature request. :)

Yes it is so cool. Although it has some lacks its potential is bigger than actions. For the moment I've only found problems with point width. There is no script interface for the animated width so it is not possible to hack it.
Curvature works, but differently than points. It creates a keyframe for each frame the script passes over. So in the new version I'm preparing during the first (1...maxposes) frames the script is disabled. It would allow overwrite the curvature values for stored poses. I still working on the rest of vector layer porperties. I'm now with shapes properties.

Other aspect that freaks me is the performance. It needs a pre-roll like Verns said.
selgin wrote: i have an idea for lipsync using poses script.
it's using the ramón's script lipsync with actions (you can download it in the last ramón's post, on the word "here").
Yeah! another great idea selgin! This is would allow create nested poses... When skeletons are inside skeletons....
heyvern wrote:Imagine having an unlimited number of poses all nicely tucked away behind frame 0.
Not necessary to be behind frame 0. Just make the Start frame to be the maxposes+1 in the Project Preferences.

There is a tiny mistake in the opening comments of the script:

Code:

Code: Select all

-- bonelesector
It should be:

Code:

Code: Select all

-- boneselector
I am sure anyone with 2 brain cells could figure that out. I just thought I would mention it. :wink:
Thanks Vern. You are the only one who can notice that. :wink:
DarthFurby wrote:So far I have two problems:

1) Anime Studio crashes whenever I move the control bone around too much. The model is made of 11 vector layers so maybe it's too much for the script?

2) I've lined up the pose bones in a horizontal line, but when I move the control bone from one pose to the next, it doesn't morph smoothly between poses. For instance, when I move the control bone from pose1 to pose2, the interpolation will pause in the middle, move slightly back to pose 1, then move all the way to pose2. Not sure why this is happening.
1) I've loaded your model and I cannot make it crash. It really stop working and let AS hangup but finally it comes back. I think it is a AS/Operating system performance problem. Solution: Don't move the control bone so much around... move it slowly... :wink:

2) There is nothing wrong with the script. The fact is that all the poses have influence over the interpolation at all the time. If the poses are 1-2-3-4 lined up, when the bone selector is linearly placed in the straight line between 1 and 2 it is catching the poses 3 and 4 too.

Code: Select all

pmoved = (posp1*w1+posp2*w2+posp3*w3+posp4*w4)/w 
This code line (or its corresponding one of the generalized version) makes a weighted average of the points positions poses with the inverse of the distance between the boneselector to each corresponding pose bone. w = w1+w2+w3+w4. It means that when the boneselector is between poses 1 and 2 in your example it is interpolating mainly 1 and 2 but also 3 and 4 but with smaller weights.

I have a couple of ideas to try avoid this:

1) Build the weights using the inverse of the squared distance. It would avoid quickly any "far" pose. But it would loose the multi interpolation thing.
2) Move the poses bones like selgin is doing. I don't know if it would solve that alone or in combination with the first idea.
3) Weight the weights with the bone scale (or by its squared value). You can increase or decrease bone scale to hide some poses or to show up others. It needs a new script. Anyway that feature will be included into the next version because if all the bones have the same scale (1.0 by default) it will work the same.

There is something not mentioned by any of you that I think it is the most important thing that makes it better than actions:
¡¡¡¡¡You can move the pose form one frame to other easily!!!!!!!! As well as all the needed keyframes are in the same layer (the bone layer) you are able to easily select and drag the keyframes. That's VERY IMPORTANT for al the mortals animators. Who makes its first animation at the right tempo the first time? Only if you make a detailed storyboard with full detailed timing you can do that. With this script you can correct that kind of "mistakes".

I wonder:
Can exists two bones representing same pose? For what can it be used?

Please let me know what other modifications need this script to fit animators needs. Specially around the weights that are the core of the idea.

Best
-G
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

The script does seem to get very sluggish and slow with a lot of points and layers which is expected.

I think part of this is due to that problem of layer scripts running 3 times on each frame each time something changes. So imagine 3 layers with all those points running through the point list for all the poses for each layer... it adds up. I can't think of anyway to prevent this. I have a way to make the script run once on each frame but you still need it to UPDATE on the frame if you change stuff.

I am going to play around with this and see if I can improve performance. It is still a lot processing that needs to be done. It works really well with simple vectors.

Another trick is if you want a more direct pose to pose transition, move the pose bones TO the boneselector bone instead of the boneseletor bone to the pose. With some tweaking you get a pretty good transition.

-vern
User avatar
DK
Posts: 2854
Joined: Mon Aug 09, 2004 6:06 am
Location: Australia

Post by DK »

For those who don't know how to use this file and have tried without succsess to adjust the shapes in each corner to create new shape poses.
The shapes in the corners are only there as visual guides. Load the Poses anme file, open the bone layer group, select the chld layer, double click this layer and uncheck embed script. Now on the timeline you will see the 4 keyframes and each shape can be adjusted this way.

Cheers
D.K
DarthFurby
Posts: 510
Joined: Sat Jul 29, 2006 1:34 pm
Location: New York City
Contact:

Post by DarthFurby »

I would like to have a single bone control all head motion.

With Genete's script I think this is possible.

One way to do this is to have a single selector/control bone move around a grid of head angle poses. In the diagram below I have 13 head angle poses and I've marked the pose bones that are directly adjacent to the red selector bone to show how I'd like the weights/influence to work. We could then use selgin's technique to swap in expression pose bones(not shown in the diagram) like eyeblinks and mouth phonemes directly onto the grid when needed.

Image
Image
Image

Using a weighted average of the points position for all poses causes the morph/interpolation to act weird, like in the modeltest file I posted earlier.

But if we keep the amount of influence of the adjacent pose bones proportional to their distance from the control bone, and turn off the influence/weight for all other bones, then I think that will fix the weird morph problem(I hope). Is it possible to script this?
Last edited by DarthFurby on Sun Feb 03, 2008 1:33 am, edited 1 time in total.
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

However, I think the amount of influence of the adjacent pose bones should be proportional to their distance from the control bone, but all other bones should have zero influence/weight. That should fix the weird morph problem(hopefully).
But how would know the script what poses should have zero influence?
I think we can stablish some sort of maximum radius influence and every pose outside that radius will be zero weighted. That would help I think. It only needs a little of preparation of the pose bones to scatter them properly for the desired interpolation.

It is too late here. Maybe tomorrow I'll change the concept. Thanks Darth for the inspiration!!!!

Best
-G
DarthFurby
Posts: 510
Joined: Sat Jul 29, 2006 1:34 pm
Location: New York City
Contact:

Post by DarthFurby »

Maybe someone could write a search string that only accepts at most one pose bone in each direction, north, south, east and west. Just thinking out loud.
DarthFurby
Posts: 510
Joined: Sat Jul 29, 2006 1:34 pm
Location: New York City
Contact:

Post by DarthFurby »

How about a user controlled radius of influence defined by a vector shape? The user would have to move both the control/selector bone and the vector shape, but I think that might be easier to script.

Image
Image
Image
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

I think it would make sense to use the bone's strength property. That value extends the length of the bone but this value is basically a singular "radius" value. Only poses with in the radius of the strength value would be part of the calculation. This would save some effort in the coding because that value could just "checked" and used. No need to "reinvent the wheel" so to speak. The bones don't actually influence anything anyway so the strength value is being "wasted" in a way.

Another option would be to use strength in combination with length. The length of the bone is also a meaningless value in the use of this script. If some scalable value based on length were used then you could "stretch" a bone to cover more or less of the pose bones. This could be animated as well to create other options.


-------

On a side note... could those using this script try it out with more... complex shapes? Once I get beyond a certain number of points it becomes virtually impossible to use. I admit my machine is slow, and I have not tested this on the Windows version (I use mac mostly but have both).

Interestingly though using standard point motion or bone motion is no problem. If it turns out that it is caused by my slow weak machine than I wouldn't worry about it. Keep in mind I have very complex files. :oops:. This script works perfectly with simple vectors.

I've looked at the darn code and I can't see any simpler way of looping through the point list. It looks perfect if you ask me. There just doesn't seem to be any more elegant way of doing it to speed up the display.

I was able to get it to run ONCE for each frame but it is still very slow... and then I couldn't move bones on that frame without having to refresh "by hand".

The script does run through the point positions "2 times" in a way. It gets the position of the poses each time the script runs. The pose point positions I suppose could be stored once on frame 0 then on other frames this table of positions would already exist. This might give an increase in speed of calculation. I can play with that on my own.

-vern
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Here's my idea for changing influence:

Image

Actually bone length would be better to use for the "optional" feature since it can be animated.

-vern
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

Use the strength is for that task useless because you cannot change it over time. You can change length using scale variable value. Also the strength is not shown during bone displacement and you should figure out if the bone strength is touching the pose bone or not. On the other hand the current bone length can be dynamically displayed with a circle that goes from bone origin to tip so you know at every moment what bone is is touching.
Anyway restrict the weights to have influence if the pose bone is inside the influence region or not, worries me a bit. We will obtain steps movements when the pose bone gets out of the influence region. To avoid that I would think on a influence math function that decrease to 0 at the edge of the influence region to make things smooth. Imagine that the weight value were non zero at the edge of the influence region. It would produce a "step" movement, that I think nobody wants.

-G
Post Reply