1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
<html>
<title>BVJ</title>
<head>
</head>
<body bgcolor="black" text="white" alink="red" link="blue" vlink="purple">
<p>BVJ is extensions to the BVH animation format used by SL technology.
It's in the ClientHamr section coz on the server side, they are just
dealt with as blobs to be sent to the viewers. This may change if we
implement animating link sets, and interaction with the sim physics.</p>
<h2> Syntax </h2>
<p>This example BVH is 20 lines 505 characters, and defines a pointless animation on a trivial skeleton.</p>
<pre> HIERARCHY
ROOT Hips
{
OFFSET 0.00 0.00 0.00
CHANNELS 6 Xposition Yposition Zposition Zrotation Xrotation Yrotation
JOINT RightUpLeg
{
OFFSET -3.91 0.00 0.00
CHANNELS 3 Zrotation Xrotation Yrotation
End Site
{
OFFSET 0.00 -3.46 0.00
}
}
}
MOTION
Frames: 2
Frame Time: 0.033333
8.03 35.01 88.36 -3.41 14.78 -164.35 13.09 40.30 -24.60
7.81 35.10 86.47 -3.78 12.94 -166.97 12.64 42.57 -22.34
</pre>
<p> </p>
<h3> JSON </h3>
<p>First the syntax is changed to be JSON. The sample above is transformed to 19 lines 715 characters:</p>
<pre> {
"HIERARCHY":{
"NAME":"Hips",
"OFFSET":[0.00,0.00,0.00],
"CHANNELS":["Xposition","Yposition","Zposition","Zrotation","Xrotation","Yrotation"],
"JOINTS":[
{
"NAME": "RightUpLeg",
"OFFSET": [-3.91, 0.00, 0.00],
"CHANNELS": ["Zrotation", "Xrotation", "Yrotation"],
"JOINTS": [
{
"END": true,
"OFFSET": [0.00, -3.46, 0.00]}]}]},
"MOTION":{
"Frame Time":0.033333,
"Frames":[
[8.03,35.01,88.36,-3.41,14.78,-164.35,13.09,40.30,-24.60],
[7.81,35.10,86.47,-3.78,12.94,-166.97,12.64,42.57,-22.34]]}}
</pre>
<p>or equivalently to 5 lines 469 characters:</p>
<pre> {"HIERARCHY":{"NAME":"Hips","OFFSET":[0.00,0.00,0.00],"CHANNELS":["Xposition","Yposition","Zposition","Zrotation","Xrotation","Yrotation"],
"JOINTS":[{"NAME":"RightUpLeg","OFFSET":[-3.91,0.00,0.00],"CHANNELS":["Zrotation","Xrotation","Yrotation"],
"JOINTS":[{"END":true,"OFFSET":[0.00,-3.46,0.00]}]}]},
"MOTION":{"Frame Time":0.033333,"Frames":[[8.03,35.01,88.36,-3.41,14.78,-164.35,13.09,40.30,-24.60],
[7.81,35.10,86.47,-3.78,12.94,-166.97,12.64,42.57,-22.34]]}}
</pre>
<p>or equivalently 1 line of 461 characters, which I won't include in this document. I have worked though larger examples and this is a very typical compression ratio. A BVJ file (using sampling) is about the same size as a BVH file.</p>
<p> </p>
<h2> Semantics </h2>
<p>The semantics are that the "Hips" and the "RightUpLeg" of something are animated. The mapping from the BVJ file's "NAME" fields to the avatar skeleton is straightforward, the names in the BVJ are matched against the names of the skeleton components. Then the appropriate rotations and translations are applied frame by frame.</p>
<p>The point of the hierarchy is so that when a joint moves or rotates, it's children get carried along for the ride. When you turn the hips left in the sample BVJ, the whole body turns left.</p>
<p>Note that the "offset" value isn't actually used when animating avatars. The position of the hips and the angles are all used, but no attempt is made to match the skeleton bone lengths to the BVH segment lengths. So I propose that we can eliminate them or make them optional to reducing lag and file size. The offsets are useful in other tools because they define a skeleton that can be visualised.</p>
<p> </p>
<h2> Attachment points </h2>
<p>The hierarchy portion of a BVJ is a fine place to express attachment points.</p>
<p> </p>
<h3> Syntax </h3>
<pre> ...
{
"NAME": "RightUpLeg",
"ATTACH": [12],
"OFFSET": [-3.91, 0.00, 0.00],
...
</pre>
<p> </p>
<h3> Semantics </h3>
<p>The semantics are that an attachment point can be created for each item in the hierarchy at the midpoint between its parent's position, and the end of it's offset.</p>
<p>When a client rezzes in, they could parse and read their current skeleton's BVJ, and use that to tell other clients what attachment point 103 means. No more prims stuck in your crotch floating in space as you walk away.</p>
<p>Q: How to define the zero rotation at the attachment point? Need to match what is done now.</p>
<p> </p>
<h3> Multi-attach </h3>
<p>If I want to attach two things to my pelvis, say a skirt and a tail, I should be allowed to. There are two ways the client could communicate this to a server, depending on the servers rules. A nice server says "Sure, attach your whole inventory to your head, what do I care?". A mean one says "That attachment point is in use." For mean servers the client can just make a new attachment point at the same place. It would update it's skeleton BVJ to include:</p>
<pre> ...
{
"NAME": "RightUpLeg",
"ATTACH": [12,99]
"OFFSET": [-3.91, 0.00, 0.00],
...
</pre>
<p> </p>
<h3> Still More Attachments </h3>
<p>I would like to further enhance the client to add attachments *at* the joints themselves with the semantics that they average (in some sense of the word) the directions of the two segments from the joint to the beginning of the parent segment and from the joint to end of child segment. The motivation is to have kneecaps/kneepads that move reasonably without special attention from an animator.</p>
<p> </p>
<h2> Animating Prims </h2>
<p>BVH was defined with skeletons in mind. But, at first glance it seems that if there were some two (or more) prim object with a root prim named "Hips" and another prim named "RightUpLeg" we should be able to animate that link set using this same BVH/BVJ file.</p>
<p>The one issue is that segments in the BVH model are like vectors, they have a near end, a far end, a length, and they rotate about their near end. In particular bones have no width or depth, only length.</p>
<p>So I propose adding "PIVOT":[x,y,z] to define about what part of a prim the prim rotates when being animated. When omitted the centre of the prim is used, and is equivalent to "PIVOT":[0,0,0]. The pivot ranges from -1 to 1 on each axis with -1 meaning the small end and 1 the large end. For example consider a cylinder, "PIVOT":[0,0,0.5] would rotate about the point midway between the centre of the cylinder and the +Z face of the cylinder, i.e. half way up to the top. "PIVOT":[0,0,1] would make the cylinder act like a normal bone making up a skeleton.</p>
<p> </p>
<h2> Animating Attached Prims </h2>
<p>Things are interesting when I want to define an animation of my avy and an attachment to my avy. Suppose when applying an animation from a BVH or BVJ that I get to a joint named "tail" with a defined attachment point 103. If my avatar is wearing something at point 103, then search that object for a prim named "tail". If I find a prim named "tail" in the attachment then this joint's animation applies to that prim. And all the children of the "tail" joint in the animation are sought in the link set of the attachment.</p>
<p> </p>
<h3> Yet More Attachment Points </h3>
<p>Why yes, that *does* mean attachments can have attachments, glad you asked. Suppose my tail has three bones, and the attachment point defined for the last bone is 104. I could attach the tail to point 103, and a pretty bow to point 104. The data model would be avy attachment point 103 has "thin neko tail with pink tip" attached, and avy attachment point 104 has "pretty bow" attached. But because point 104 is defined on a child joint of the joint with attachment point 103, the object "Pretty Bow" would move with a part of the tail, not with some random part of the avy.</p>
<p> </p>
<h2> Sampling and Keyframing </h2>
<p>The BVH file format was originally created for motion capture. So it defines animations by means of sampling. The same way a motion picture film samples the world 24 times a second making still photographs, the BVH captures the values on all the channels at regular points in time. But not all animations are created by motion capture, perhaps most are made with a keyframing animation system.</p>
<p>Keyframing is cool because it uses the computer to compute all the between states. We tell the computer at time T0 arm is at 13 degrees rotation, and at time T10 it is at 23 degrees rotation, and the computer figures out where the arm needs to be rotated at all points in time between T0 and T10. This can result in smaller animation files and lower CPU usage.</p>
<p> </p>
<h3> Keyframe Syntax and Semantics </h3>
<p>I propose adding keyframe syntax as an alternative to the existing "MOTION" section of BVH files.</p>
<pre> {
"HIERARCHY":{...},
"KEYFRAMES":[
{
"AT":0.00,
"Hips":[8.03,35.01,88.36,-3.41,14.78,-164.35],
"RightUpLeg":[13.09,40.30,-24.60]},
{
"AT":0.033333,
"Hips":[7.81,35.10,86.47,-3.78,12.94,-166.97],
"RightUpLeg":[12.64,42.57,-22.34]}]}
</pre>
<p>The semantics are that the value of any channel is the linear interpolation of it between the two closest keyframes in time. Though maybe should support other interpolation schemes such as quadratic, and cubic. I think it's obvious that this will often result in much smaller animation files. My example above is fairly pointless since it is just changing every sample in the BVH into a keyframe. As a result it is bigger, but a possible benefit is that it slightly better supports playback at frame rates other than that specified in the BVH.</p>
<p> </p>
<h2> Animations, Not BVH Files </h2>
<p>Another enhancement I want to add is to capture all the elements of an in-world animation in the format. In world animations have things like priority, looped or one shot, loop start/end points, ease-in and ease-out etc.. There is no place for them in a BVH, but not much creativity is needed to put them in a BVJ file. Then we can edit those parameters, set them in the file before import, and save them in a file on export.</p>
<p>I favor this placement</p>
<pre> {
"priority":3.5,
"looped":false,
"HIERARCHY":{ ... } ...}
</pre>
<p>But can see arguments for this instead</p>
<pre> {
"HIERARCHY":{ ... }
"MOTION": {
"priority":3.5,
"looped":false,
...} ...}
</pre>
<p> </p>
<p> </p>
<h2> At This Time </h2>
<p>The last enhancement I want to make is to add absolute time references. Consider using the BVJ file to define the animations of the hands on a analogue clock. I would like to be able to express "At noon, all hands are pointing up." What this means is when invoking an animation we need to map from the Unix time to the animation's time. This is a linear mapping so two numbers are required, one expresses how many animation seconds elapse for each Unix second, the second specifies at what Unix time at which the animation time 0 occurs. There is a third number implied by looping animations. How long the animation is. Note a looping animation often begins to loop at some point <strong>after</strong> animation time 0 and ends <strong>before</strong> the largest animation time in the file. This is due to the types of interpolation used when keyframing. Linear interpolation requires two keyframes before a position can be known, quadratic 3, and cubic 4.</p>
<p> </p>
<h2> Tools to Make BVJ Files </h2>
<p>Currently there are none, but see <a href="InworldAnimationEditor.html">InworldAnimationEditor</a> for my ideas. It should be obvious how to transform a BVH into a BVJ file that uses sampling. By looking at the rates of change of channels it is possible to discover inflection points and use them to synthesise a keyframe representation that is a close match to a set of samples.</p>
<p>And, of course, I want to make this file format editable in-world using nice GUI and 3D editing tools. Basically a clone of QAvimator in the client.</p>
<p> </p>
<h2> Client to Client </h2>
<p>There are use cases where it makes good sense to communicate an animation between clients with almost no server interaction. Why pay 10 Bogus-Bucks to adjust the position of my hand as we sit next to each other. I'll just edit my avatar to move my hand and the client will make a BVJ file ship it to your client which will show it to you.</p>
<p> </p>
<h3> Changing Poses </h3>
<p>Fang Said: See the very last paragraph of <a href="../SledjHamr.html">SledjHamr</a>, the "random notes from my old Web 3.0 document " section at the bottom, to see one suggested method of moving your hand.</p>
<p>Alice Replied: Looks cool, but requires Inverse Kinematics (if you mean the touch commands), or some puppeteer protocol that I know nothing about.</p>
<p>What I imagine right now is <a href="InworldAnimationEditor.html">InworldAnimationEditor</a></p>
<h2>links</h2>
<p>Some useful links for actually writing animation code -</p>
<a href="https://en.wikipedia.org/wiki/Portal:Computer_graphics">Portal:Computer_graphics</a>
<a href="https://en.wikipedia.org/wiki/3D_computer_graphics">3D_computer_graphics</a>
<a href="https://en.wikipedia.org/wiki/Skeletal_animation">Skeletal_animation</a>
<a href="https://en.wikipedia.org/wiki/Morph_target_animation">Morph_target_animation</a>
<a href="https://en.wikipedia.org/wiki/Inverse_kinematics">Inverse_kinematics</a>
<p> </p>
<a href="http://bvhacker.com/">bvhacker.com</a>
<a href="http://www.character-studio.net/bvh_file_specification.htm">bvh_file_specification</a>
</body>
</html>
|