3D rig tutorial

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

Moderators: Víctor Paredes, Belgarath, slowtiger

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

3D rig tutorial

Post by Genete »

Hi folks!!
since I discovered the springy mechanism (see this post) I have been working in an aplication of it (inspired by heyvern and the development of Transrotate with Rasheed) that let make the simulation of a 3D rotation of a point.

My first suitable result was the 3D realistic eye post.

In my opinion this is a powerfull tool to perform headturns and other interesting 3D movements so I felt in the obligation of make a tutorial for anyone who didn't follow the threads.

Remember that you can make individual rotation of partial portions of the head and after composite all together in a rotation of an "3D skeleton" of the face. For instance eyes can rotate individually and their center of rotation could also rotate as linked to a particular head position.

Here is the file. It contains a PDF tutorial file and a anme example file. I think that the tutorial is a little hard to follow and perhaps could be polished a little more but I wanted to post it as soon as it is readable.

http://es.geocities.com/genetita/AnimeS ... torial.zip
Ricght click and save as

Waiting for your comments and doubts if any.

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

Post by heyvern »

Thanks for the great tutorial. Now I don't have to hunt through the forum posts to see all the math and what is going on.

Those of you who think this is... too complex... it isn't really. Once you get a handle on the basic idea it is really cool. I suck at math, have no idea what Genete is talking about half the time... but I can still use this technique. Seeing it in action gives you the clues to make use of it in a practical application.

I am using portions of this concept for my face rig... not the whole thing mind you... I'd go insane ;) ... but for critical areas that need it visually
-vern
User avatar
DK
Posts: 2849
Joined: Mon Aug 09, 2004 6:06 am
Location: Australia

Post by DK »

Holy cow! Great tutorial Genete....i think. Sorry, but my eyes started to glaze over about the second page in. I'm sure it's fantastic but i really need all this explained in a "for dummies" type way if that's at all possible.

D.K
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

@DK: I'm sorry if the tutorial is a little hard or if it goes so straight to the concepts. Perhaps it needs a better introduction about the 3D cartesian stuff. Let m try to explain some concepts again.

1) We are using this technique to mainly rotate the solid by the Y axis. The X rotation a little special.
2) Imagine that you have a potatoe and cross it by a wire like if it were the Y axis. The other axis is an imaginary axis and represent the X axis.
3) Consider that the wire (axis Y) is now parallel to the projection plane (perpendicular to your view direction) and you rotate the potatoe by its Y axis. ANY point in the potatoe will describe a 3D circle. But, in projection, the considered point is projecting a straight line (an oscilation). The rotation radious is the perpendicular length between the point in consideration and the Y axis. For any position place the rotation radious is as long as the green line in the tutorial.
4) Imagine now that you rotate the potatoe by its imaginary axis X, Then the Y axis will rotate also as well as the wire is pricking the potatoe. Now rotate again the potate by its Y axis using the wire. NOW the considered point of the potatoe will produce an ellipse in the projection plane (and not a straigt line). The horizontal axis of the ellipse is the same as the horizontal oscilation before. It stills always the same. But the vertical axis of the ellipse is bigger as big is the X rotation.
5) If you rotate the potatoe by its X axis until the wire (the Y axis) is pointing to your eyes, then if you rotate the potatoe by its Y axis (the wire) the considered point of the potatoe wil produce a perfect circle in the projection plane (in fact a circle is an special kind of ellipse). Really ALL the points of the potatoe are producing circles in the projection plane.
6) So the rotation technique is a little special. The X axis rotation is invariable and always is at the same position. It always produce straight lines in projection. On the other hand the Y axis rotates with the X axis rotation so the projection ellipses are different for every rotation by the X axis.

Al the things that I have done are to simulate those elliptical rotation using a combination of springy bones.

@heyvern: I knew that you should understand it without this tutorial. Anyway it is good that the technique is explained without "complex math" (asin, atan, sqrt and so on)

There are two main (well three) drawbacks.
1) You need to reorder the shapes to perform the rotation realistic. It is not so difficult because you can create the bones inside a switch layer and switch to the proper shapes ordered layer when you need it manually. For partial parts of the solid (the ears, nose or eyes) you can make them in individual switch layers and use Flipbybones bones by Rasheed to order the layers. To rotate all the switch layers at the same time you can use the script layer from heyvern (I thinks it is form him) that allows to rotate any bone for a layer with the rotation of othe bone in other layer (I don't remember its name now). ((please heyvern refresh my mind with the link...)
2) For some shapes and ppositions there is a problem with the curvature of the point. A projected curve have different curvature than its non projected curve. So you need to fix it manually for evey frame. It is not a problem as well as you are saving animation time using bones to realistically rotate the solid.

The last drawback is the big amount of bones that you need... :lol:

Enjoy!
Genete
User avatar
DK
Posts: 2849
Joined: Mon Aug 09, 2004 6:06 am
Location: Australia

Post by DK »

