Auto Scripted 3D rig. Files and Video Tutorial

Have you come up with a good Moho trick? Need help solving an animation problem? Come on in.

Moderators: Fahim, Distinct Sun, Víctor Paredes, erey, Belgarath, slowtiger

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

Auto Scripted 3D rig. Files and Video Tutorial

Post by Genete » Fri Jun 15, 2007 7:10 pm

ADDED jul-21-2007 and modified on aug-3-2007
-------------------------------------------------------------------------------------
UPDATE!
PLEASE BACKUP YOUR ANME FILES BEFORE USE THOSE SCRIPTS. I CANNOT GUARANTEE ANY CRASH SINCE SOME CODE COULD FAIL IN SOME CASES. USE AT YOUR OWN RISK. IT STILL UNDER DEVELOPMENT.

NEEDED FILES HERE: :arrow: http://www.darthfurby.com/genete/Script ... ils_v9.zip
It includes updates for :
3Dgrid version 9 and 9.1(this one allows conic perspective but need to fix shape sort - Thanks to Vern's fantastic addition!!)
sort_shapes9.1: some minor bugs fixed and proper usage with multiple limbs.
ge_front_3Drig3.2: Added a window option to make easier the creation of the bones.
Just select the points, and the central bone and call the script. It would take care of create the masters bones, the mX and mY bones, rename the clone bone and place a t the proper position when applicable.
ge_side_3Drig3.1: Properly work with the partner previous script.

AND HERE THE TUTORIAL
:
http://www.darthfurby.com/genete/3DrigT ... s/cube.htm (3,4 MB)
http://www.darthfurby.com/genete/3DrigT ... /cube.anme
It is a little rough, but instructive. This tutorial is done with the files above linked. Please place the files 3Dgrid and sort_shapes with the anme file. Please put the ge_front_3Drig and ge_side_3Drig scripts unde a subfolder of the scripts folder of your AS folder installation.
The sample is very simple because I don't want to spend time drawing. In fact the biggest time you'll spend would be drawing the front and side views of your model. The auto rig scripts are very quick.
Remember that Front and Side views must have same points (the front view must be a copy of the side view but with the points in another place. It doesn't matter if the lines are not the same. It could help you to have the same lines or not, depending on the complexity of the model. Remember that if need to add a point to the model you should start over making a copy of the front view layer to create the side view layer. There is a trick: If you add the same points at the same order and do exactly the same operations in both layers, it would produce compatible layers. For that you should morph your model in other frame than frame 0. It would help you to identify lines and points when add the new points to both layers. If the scripts claims for a non existing Rx or Ry bone when rotate it, then something has gone wrong...

There is a known bug in the sort_shapes script:
If you press the raise shape or lower shape repetitively beyond frame 0, it would crash AS. Take care of make a backup frequently.

Have fun!

-G

ADDED: jun-23-2007
--------------------------------------------------------------------------------------
NEW VERSION!:

http://darthfurby.com/genete/Scripting/3Drig_utils2.zip
http://darthfurby.com/genete/Scripting/humanoid.swf
CONTENT OF 3Drig_utils2.zip:
3Dgrid9.lua
ge_front_3Drig3.lua
ge_side_3Drig3.lua
humanoid.anme
sort_shapes9.lua

Main changes:
1) ge_front_ 3Drig3.lua and ge_side_3Drig3.lua allow a more easy creation of limbs. Also the helper bones (Rx and Ry) are smaller and its meaning is different. See this post for deeper details. You can tweak them directly over the timeline only with the translate bone tool. Not more use of scale value of the bone, only its relative positions to its parent.
2) Modified version of 3Dgrid (3Dgrid9.lua) to store the Z value of each point. Needed to perform shapes sort.
3) sort_shapes9.lua New script that perform a Z sort of the shapes of the vector layer where it is embedded. Work together with version 9 of 3Dgrid. Corrected some problems of Z sort for limbs that were not considered in the alpha version.

The file humanoid.anme is a simple sample to show how it works. Feel free to play with it. Specially the mX and mY bones (angles) and the .Rx and .Ry bones (positions). Be careful there are a lot of bones. Use heyvern's select bone tool.

I have experienced some lua errors when drag the timebar too fast (and / or reversed in direction) from shape order script. Go to frame 0 and start it over if it happens.

All the scripts need speed up improvements with code optimization. But it would be done in the definitive release.

Let me have a breath until I make the video tutorial. I've been working a lot lately. :roll:

Please keep this topic on sight! News soon!
-G

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

ORIGINAL POST
------------------------------------------------------------------------
Hi!
Just taken form the oven I have prepared a video tutorial to explain how work the script that heyvern created with the math I gave him and the automatic 3D riggers scripts that I have created to work all together.

