Difference between revisions of "Animation"

From Second Life Wiki
Jump to navigation Jump to search
m (Update entry for glossary (extract from Glossary))
m (New page have been created for the tutorial part^^)
Line 1: Line 1:
{{Help
{{Help
|Avatar=*
|Glossary=*
|Glossary=*
}}
}}
Line 7: Line 6:
You can use animations to make your avatar clap their hands, dance, blow someone a kiss, and much more.  
You can use animations to make your avatar clap their hands, dance, blow someone a kiss, and much more.  


Check out [http://www.gup.uni-linz.ac.at/~gk/Diplom/CART-Martin.pdf Martin Garstenauer's thesis] for a good introduction to the principles of character animation.  Find out what a quaternion is.  See [[Internal Animation Format]] for a description of the animation data format.
== See Also ==
 
* [[How to create animations]]
Custom animations can be created in programs such as Poser, Blender, and others. In 2005, one resident-made program was relased, called [http://caladan.nanosoft.ca/c4/software/posemaker.php Posemaker]([http://forums.secondlife.com/showthread.php?t=44734 ref-thread]). And in 2006, two Free ones were released: [http://www.avimator.com/ Avimator] ([http://forums.secondlife.com/showthread.php?t=81886 ref-thread]) and [http://sourceforge.net/projects/free-bvh-editor slat] ([http://forums.secondlife.com/showthread.php?t=83702 ref-thread]). They can be imported from these programs into Second Life by storing them as Biovision Hierarchy files, which have a file extension of BVH, and using the main menu '''File > Upload Animation''' command. There is a L$10 fee for uploading an animation. Animations can be previewed prior to uploading.
* [[Video Tutorial/Creating & uploading animations]]
 
Animations can be used in [[gestures]] in Second Life but should not be confused with gestures.
 
Animations in one's [[inventory]] can be activated by double clicking the animation name in the inventory list, or by right-clicking the animation name and selecting '''Open''' from the context menu. This will produce a dialog box with the animation name, a field in which to see or enter a description of the animation, and two buttons: '''Play in World''' and '''Play Locally'''. '''Play Locally''' will cause the user to see the animation but it will not will be visible to other Residents. This is useful to make sure the animation is really something you want others to see your avatar doing. '''Play in World''' will cause the Residents within visual range to see your avatar perform the animation.
 
There are many animations available inworld, both free and for sale. You can get started locating some by pressing the '''Search''' button in the bottom of the SL screen, selecting the '''All''' tab, and entering "animation" as a search term.
 
== Basic Knowlege For Creating SL Animations ==
 
'''1. The BVH file'''<br />
The BVH is the text data that describes each figure part's rotation and position along a timeline.
 
'''2. Hip is the top'''<br />
Hip is the top of the hierarchy construction of figure in BVH. So, if you want to move the whole body, you have to move the hip.
 
'''3. Keyframe'''<br />
Animation is created by keyframe animation. It is an animation technique which builds the frame that sets up the position and rotation angle of the part called a keyframe. A computer carries out a complementary automatic calculation and creates the motions in frames between keyframes. A keyframe is built for every part.
 
'''4. The first frame'''<br />
You can create a stationary posture just by one frame animation, but note that you cannot move the whole body and cannot assign multiple priorities. This is convenient when you want an absolutely stiffened posture. The first frame of the animation that you created is used as reference information for the root part (hip) between BVH and SL. The first frame's posture doesn't appear inworld at all, but is recognized as a keyframe. Inworld animation only occurs after there is a difference from the position of the first frame and a rotation angle. Therefore, a stationary pose is actually composed to two separate frames. It is a good idea to set at zero on every parts' rotation and position at the first frame (a "T" pose) because it makes it easier to keep track of which parts you moved.
 
To recap: The first frame of an animation is a reference frame and is not shown in-world; any deviation from the first frame, however, will be interpreted as an avatar animation.
 
'''5. Spline interpolation'''<br />
If the tool has a spline interpolation feature, you may encounter some frustration until you knew how to control it. Use the cutting spline option which should be implemented too, such as <s>"[http://forums.secondlife.com/attachment.php?attachmentid=21043 Break spline]"</s>(link broken).
 
'''6. [http://en.wikipedia.org/wiki/Inverse_kinematics Inverse Kinematics]'''<br />
If the tool has the inverse kinematics feature and it's turned on, you might find it frustrating until you knew how to turn it off. Find it and learn how to turn it on/off.
 
'''7. Speed of the animation'''<br />
The default speed of animation is 30 FPS, that is it takes 1 second to play 30 frames. If you want 10-second animation, you need to create 300 frames. But you may also be able to change FPS value on each tool. And note that SL allows you to upload an animation up to 30 seconds.
 
'''8. Priority'''<br />
8-1: [[Internal_Animations|The default built-in animations]] are always available to your avatar in-world. They may have different priorities on each keyframed part, unlike uploaded animations which always have the same animation on the whole body. Unless you give a higher priority to your animations, your animations will be overriden by them in-world. Priorities range from 0 to 4, with 4 being the highest priority. See [[Internal_Animations|the default built-in animations]] page to make sure what kind of priority each animation has.<br />
8-2: Priority for uploaded animations is only given for the whole avatar, and is set in the uploading window. However, unless you animate each individual part of the avatar in your animation, some parts may be overridden by default animations (breathing, walking, etc.)<br />
8-3: A later playing animation is given priority over the former one when their priorities are the same.
 
'''9. Optimization'''<br />
SL's BVH importer does optimization of animation data prior to upload into SL. Joint rotations with very slight changes from keyframe to keyframe will be interpreted as *not* changing and thus aren't stored. This is done intentionally since custom animation data is stored on our servers and downloaded to each viewer as it is needed in real time, and needs to be fairly terse.<br />
The potential side effect of the optimization is what you have observed; joints with very subtle movement might have their animation data dropped entirely on upload. The threshold formula is complex, and involves comparing all three axes of data per joint, the distance moved between keyframes, as well as the joint's position in the skeletal hierachy.
 
'''10. Scale of the avatars' parts'''<br />
There is a difference between the scale of the figure's parts on the tool and your avatars in-world. Even if you adjust the position of parts on the tool, it may show you incorrectly in-world. You may see the avatar sitting while hovering or sinking under ground. The hip moves by the absolute value. Meanwhile, your avatar's height depends on the body shape of the avatar. You cannot help but keep in mind how they are suitable for the position and go back to the tool. Then you have to tweak them again while ignoring the shape of figure on the tool.
 
'''11. Facial and Hands morph'''<br />
Unfortunately, you cannot customize these animations. You can just select the built-in ones and add them to your animation on the uploading window. You can also evoke the built-in facial animations by script.
 
It is said those options [http://jira.secondlife.com/browse/VWR-1793 are] [http://jira.secondlife.com/browse/VWR-5587 broken] for a long time, however.
 
'''12. Uploading window'''<br />
1. Name: Your animation file's name.<br />
2. Description: You can write something here as a note.<br />
3. Priority: The range is 0-4. 4 is the highest value.<br />
4. Preview while: You can select several [[Internal Animations|internal animations]] to make sure your animation while playing.<br />
5. Loop: Click and put the check mark here to get a looping animation. It is not used when you create a stationary pose.<br />
6. In(%) &amp; Out(%): You can select the range where you want to loop your animation in the whole timeline. Note, it starts from the first frame first, and then loops. So when you set 100% in the both fields, you can get an animation that starts moving and stops with the stationary pose at the last frame.<br />
7. Hand Pose: You can select and add one of the several hand morphs to your animation here (broken).<br />
8. Expression: You can select and add one of the several facial morphs to your animation here (broken too).<br />
9. Ease In(sec) &amp; Ease Out(sec): This setting allows you to set the amount of time for your avatar to realistically ease (or morph or tween) into an animation from it's current pose, or out from the end of the animation into the next.  A setting of 0.000 will cause your avatar to snap instantly into the new pose, instead of smoothly transitioning there.  This setting is measured in seconds.<br />
10. Play &amp; Stop buttons: You can play your animation to make sure before uploading here.<br />
11. Pose screen: Just click and drag up-down on the screen, the camera moves zoom in/out. Drag left-right, the camera turns around the figure. Hold '''Ctrl''', '''Shift''' or '''Alt''' and drag, and the camera can move in all directions.
 
== Creating Animations in Poser ==
 
''This addition to the Wiki is very Poser-5/6 centric.''<br />
 
* The default Poser 6 has a lot of bugs including bvh exporting.You have to get the latest updated patch, SR2 or at least SR1 from [http://www.e-frontier.com/go/downloads Updates &amp; Documentations].
 
=== Setting up Poser ===
First, you will want to get the Poser characters from [http://secondlife.com/community/avatar.php here].The ZIP file includes a BVH of the "default pose". Be sure to have that where you can find it easily. There are directions in the ZIP file for installing the characters so you can use them on Poser.
 
On the '''POSE''' tab screen of Poser, you should usually open the following windows. They are under the pull-down '''Window''' menu:
 
'''Parameter Dials: You can move or rotate the selected part by using these dials or inputting digits directly after clicking the value text.<br />'''Animation Palette''': You can add and edit the whole frames and keyframes on each part. And you can play and make sure your animation from here.
 
Now you can see mainly three windows, the Preview in where the SL figure you added is, the '''Parameter Dials''' and the '''Animation Palette'''.<br />
On the '''Animation Palette''',you'll find all parts' name of the figure on the left side of the window. Green dots means keyframes. You will see them on the first frame. You can click and select any frame and add a keyframe by pressing the "plus" button on the upper side of the window. You can also delete it by the "minus" button. Click any frame and drag cursor, and you can select multiple frames of parts.<br />
You see "'''Play range'''" on the bottom of the '''Animation Palette'''. Tweak the range from the second frame to the end to play and make sure your animation without the first frame pose.<br />
Select '''General Preferences''' which is found under "Edit" on the main poser window. Click the interface tab and choose "'''Meters'''" instead of "'''Feet'''" . This is because SL uses meters as the standard unit. Then select "'''Launch to previous state'''" in the '''Launch Behavior''' section of the same tab and press "'''OK'''". Now you can get this state whenever you start Poser.
 
=== Creating a sitting pose ===
1. Input the value "2" in the right side field of "Of" where is theright top of the Animation Palette window to set up two frames as thewhole frame.<br />
2. Make sure when you select the second value of any part on theAnimation Palette or input the value "2" in the field between "Frame:"and "Of", it turns to be "Frame: 00002 Of 00002". This second frame becomes the starting frame in SL.<br />
3. Make sure you turn off Inverse Kinematics on the both of legs under "Figure" pull-down menu to move the whole body freely.<br />
4. Select Hip. You can select it by clicking the figure's hip directly on Preview window or clicking the second frame of Hip on the Animation Palette.
 
'''Note1: Hip is the top of the hierarchy construction of figure in SL(bvh). And "Body" and "CenterOfMass" parts aren't translated into BVH, so that they won't show any movement in world at all. What is worse that when you touch them, you'll be confused a lot because thegap of Poser and SL becomes large. You'd better not to move the both"Body" and "CenterOfMass".'''
 
5. Input "-0.4" in the field of "move down-up" on the Parameter Dials window.<br />
6. Select Left Thigh and input "-90" in the xRotate field on the Parameter Dials window.<br />
7. Select Left Shin and input "90" in the xRotate field on the Parameter Dials window.<br />
8. Select Left Foot and input "1" in the xRotate field on the Parameter Dials window so it's not to be overridden. (rf. Priority of The Basic Knowledge)<br />
9. Using "Symmetry" which is under the pull-down "Figure" menu and copy left legs to right legs. The dialog box doesn't matter which you selectbecause you're using symmetric scale parts figure.<br />
10. Save this file as a Poser file (pz3) because you might change this later.<br />
11. Select "Export/BVH motion..." under the pull-down "File" menu. And select "Scale automatically" on the dialog box before creating BVH file.
 
=== Uploading your animation ===
 
1. Select "Uplaod Animation" under the pull-down "File" menu where is the top of screen in world.<br />
2. Select your BVH file which you created.<br />
3. The upload window opens. You have to set the followings on the window.<br />
Priority: "4" (rf. Priority of The Basic Knowledge)<br />
4. Insert the check mark next to "Loop" by clicking. Pose is just the looping animation of the second frame.<br />
5. "In(%)" &amp; "Out(%)" are from where start and to where end to play your animation in the whole frame. Now this doesn't matter because you created just one frame.<br />
6. "Pose Hand" &amp; "Expression" are options. They are hand and face morph.<br />
7. In "Ease In(sec)" &amp; "Ease Out(sec)", you can add time dilation to play and stop your animation. If you put "1"(sec) in "Ease In(sec)"field, the avatar will take 1 sec to sit while morphing.<br />
8. Press Play button and make sure how your animation is good. You can select "Preview while" pull-down menu, such as walking, sitting and so on.
 
'''Note2: You'll find the upper body moves while walking. It is because you didn't move them at all on Poser and the priority is set at the lowest.''' (rf. Priority of The Basic Knowledge)
 
9. Press "Upload(L$10)" button and get your animation.
 
'''Note3: You may see the avatar sitting while hovering or sinking underground. The hip moves by the absolute value. Meanwhile, your avatar's height depends on how you created them. The length of legs is up to avatars. Keep in mind how it is suitable for the height and go back to Poser. Then you have to create again while ignoring the shape of figure on Poser.'''
 
==== The simple whole body spinning animation : about priorities ====
 
1. Set the whole frames at 30 frames.<br />
2. Just create a keyframe on the hip at the 2nd frame. It becomes the 1st frame of animation in world.<br />
3. Make sure you turn off Inverse Kinematics on the both legs.<br />
4. Select the last frame and input value 360 in the "spin right-left" field on the Parameter Dials.<br />
5. You can see your proper aniamtion on Poser.<br />6. Uplodad your animation with Priority set at 4 and with Loop on.
 
Now, you'll find your animation odd. It spins but the head is doing a reverse rotation and looks in the state of still seeing the front. It is because the default built-in standing animation has a higher priority on its neck and head parts. You didn't move those parts in the process of creating it above and those parts are set at the lowest priority. They are thus overridden by the default standing animation.
 
Solution
 
Set the neck of the xRotate at 1(degree) and the head of the xRotate at -1(degree) on Poser.
 
=== The usage of Inverse Kinematics ===
 
Inverse Kinematics is one of the most useful tool to create animation.<br />
Let's learn how to use while you actually create animations. This sample is "Push-ups animation".
 
The female figure is used in this animation.<br />
1. Prepare 30 frames as the whole frame and select the 2nd frame to start to create your animation.<br />
2. Make sure you turn off Inverse Kinematics on all of the parts.<br />
3. Select Hip and input "90" in the "pitch up - down" field.<br />
4. You'd better see your figure from the side by Camera Control.<br />
5. Input "-0.4" in the "move up-down" field.<br />
6. Select Left Thigh and input "-20" in the "xRotate" field for its tiptoe to reach the floor.<br />
7. Control camera and see your figure from the front.<br />
8. Select Left Collar and input "-20" in the "forward - back" field.<br />
9. Select Left Shoulder and input "-60" in the "reach down - up" field.<br />
10. Select Left Forearm and input "-5" in the "bend front - back" field.<br />
11. Control camera and see your figure from the side again.<br />
12. Select Left Hand and input "90" in the "bend front - back" field.<br />
13. Now that you see the hand is floating from the floor a bit, select Abdomen and input "15" in the "bend back - forward" field.<br />
14. Select Chest and input "-10" in the "bend back -forward" field.<br />
15. And "-10" in the "bend up - down" field of both Neck and Head.<br />
16. Use "Symmetry" and copy the left side body to the right side one.<br />
17. '''Now turn on Inverse Kinematics on all of arms and legs.'''<br />
18. Select Hip and go to the 15th frame.<br />
19. Input "-0.7" in the "move down - up" field.<br />
20. You see legs and arms are also bent.<br />
21. Input "0.03" in the "move backwards - forwards" field to unbend legs.<br />
22. Select Abdomen and input "-5" in the "move back - forward" field.<br />
23. Input "-20" in the "back - forward" field of Chest, "bend up - down" field of Neck and Head.<br />
24. Select and copy Hip, Abdomen, Chest, Neck and Head at the second frame to the last frame.<br />
25. Go back to the second frame and ''break spline'' on those five keyframes.<br />
26. Delete the unnecessary camera's keyframes.<br />
27. Play your animation.<br />
28. You may notice the leg movements are a little bit odd.<br />
29. Select Hip and go to the 8th frame, and input "0.03" in the "move backwards - forwards" field to unbend legs.<br />
30. Go to the 23th frame, and input "0.03" in the "move backwards - forwards" field to shift the median point to forward a tad.<br />
31. Now you can see your figure do push-ups well on Poser. And you are sure to notice that you can make an animation with tweaking just a few parts of keyframes.<br />
32. Save it as the pz3 and export it into BVH. Upload it in world with Priority at 4 and Loop on.<br /><br />
'''Note that you may find this animation looks bad for your Avatar inworld, such as hands are floating, legs are shivering. It is the exact scale issue. Try to change to several sizes' avatar and make sure it.'''
 
==See also==
* [[Animations]]
* [[Internal Animations]] list

Revision as of 14:24, 14 September 2008