Hi Genete.
Thanks for the potatoe explanation. I think what is initially causing me confusion is that you are talking about rotating bones in 3D space. Isn't AS a 2D app? I am fine with how 3D bones work as i've used Lightwave for many years and can easily model and rotate a head, deform it etc in Lightwave and render it with a 2D filter like Swift to create a perfect 2D Flash style head rotation simulation complete with morph targets without getting my head around this very complicated Anime Studio bone mathematics. Don't get me wrong, I think what you guys are doing is brilliant!!!... but can't this stuff already be done a lot easier using a dedicated 3D app?

D.K
User avatar
Rasheed
Posts: 2008
Joined: Tue May 17, 2005 8:30 am
Location: The Netherlands

Post by Rasheed »

I see a fourth drawback, which makes this solution of really limited use:

All objects in virtual 3D space have to be located on the same sphere.

I could already see that in the 3D eye movement. The pupil isn't rendered realistically. In a front view, the pupil appears to be a round circle. In a side view, the pupil actually protrudes from the white of the eye, because of the shape the eye's lens. In your example animation it does not do such a thing.

If you try to do this with a nose in a face, the flaw in this method becomes even more obvious.

And to top it off, the human head isn't a sphere, so you couldn't use this technique for a head, neither cartoon or realistic.

I've briefly tried using similar techniques and saw the same flaws, so I gave up. My conclusion was that using your imagination and a firm basis of drawing skills, is much more precise (and faster) than a technical/mathematical approach. It seems there is no substitute for the skilled draftsman in 2D character animation.
User avatar
jahnocli
Posts: 3471
Joined: Fri Oct 29, 2004 2:13 pm
Location: UK

Post by jahnocli »

I think the point about the pupil of the eye is unbelievably picky -- these are CARTOONS we are talking about! And don't a lot of venerable animators talk about the importance of being able to visualise in simple 3D shapes? Nobody knows where these experiments will lead, and I for one am pleased that people are doing them, and believe that they deserve our support. If they help me at all in making animation I will be pleased to use them, that's for damn sure...
You can't have everything. Where would you put it?
User avatar
Touched
Posts: 504
Joined: Mon Dec 11, 2006 7:33 am
Location: Sunny California
Contact:

Post by Touched »

I agree with Jahnocli. I'm a supporter of research and development in all its forms. This may be the basis for further techniques we haven't thought of yet.
User avatar
Rasheed
Posts: 2008
Joined: Tue May 17, 2005 8:30 am
Location: The Netherlands

Post by Rasheed »

I'm all for experimenting, but calling the 3D eye movement "realistic" was perhaps somewhat biased by enthusiasm and excitement. It is a reasonably close approximation of reality, but not close enough to call it "realistic".

OTOH if realism isn't really what we're after here ("CARTOON"), why try to approximate it, especially if it takes so much time to set things up?

I'd rather see an application in which you could set the contours of a virtual 3D shape, instead of just plain spheres. Then you could draw vertical cross-sections at different heights, and let the virtual object behave according to those contours. It should also be possible that those contours are derived from an actual 3D object, created in an external 3D modeller. You would need to have two actuators to modify the virtual spatial angle, which could be bones. What you would see, is the outlines of the virtual 3D object, which the animator could fill with cartoon details. In fact, it would be a dynamic outline, based on the given contour map and the values of the two angle actuators. And if one could combine contour maps, to give you a dynamic combination of shapes, this would make a very powerful tools for the animator, because you could do 3D character animation in 2D space.

This would be a nice addition to the rotoscoping of video material.
User avatar
ulrik
Posts: 1087
Joined: Thu Aug 11, 2005 10:32 pm
Location: Stockholm Sweden
Contact:

Post by ulrik »

Thanks a lot for developing and this tutorial Genete! I'll study it when I have a lot of time get in to this very exciting issue. Maybe this will lead to some new unexplored ways to work with AS, as Touched and jahnocli said!

thank you!
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

@ all: Thankyou for your support guys.

@Rasheed: I think you have missed something in the explanation. You CAN model other things than an sphere. Yes I was so excited by the result of the eye. I know that the human eye is not an sphere. It has a bump where the iris is. That was my first rig and the theory was not understood by me completely. Writting the tutorial helped me to understand better the math stuff.
But think one thing: That eyeball can be reused as many times as I want in any character. Only change the relative size from the face size and the color of the iris and that's all...

------

Please watch this new animation. I have modeled a (very) symple nose with two eyes. Eyes and nose are binded to a higer bone layer called face. The bones on which the eyes and nose are binded are moved by other 3D "skeleton" in the face layer. Nose rotate individually as the eyes do . So by now I have to coordinate the rotation of every portion of the face with the rotation of the face itself. But a little more of setup control and the "copy movement of a bone to other bone script" would solve this work.

I have ordered the shapes of the nose to be good when the face is looking left (its left :lol:). when looking right the shape ordering is not ok. It needs to be fixed with a switch layer.

I think the result is beliable.

The animation and the file

http://amanoalzada.iespana.es/Mohostuff/eyes-nose.swf
http://amanoalzada.iespana.es/Mohostuff/eyes-nose.anme