The files needed to make the magic are here:
http://www.darthfurby.com/genete/Script ... _utils.zip

Content of the file:
3Dgrid7.lua
Embedded script that perform the magic of 3D illusion. It is the one that do the loops work on every frame.

3Dgrid7_menu.lua
3Dgrid7_embed.lua

Menu and embedded script that do the same than the previous one. The difference is that they are a little faster because one loop is not needed during animation. Forget them for the moment until a new tutorial is done. They are my experiments.
ge_front_3Dgrid.lua
ge_side_3Dgrid.lua

Menu scripts (can be used as button scripts also) that perform the automatic creation of the needed bones to move the model in the virtual 3D space. Install them just copying in a folder inside AnimeStudio/scripts/menu/Yourfolder/. The created bones are the holders of the 3D information of every point in the model. Modifying the bones created by those scripts can morph the model at frame 0 (to all the animation) or at any frame (animated morph).

The bones created are called by its extension. The name of the bone is automatically created and you should not take care about it. regarding to the extensions the meaning of every extension is:
*.pt : This bone is the one that bind ONE point of the mesh. Are created in the front view. You can modify them and drag the point with the bone. Also you can play moving the point away form the bone to fine tunning the position of the point if needed.
*.Rx: this bone control the distance of the 3d point to the ZY plane. Z is pointing toward to your eyes.. The only useful information from this bone is its scale (effective length). DON'T touch them at frame 0. Do it at frame 1 if you want to morph all the animation. Some of them have a "negative length" if you use the translate tool to modify its length at frame 0 the translate tool would reverse its length to a "positive" one. That makes the model useless. Do it at frame 1.
*.Ry: this bone stores two information. Its length is the minimum length of the 3D point to the X axis. This minimum distance have an angle with the XY plane, that angle is stored at the angle of the bone. So if you modify the angle and the scale of the bone you can modify the model itself. You can do it at frame 0.

Be free to play with those bones to morph your creation.
Also be sure that you create the masterX and masterY bones to perform the overall rotation. If they don't exist there is a lua error.

This tutorial is my first experience with wink :wink:. Please forgive the big length and its boring style. I have realized that wink is a good tool to perform video tutorial. I should have realized it before... If not why myles uses it in his always master lessons?

AND FINALLY HERE THE VIDEO TUTORIAL:
http://www.darthfurby.com/genete/3DrigT ... DBasic.swf
20MB ... I cannot stop give thanks to DarthFurby for his big generous hosting of my files. THANKS!!
I have done it @ 1024x768. Sorry if it don't fit in your screen... :(
Ah! In the lower right corner there is a arrow button to follow the steps...
For the newbies: My tool palette is customized so some tools are not in the original place.

New tutorial to perform limbs (like the 3D tail) will come soon! :D
Keep connected!

Cheers!
-G
--------------------------------------------------------------------
Last edited by Genete on Sat Aug 04, 2007 9:18 am, edited 5 times in total.
User avatar
capricorn33
Posts: 249
Joined: Sun Oct 02, 2005 9:49 am
Location: Finland
Contact:

Post by capricorn33 » Fri Jun 15, 2007 7:59 pm

WOW! I have been listening in to your development discussion on the scripting forum from time to time... But I hadn't understood what the automated rigging of the 3D mesh was about.

This one extra feature made this already great project into a absolutely incredible one!

Extremely useful - and so easy to use!

Thanks, Genete and Heyvern, for all the work you have put into it!
capricorn ( - just call me "cap")
children's tv pro, character animator
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete » Fri Jun 15, 2007 8:07 pm

Your mummy 3D nose was done using the automatic 3D rig scripts.
Now the difficult issue will be draw the front and side views.
There is where I fail :(

But I'll l e a r n !!!! :D
User avatar
Mikdog
Posts: 1896
Joined: Tue Jul 05, 2005 3:51 pm
Location: South Africa
Contact:

Post by Mikdog » Fri Jun 15, 2007 8:41 pm

Very cool Genete ;)
User avatar
heyvern
Posts: 6964
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern » Fri Jun 15, 2007 8:45 pm

Here's a tip (I haven't seen the video tutorial so it might be in there already).

Because of all the bones that are created it can be difficult to see what you are doing.

I create an extra layer and draw shapes that define the masterX and masterY bone's locations and bind these shapes to each of those bones.

Then I turn off construction curves. The vector shape layer that defines the bones allows you to select them as if you could see them and now you don't see all the other bones.

Of course when you are editing the bones you would need to turn construction curves back on.

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

Post by heyvern » Fri Jun 15, 2007 9:04 pm

Fantastic job Genete!

Very clear and I think it is easy to understand.

AND!!

I didn't know about that cool add point tool from Fazek!!! I must have that!

;)

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

Post by heyvern » Sat Jun 16, 2007 7:20 am

