diff options
author | David Walter Seikel | 2016-01-01 21:57:24 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-01-01 21:57:24 +1000 |
commit | bc44e6b3339976fc08d86eecc79f972fb90aecab (patch) | |
tree | 8c4dc473840ba773a7a2ee393b2045cc758dc024 /docs/BVJ.html | |
parent | Added a test HTML page for bringing the design docs into the source repo. (diff) | |
download | SledjHamr-bc44e6b3339976fc08d86eecc79f972fb90aecab.zip SledjHamr-bc44e6b3339976fc08d86eecc79f972fb90aecab.tar.gz SledjHamr-bc44e6b3339976fc08d86eecc79f972fb90aecab.tar.bz2 SledjHamr-bc44e6b3339976fc08d86eecc79f972fb90aecab.tar.xz |
Import the design docs from Drupal / MediaWiki.
Diffstat (limited to 'docs/BVJ.html')
-rw-r--r-- | docs/BVJ.html | 160 |
1 files changed, 160 insertions, 0 deletions
diff --git a/docs/BVJ.html b/docs/BVJ.html new file mode 100644 index 0000000..c96574d --- /dev/null +++ b/docs/BVJ.html | |||
@@ -0,0 +1,160 @@ | |||
1 | <html> | ||
2 | <head> | ||
3 | </head> | ||
4 | <body bgcolor="black" text="white" alink="red" link="blue" vlink="purple"> | ||
5 | <h2> Syntax </h2> | ||
6 | <p>This example BVH is 20 lines 505 characters, and defines a pointless animation on a trivial skeleton.</p> | ||
7 | <pre> HIERARCHY | ||
8 | ROOT Hips | ||
9 | { | ||
10 | OFFSET 0.00 0.00 0.00 | ||
11 | CHANNELS 6 Xposition Yposition Zposition Zrotation Xrotation Yrotation | ||
12 | JOINT RightUpLeg | ||
13 | { | ||
14 | OFFSET -3.91 0.00 0.00 | ||
15 | CHANNELS 3 Zrotation Xrotation Yrotation | ||
16 | End Site | ||
17 | { | ||
18 | OFFSET 0.00 -3.46 0.00 | ||
19 | } | ||
20 | } | ||
21 | } | ||
22 | MOTION | ||
23 | Frames: 2 | ||
24 | Frame Time: 0.033333 | ||
25 | 8.03 35.01 88.36 -3.41 14.78 -164.35 13.09 40.30 -24.60 | ||
26 | 7.81 35.10 86.47 -3.78 12.94 -166.97 12.64 42.57 -22.34 | ||
27 | </pre> | ||
28 | <p> </p> | ||
29 | <h3> JSON </h3> | ||
30 | <p>First the syntax is changed to be JSON. The sample above is transformed to 19 lines 715 characters:</p> | ||
31 | <pre> { | ||
32 | "HIERARCHY":{ | ||
33 | "NAME":"Hips", | ||
34 | "OFFSET":[0.00,0.00,0.00], | ||
35 | "CHANNELS":["Xposition","Yposition","Zposition","Zrotation","Xrotation","Yrotation"], | ||
36 | "JOINTS":[ | ||
37 | { | ||
38 | "NAME": "RightUpLeg", | ||
39 | "OFFSET": [-3.91, 0.00, 0.00], | ||
40 | "CHANNELS": ["Zrotation", "Xrotation", "Yrotation"], | ||
41 | "JOINTS": [ | ||
42 | { | ||
43 | "END": true, | ||
44 | "OFFSET": [0.00, -3.46, 0.00]}]}]}, | ||
45 | "MOTION":{ | ||
46 | "Frame Time":0.033333, | ||
47 | "Frames":[ | ||
48 | [8.03,35.01,88.36,-3.41,14.78,-164.35,13.09,40.30,-24.60], | ||
49 | [7.81,35.10,86.47,-3.78,12.94,-166.97,12.64,42.57,-22.34]]}} | ||
50 | |||
51 | </pre> | ||
52 | <p>or equivalently to 5 lines 469 characters:</p> | ||
53 | <pre> {"HIERARCHY":{"NAME":"Hips","OFFSET":[0.00,0.00,0.00],"CHANNELS":["Xposition","Yposition","Zposition","Zrotation","Xrotation","Yrotation"], | ||
54 | "JOINTS":[{"NAME":"RightUpLeg","OFFSET":[-3.91,0.00,0.00],"CHANNELS":["Zrotation","Xrotation","Yrotation"], | ||
55 | "JOINTS":[{"END":true,"OFFSET":[0.00,-3.46,0.00]}]}]}, | ||
56 | "MOTION":{"Frame Time":0.033333,"Frames":[[8.03,35.01,88.36,-3.41,14.78,-164.35,13.09,40.30,-24.60], | ||
57 | [7.81,35.10,86.47,-3.78,12.94,-166.97,12.64,42.57,-22.34]]}} | ||
58 | </pre> | ||
59 | <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> | ||
60 | <p> </p> | ||
61 | <h2> Semantics </h2> | ||
62 | <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> | ||
63 | <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> | ||
64 | <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 visualized.</p> | ||
65 | <p> </p> | ||
66 | <h2> Attachment points </h2> | ||
67 | <p>The hierarchy portion of a BVJ is a fine place to express attachment points.</p> | ||
68 | <p> </p> | ||
69 | <h3> Syntax </h3> | ||
70 | <pre> ... | ||
71 | { | ||
72 | "NAME": "RightUpLeg", | ||
73 | "ATTACH": [12], | ||
74 | "OFFSET": [-3.91, 0.00, 0.00], | ||
75 | ... | ||
76 | </pre> | ||
77 | <p> </p> | ||
78 | <h3> Semantics </h3> | ||
79 | <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> | ||
80 | <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> | ||
81 | <p>Q: How to define the zero rotation at the attachment point? Need to match what is done now.</p> | ||
82 | <p> </p> | ||
83 | <h3> Multi-attach </h3> | ||
84 | <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> | ||
85 | <pre> ... | ||
86 | { | ||
87 | "NAME": "RightUpLeg", | ||
88 | "ATTACH": [12,99] | ||
89 | "OFFSET": [-3.91, 0.00, 0.00], | ||
90 | ... | ||
91 | </pre> | ||
92 | <p> </p> | ||
93 | <h3> Still More Attachments </h3> | ||
94 | <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> | ||
95 | <p> </p> | ||
96 | <h2> Animating Prims </h2> | ||
97 | <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> | ||
98 | <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> | ||
99 | <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 center 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 center 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> | ||
100 | <p> </p> | ||
101 | <h2> Animating Attached Prims </h2> | ||
102 | <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> | ||
103 | <p> </p> | ||
104 | <h3> Yet More Attachment Points </h3> | ||
105 | <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 atachment point 103, the object "Pretty Bow" would move with a part of the tail, not with some random part of the avy.</p> | ||
106 | <p> </p> | ||
107 | <h2> Sampling and Keyframing </h2> | ||
108 | <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> | ||
109 | <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> | ||
110 | <p> </p> | ||
111 | <h3> Keyframe Syntax and Semantics </h3> | ||
112 | <p>I propose adding keyframe syntax as an alternative to the existing "MOTION" section of BVH files.</p> | ||
113 | <pre> { | ||
114 | "HIERARCHY":{...}, | ||
115 | "KEYFRAMES":[ | ||
116 | { | ||
117 | "AT":0.00, | ||
118 | "Hips":[8.03,35.01,88.36,-3.41,14.78,-164.35], | ||
119 | "RightUpLeg":[13.09,40.30,-24.60]}, | ||
120 | { | ||
121 | "AT":0.033333, | ||
122 | "Hips":[7.81,35.10,86.47,-3.78,12.94,-166.97], | ||
123 | "RightUpLeg":[12.64,42.57,-22.34]}]} | ||
124 | </pre> | ||
125 | <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> | ||
126 | <p> </p> | ||
127 | <h2> Animations, Not BVH Files </h2> | ||
128 | <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> | ||
129 | <p>I favor this placement</p> | ||
130 | <pre> { | ||
131 | "priority":3.5, | ||
132 | "looped":false, | ||
133 | "HIERARCHY":{ ... } ...} | ||
134 | </pre> | ||
135 | <p>But can see arguments for this instead</p> | ||
136 | <pre> { | ||
137 | "HIERARCHY":{ ... } | ||
138 | "MOTION": { | ||
139 | "priority":3.5, | ||
140 | "looped":false, | ||
141 | ...} ...} | ||
142 | </pre> | ||
143 | <p> </p> | ||
144 | <p> </p> | ||
145 | <h2> At This Time </h2> | ||
146 | <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 analog 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> | ||
147 | <p> </p> | ||
148 | <h2> Tools to Make BVJ Files </h2> | ||
149 | <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 synthesize a keyframe representation that is a close match to a set of samples.</p> | ||
150 | <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> | ||
151 | <p> </p> | ||
152 | <h2> Client to Client </h2> | ||
153 | <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> | ||
154 | <p> </p> | ||
155 | <h3> Changing Poses </h3> | ||
156 | <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> | ||
157 | <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> | ||
158 | <p>What I imagine right now is <a href="InworldAnimationEditor.html">InworldAnimationEditor</a></p> | ||
159 | </body> | ||
160 | </html> | ||