One last remark. I need help with scripting. This "new" pseudo 3D rig needs some tricky scripts to help moving all bones in different layers coordinately. I know C++ programming (amateur self learner), but Lua and also Moho interface... ouch!...they freak me!!. So admired scripters!, put a hand in this proyect and suppot it with scripting!!. Thankyou in advance.

Regards
Genete
rplate
Posts: 257
Joined: Fri Oct 13, 2006 3:58 pm
Location: Minnesota USA

Post by rplate »

Genete wrote: Please watch this new animation. I have modeled a (very) symple nose with two eyes. Eyes and nose are binded to a higer bone layer called face. The bones on which the eyes and nose are binded are moved by other 3D "skeleton" in the face layer. Nose rotate individually as the eyes do . So by now I have to coordinate the rotation of every portion of the face with the rotation of the face itself. But a little more of setup control and the "copy movement of a bone to other bone script" would solve this work.

I have ordered the shapes of the nose to be good when the face is looking left (its left :lol:). when looking right the shape ordering is not ok. It needs to be fixed with a switch layer.

I think the result is beliable.

The animation and the file

http://amanoalzada.iespana.es/Mohostuff/eyes-nose.swf
http://amanoalzada.iespana.es/Mohostuff/eyes-nose.anme

Regards
Genete
I think YOU are unbelievable!
You are amazing!
It's my understanding that most video game animation could not be possible without mathamtical algorithms. So I think your scripting has a very important part in animation.
I'm too mathematically illiterate to even begin to undrstand what it all means. But I can still marvel at your talent. Especially when I realize you are SELF taught. Keep on keeping on.
human
Posts: 688
Joined: Tue Jan 02, 2007 7:53 pm

Post by human »

Genete wrote:

"I know C++ programming (amateur self learner), but Lua and also Moho interface... ouch!...they freak me!!"

OK, so I've been biting my tongue for a long time, but now I'm going to say what's been on my mind.... a feature request for AS: Javascript as the scripting language.

Here's why:

(1) Good implementations of ECMAScript (Javascript) are mature and completely open-source available (if I understand correctly).

(2) Javascript is plenty powerful enough. It even supports advanced concepts like functional programming. And hey, if it's good enough Adobe-Macromedia and Flash, it's good enough for AS.

(3) What's the ratio of capable Javascripters to capable Lua scripters? A million to one, or what?

(4) Flash and DHTML algorithms could be ported to AS.

It seems to me that any one of these reasons ought to be viewed as compelling, but take them in combination, and it seems like a nobrainer.

OK, I'm waving the torch in front of Frankenstein's castle. Anybody else want a light?
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

rplate wrote:I think YOU are unbelievable!
You are amazing!
It's my understanding that most video game animation could not be possible without mathamtical algorithms. So I think your scripting has a very important part in animation.
I'm too mathematically illiterate to even begin to undrstand what it all means. But I can still marvel at your talent. Especially when I realize you are SELF taught. Keep on keeping on.
I apreciate your words so much rplate. Yes maths are with all of us every time in real world.

To be honest maths are not new for me. I'm mechanical engineer and my mind is "mathematically" trained. Nowadays it is only a little "rusty" but I think I'm trained again.

One remark. There is no script aid in the shown animation. Only bone control.
Regards
Genete
User avatar
Rasheed
Posts: 2008
Joined: Tue May 17, 2005 8:30 am
Location: The Netherlands

Post by Rasheed »

Lua is actually much easier to learn to JavaScript. Of course, as a former C++ programmer, you'd be more familiar with the JavaScript appearance, but once you get over the unfamiliarity, Lua is actually quite a relief. It has a very small set of language elements, which are easy to remember. This makes it much easier to develop scripts, because you don't have to refer to obscure language elements in a large reference manual. The core language has only these 21 reserved keywords:
and, break, do, else, elseif, end, false, for, function, if, in, local, nil, not, or, repeat, return, then, true, until, while
Furthermore, Lua is very easy to extend. New C-functions can be written quite easily. And last but not least, Lua has a small footprint and is very fast in execution. It is, in fact, the preferred embedded language for many (non-Microsoft) applications, next to Python.

JavaScript isn't used as much as an embedded language in applications, because its strength lies in AJAX enhanced (XML) web applications, although that is rapidly being replaced by Ruby on Rails, which has a syntax that is comparably easy to understand as both Lua and Python.

See Lua: an Extensible Embedded Language. A few metamechanisms replace a host of features for an overview of the extensibility of Lua.

The reason that Anime Studio scripting is so hard is because Lost Marble hasn't put much effort in properly documenting the Lua interface, nor in supplying a basic tutorial and some good scripting examples. One can only hope that more people are put on the Anime Studio project and more effort is put in trying to improve the currently poor documentation. Experienced programmers probably don't have much problems with the documentation, but novice programmers need much more guidance and examples than the current version of the Scripting Documentation offers. The scarcely documented tool and menu scripts simply won't do!

Using Javascript as the scripting language for AS wouldn't make it easier to write scripts if the documentation isn't improved.
Post Reply