Please don't hit me Genete!

What kind of magical math would be required to accomplish this type of perspective... "automated" in the script?

Image

I understand that this would be completely over the top and against everything I have said about keeping AS as a "2D" application...

I am just very curious what it might take. From my experiments it would require modifying the angle and length of all those "Rx" and "Ry" bones.

It would be wicked cool though... just a thought for the future. You worry about shape ordering for now. ;)

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

Post by Genete » Sat Jun 16, 2007 9:03 am

For that I should re - study geometry. conic projection is not a banal issue. Maybe we can use the perspective matrix transformation that LM have in the API. But some sort of loong future issue. For the moment I have not enough time to start other crossroad... :cry:

Lately I have been working on the tutorial and in some experiments of the current 3D tools. Hehe, some sort of realistic 3D eye...

But PLEASE! don't stop to push me with new ideas and / or features. I'll stick them in the TO DO list...
-----

Regarding to shape sort, I have the whole idea for shape ordering but have to figure how are stored the shapes in order during rendering inside Moho document. There is no information in the shape object about where is itself in the stack pile of shapes. I haven't found that (have you?).
So I'm wondering to store in a table the shapes by its ID and then resort them inside the table by its calculated Z. Later using the "Raise to top" order resort all them just reading the table in a reverse order. I have not found other way to make the bubble sort routine.
Have other idea?

-G
User avatar
funksmaname
Posts: 3113
Joined: Tue May 29, 2007 11:31 am
Location: Nelson, New Zealand

Post by funksmaname » Sat Jun 16, 2007 11:14 am

8) Thanks for this Genete - its pretty damn awesome! :)

I wanted to try and see if it would work with something less 'geometric' though and the answer is YES!!... aaaand no.

This is a mega quick test - let me know if i'm doing something wrong but:

test 1

here it is kinda mostly working except for the gaps at certain angles

test 2 here i flipped the layer to pass trhough the problem angle - but because my drawing is not symetrical you see an obvious jump...

any ideas?
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete » Sat Jun 16, 2007 11:25 am

You have to give volume to the model. Volume in your mind before draw it!. :)
I mean every point of the model is a 3D point so if you move them to the side view as they were in a flat shape they will move as they were in a flat shaped but rotated. You need to add more lines that connect points at different places in the 3D space.

For instance. A shape with three points is the minimum that becomes the same as flat in 2D as in 3D. If you have a fourth point it could be coplanar (same plane) than the other tree or not. Just crossing a line between one vertex and its opposite you can divide the shape into two triangles than can have "volume" in 3D... also if you include an additional points in the middle it would work better.
Got it?

Download Elsa the giraffe file and watch how i gave her volume to the top front part of the head. That's the key. Subdivide the lines. Add more shapes.

It is a pain for the drawing but you're asking for a 3D rotation!

-G
User avatar
funksmaname
Posts: 3113
Joined: Tue May 29, 2007 11:31 am
Location: Nelson, New Zealand

Post by funksmaname » Sat Jun 16, 2007 11:28 am

:oops: thanks for the quick response... makes perfect sense! i will download else and investigate :)

Thanks again for all your hard work G.
User avatar
heyvern
Posts: 6964
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern » Sat Jun 16, 2007 12:55 pm

The "flipping" actually isn't really... that bad. Flipping the order is a good "workaround" for simplistic characters.

If you watch a lot of current animations when a head turns they kind of "woosh" through it pretty quick. ;)

Genete you should be really proud that ordinary mortals can make this work!!!!!

I remember when you first came up with this crazy idea about binding a bone to every point and calculating all those angles and all the bones.... Yikes!

All I could think of was how much work that would be!

Don't give another thought to that "conic projection". I knew it must be very difficult. ;)

-vern
User avatar
p6r
Posts: 318
Joined: Fri Aug 20, 2004 5:16 pm
Location: France
Contact:

Post by p6r » Sat Jun 16, 2007 7:37 pm

FANTASTIC work !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

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

Post by Genete » Sun Jun 17, 2007 8:48 am

Genete you should be really proud that ordinary mortals can make this work!!!!!
I'm an ordinary mortal! I don't know nothing about animation!! :oops:
If Walt Disney were diving in a deep blue sea, I have only been spattered by the foam of a little wave of an small (but beauty) beach...
I'll be proud if finally someone can use this technique to his projects. Really the automatic rig is a very good complement to the 3Dgrid script.
FANTASTIC work !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

6R
Thanks :oops:

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

Post by Genete » Sun Jun 17, 2007 11:23 pm

Sort shapes by depth by automatic script have been released!.
viewtopic.php?p=42775#42775

As soon as I have time I'll show you a sample tutorial.

I'm frighten by it possibilities...
Cheers!
-G
Post Reply