OBD:OBAN: Difference between revisions

From OniGalore
Jump to navigation Jump to search
mNo edit summary
m (cleanup)
Line 1: Line 1:
[[Main Page]] >> [[OBD:Oni Binary Data|Oni Binary Data]] >> [[OBD:File types|File Types]] >> OBAN File
{{OBD_File_Header | type=OBAN | prev=Mtrl | next=OBDC | name=Object Animation | family=Level | align=center}}
 
 
<CENTER>[[OBD:Mtrl|<==]] <FONT SIZE=5>OBAN File</FONT> [[OBD:OBDC|==>]]<BR>
<FONT SIZE=2>Object AnimationFile</FONT></CENTER>




Line 9: Line 5:




{| BORDER=1 WIDTH=100% CELLPADDING=2 CELLSPACING=0
{{Table}}
|- ALIGN=CENTER BGCOLOR="#FFDDBB"
{{OBD Table Header}}
| WIDTH=15% | <B>Hex</B>
{{OBDtr|0x00|res_id|FF0000|01 '''86 00 00'''|134|00134-Blackvan_FB.OBAN}}
| WIDTH=15% | <B>Translation</B>
{{OBDtr|0x04|lev_id|FFFF00|01 00 00 '''06'''|3 |level 3}}
| WIDTH=70% | <B>Meaning</B>
{{OBDtr|0x08|blank[16]|00FF00|00 00 00 00   |0 |blank filler}}
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
|- ALIGN=CENTER VALIGN=TOP
| BGCOLOR="#FF0000" | 01 86 00 00
|0x18||matrix||
| 134
{|border=1 cellspacing=0 style="white-space:nowrap"
| ALIGN=LEFT | 00134-Blackvan_FB.OBAN
|-BGCOLOR="#FFC8C8"
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
|C2 F5 E8 3F||AB D7 AA B3||EC 89 13 35
| BGCOLOR="#FFFF00" | 01 00 00 06
|-BGCOLOR="#FFFFC8"
| 3
|EC 89 13 35||ED 89 13 B4||C2 F5 E8 BF
| ALIGN=LEFT | level 3
|-BGCOLOR="#C8FFC8"
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
|B1 D7 AA 33||C2 F5 E8 3F||EB 89 13 B4
| BGCOLOR="#00FF00" | 00 00 00 00
|-BGCOLOR="#C8FFFF"
| 0
|6B 9A 94 44||97 FD 5B C2||5D 06 DA C2
| ALIGN=LEFT | Space marker. Don't alter it.
|}
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
|
| BGCOLOR="#FFC8C8" | C2 F5 E8 3F
{|border=1 cellspacing=0 style="white-space:nowrap"
| 1.819999
|1.819999||-7.955471e-8||5.496247e-7
| ALIGN=LEFT | m11 element of the initial position transform matrix
|-
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
|5.496247e-7||-1.374061e-7||-1.819999
| BGCOLOR="#FFC8C8" | AB D7 AA B3
|-
| -7.955471e-8
|7.955475e-8||1.819999||-1.374061e-7
| ALIGN=LEFT | m21 element of the initial position transform matrix
|-
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
|1188.825561||-54.997646||-109.012428
| BGCOLOR="#FFC8C8" | EC 89 13 35
|}
| 5.496247e-7
|ALIGN=LEFT|initial position transform matrix
| ALIGN=LEFT | m31 element of the initial position transform matrix
|- ALIGN=CENTER VALIGN=TOP
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
|0x48||matrix||
| BGCOLOR="#FFFFC8" | EC 89 13 35
{|border=1 cellspacing=0 style="white-space:nowrap"
| 5.496247e-7
|-BGCOLOR="#FFC8FF"
| ALIGN=LEFT | m12 element of the initial position transform matrix
|C2 F5 E8 3F||00 00 00 00||00 00 00 00
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
|-BGCOLOR="#FFC800"
| BGCOLOR="#FFFFC8" | ED 89 13 B4
|00 00 00 00||C2 F5 E8 3F||00 00 00 00
| -1.374061e-7
|-BGCOLOR="#C800C8"
| ALIGN=LEFT | m22 element of the initial position transform matrix
|00 00 00 00||00 00 00 00||C2 F5 E8 3F
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
|-BGCOLOR="#C87C64"
| BGCOLOR="#FFFFC8" | C2 F5 E8 BF
|00 00 00 00||00 00 00 00||00 00 00 00
| -1.819999
|}
| ALIGN=LEFT | m32 element of the initial position transform matrix
|
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
{|border=1 cellspacing=0 style="white-space:nowrap"
| BGCOLOR="#C8FFC8" | B1 D7 AA 33
|1.819999||0.0||0.0
| 7.955475e-8
|-
| ALIGN=LEFT | m13 element of the initial position transform matrix
|0.0||0.0||1.819999
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
|-
| BGCOLOR="#C8FFC8" | C2 F5 E8 3F
|0.0||1.819999||0.0
| 1.819999
|-
| ALIGN=LEFT | m23 element of the initial position transform matrix
|0.0||0.0||0.0
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
|}
| BGCOLOR="#C8FFC8" | EB 89 13 B4
| ALIGN=LEFT | fixed transform matrix
| -1.374061e-7
{{OBDtr|0x78|int16|B0C3D4|50 00|80 |unknown}}
| ALIGN=LEFT | m33 element of the initial position transform matrix
{{OBDtr|0x7A|int16|E7CEA5|F5 01|501 |animation length in frames}}
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
{{OBDtr|0x7C|int16|FFDDDD|00 00|0 |unknown}}
| BGCOLOR="#C8FFFF" | 6B 9A 94 44
{{OBDtr|0x7E|int16|64AAAA|65 00|10 |101 keyframes in array}}
| 1188.825561
{{OBDtrBK|First keyframe (black outline)}}
| ALIGN=LEFT | m14 element of the initial position transform matrix (x-position)
|- ALIGN=CENTER VALIGN=TOP
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
|0x00||quaternion||
| BGCOLOR="#C8FFFF" | 97 FD 5B C2
{|border=1 cellspacing=0 style="white-space:nowrap"
| -54.997646
|-BGCOLOR="#EBEBEB"
| ALIGN=LEFT | m24 element of the initial position transform matrix (y-position, height)
| F4 04 35 BF||6A 19 C4 B3||CE 3C 03 B4||F3 04 35 BF
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
|}
| BGCOLOR="#C8FFFF" | 5D 06 DA C2
|
| -109.012428
{|border=1 cellspacing=0 style="white-space:nowrap"
| ALIGN=LEFT | m34 element of the initial position transform matrix (z-position)
| -0.7071068|| -9.131584e-8|| -1.222244e-7|| -0.7071067
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
|}
| BGCOLOR="#FFC8FF" | C2 F5 E8 3F
|ALIGN=LEFT|object rotation
| 1.819999
|- ALIGN=CENTER VALIGN=TOP
| ALIGN=LEFT | m11 element of the fixed transform matrix
|0x10||vector||
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
{|border=1 cellspacing=0 style="white-space:nowrap"
| BGCOLOR="#FFC8FF" | 00 00 00 00
|-BGCOLOR="#8C8CCC"
| 0.000000
|C2 F5 E8 3F||AB D7 AA B3||EC 89 13 35
| ALIGN=LEFT | m21 element of the fixed transform matrix
|}
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
|
| BGCOLOR="#FFC8FF" | 00 00 00 00
{|border=1 cellspacing=0 style="white-space:nowrap"
| 0.000000
|1188.825561||-54.997646||-109.012428
| ALIGN=LEFT | m31 element of the fixed transform matrix
|}
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
|ALIGN=LEFT|object position
| BGCOLOR="#FFC800" | 00 00 00 00
{{OBDtr|0x1C|int32|FF00C8|00 00 00 00   |0 |elapsed time in frames}}
| 0.000000
| ALIGN=LEFT | m12 element of the fixed transform matrix
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#FFC800" | C2 F5 E8 3F
| 1.819999
| ALIGN=LEFT | m22 element of the fixed transform matrix
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#FFC800" | 00 00 00 00
| 0.000000
| ALIGN=LEFT | m32 element of the fixed transform matrix
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#C800C8" | 00 00 00 00
| 0.000000
| ALIGN=LEFT | m13 element of the fixed transform matrix
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#C800C8" | 00 00 00 00
| 0.000000
| ALIGN=LEFT | m23 element of the fixed transform matrix
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#C800C8" | C2 F5 E8 3F
| 1.819999
| ALIGN=LEFT | m33 element of the fixed transform matrix
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#C87C64" | 00 00 00 00
| 0.000000
| ALIGN=LEFT | m14 element of the fixed transform matrix (x translation)
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#C87C64" | 00 00 00 00
| 0.000000
| ALIGN=LEFT | m24 element of the fixed transform matrix (y translation)
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#C87C64" | 00 00 00 00
| 0.000000
| ALIGN=LEFT | m34 element of the fixed transform matrix (z translation)
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#B0C3D4" | 50 00
| 80
| ALIGN=LEFT | number of frames ???
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#E7CEA5" | F5 01
| 501
| ALIGN=LEFT | animation time in 1/60 seconds (8.35 seconds)
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#FFDDDD" | 00 00
| 0
| ALIGN=LEFT | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#64AAAA" | 65 00
| 101
| ALIGN=LEFT | 101 packages follow (one package is edged in black)
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#000000"
| COLSPAN=3 | <FONT SIZE=2 COLOR="#FFFFFF">Below follows the first package.</FONT>
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#EBEBEB" | F4 04 35 BF
| -0.7071068
| ALIGN=LEFT | x-value of the rotation quaternion
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#EBEBEB" | 6A 19 C4 B3
| -9.131584e-8
| ALIGN=LEFT | y-value of the rotation quaternion
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#EBEBEB" | CE 3C 03 B4
| -1.222244e-7
| ALIGN=LEFT | z-value of the rotation quaternion
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#EBEBEB" | F3 04 35 BF
| -0.7071067
| ALIGN=LEFT | w-value of the rotation quaternion
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#8C8CCC" | 6B 9A 94 44
| 1188.825561
| ALIGN=LEFT | x-position
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#8C8CCC" | 97 FD 5B C2
| -54.997646
| ALIGN=LEFT | y-position (height)
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#8C8CCC" | 5D 06 DA C2
| -109.012428
| ALIGN=LEFT | z-position
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#FF00C8" | 00 00 00 00
| 0
| ALIGN=LEFT | passed time in 1/60 seconds
|}
|}


Elements m41, m42, m43, m44 of both [[Wikipedia:Transformation_matrix#Affine_transformations|transform matrices]] are missing. m41, m42 and m43 are the [[Wikipedia:3D_projection|projection transform]] coefficients and they are not needed so they are 0.0 and the m44 element is always 1.0 for a transform matrix. ([[Wikipedia:row-major_order|column major]] transform matrices like in Open GL, for Direct 3D they need to be transposed)
;Transform matrices
 
:Like all matrices in Oni, they are composed of 3 vectors defining rotation/scaling/shearing and a 4th vector defining a translation.
The initial transform matrix can be used to position the object in the environment without playing the animation frames. The animation frames themself include this transform so it is not needed to actually play the animation.
:In the above table the 4 vectors are presented as rows ([[Wikipedia:row-major_order|Direct 3D convention]]), although OpenGL and Oni use them as columns.
 
:[[Wikipedia:Transformation_matrix#Affine_transformations|Affine transformations]] use a 4x4 matrix with 4 extra coefficients (in the presentation above, one would add one column on the right):
The fixed transform matrix must be applied to every animation frame. For some animations this matrix is the identity matrix so it is not really needed but some animations for composed objects (like the motorcycle animation from level 3 intro) need this transform.
::three [[Wikipedia:3D_projection|projection transform]] coefficients (all of them are zero here); one final coefficient (always 1.0 for an affine transform matrix).
:;Neo
:Alternatively, one can think of the 3x4 matrix as a 3x3 rotation/scaling matrix and a position vector
 
::*Let X=(x, y, z) be the position of a vertex in the M3GM
:My respects for the OpenGL/Direct3D knowledge. Keep it up!
::*Let M=(m11, m21, m31; m12, m22, m32; m13, m23, m33) be the 3x3 matrix
:Examples of "fixed transforms", please. Scaling?
::*Let R=(m14, m24, m34) be the translation vector
 
::Then the absolute position of the vertex in the 3D world will be: X M + R
:For both transformations, there are two alternative ways to think of the 12 coefficients
::(left multiplication is used because of the row-major notation above)
:*a 4x4 matrix with missing terms (affine transformation)
;Initial transform matrix
:*a 3x3 matrix (vector transformation) and a position vector
:It is used to position the object in the environment before the animation is played.
:Even if a 4D matrix is generated at runtime for use by OpenGL,
:When the animation is played, they use the fixed transform matrix and a quaternion.
::I'd still provide an alternative visualization in layman terms
;Fixed transform matrix
::*let X=(x, y, z) be the position of a point in the M3GM
:This transformation is applied before the quaternion+position transform at every keyframe.
::*let M=(m11, m21, m31; m12, m22, m32; m13, m23, m33) be the 3x3 matrix
:The only transform that can't be handled by the quaternion+position is scaling/mirroring.
::*let R=(m14, m24, m34) be the position (column) vector
:Thus, the fixed transform is a scaling matrix most of the time (no rotation or translation).
::then the absolute position of the point in the 3D world will be: M X + R
:In the above example, the fixed transform performs a scaling and also swaps Y and Z axes.
:Note that the OBD namespace has been merged into Main.
;Quaternions
::We may thus move OBD:OBAN to OBAN etc. Soon.
:Those are used in Oni whenever interpolation or rotation is involved (e.g., [[OBD_talk:TRAM/raw0x34#Quaternions|TRAM rotation]])
::[[User:Geyser|geyser]] 22:19, 28 February 2007 (CET)
:In this case, rotation at intermediate frames is interpolated from the keyframe quaternions.
 
:;geyser
 
:Thanks!
 
:The fixed transform can be anything including scaling which is quite common. For example the motorcycle from level 3 is scaled down a bit (0.7197) and its wheels are scaled down and they also have a rotation applied to them. Without this transform the resulting motorcycle looks funny, the wheels are a bit bigger and nearer to the center of the motorcycle body than they should makeing it look like it was compressed. Note that the animation frame only includes rotation and translation so any scaling that must be applied to the 3D models used in animation needs to be done with this matrix. Some other object animations where I saw this matrix used are the blackvan animation from the end of level 3 and the truck animation from the end of level 1 (the truck back model is way bigger than the truck front model so scaling is badly needed there).
 
:While you are technically correct about expressing the transform as a translation and a 3x3 matrix that does rotation, scaling, shearing and mirroring I have never seen a 3D graphic system (or documentation) doing it. It's much easier in practice to only deal with one 4x4 transform matrix which includes everything (the 3x3 transform part, the translation and the projection). In addition as you already noted the translation part is (m14, m24, m34) (the first 3 elements of the last column) so it is easy to spot it for someone who is only interested in object position. In a similar way a 2D graphic system uses a 3x3 matrix to express rotation, scaling, shearing and mirroring transforms for 2D vectors. This thing is sort of burned into my mind, when I saw 12 float values with 3 of them looking like a position I said to myself "alright, this must be a transform matrix without its last column" (I mostly use Direct 3D so I tend to think in row major matrix order) :).
::[[User:Neo]]
 
<HR>
<CENTER>[[OBD:Mtrl|<==]] <B>OBAN File</B> [[OBD:OBDC|==>]]</CENTER>
<HR>




[[Main Page]] >> [[OBD:Oni Binary Data|Oni Binary Data]] >> [[OBD:File types|File Types]] >> OBAN File
----
----
{{OBD_File_Footer | type=OBAN | prev=Mtrl | next=OBDC | name=Object Animation | family=Level | align=center}}

Revision as of 14:06, 15 August 2007

ONI BINARY DATA
Mtrl << Other file types >> OBDC
OBAN : Object Animation
switch to XML:OBAN page
Overview @ Oni Stuff
OBD.png


oban_a.gif


Offset Type Raw Hex Value Description
0x00 res_id 01 86 00 00 134 00134-Blackvan_FB.OBAN
0x04 lev_id 01 00 00 06 3 level 3
0x08 blank[16] 00 00 00 00 0 blank filler
0x18 matrix
C2 F5 E8 3F AB D7 AA B3 EC 89 13 35
EC 89 13 35 ED 89 13 B4 C2 F5 E8 BF
B1 D7 AA 33 C2 F5 E8 3F EB 89 13 B4
6B 9A 94 44 97 FD 5B C2 5D 06 DA C2
1.819999 -7.955471e-8 5.496247e-7
5.496247e-7 -1.374061e-7 -1.819999
7.955475e-8 1.819999 -1.374061e-7
1188.825561 -54.997646 -109.012428
initial position transform matrix
0x48 matrix
C2 F5 E8 3F 00 00 00 00 00 00 00 00
00 00 00 00 C2 F5 E8 3F 00 00 00 00
00 00 00 00 00 00 00 00 C2 F5 E8 3F
00 00 00 00 00 00 00 00 00 00 00 00
1.819999 0.0 0.0
0.0 0.0 1.819999
0.0 1.819999 0.0
0.0 0.0 0.0
fixed transform matrix
0x78 int16 50 00 80 unknown
0x7A int16 F5 01 501 animation length in frames
0x7C int16 00 00 0 unknown
0x7E int16 65 00 10 101 keyframes in array
First keyframe (black outline)
0x00 quaternion
F4 04 35 BF 6A 19 C4 B3 CE 3C 03 B4 F3 04 35 BF
-0.7071068 -9.131584e-8 -1.222244e-7 -0.7071067
object rotation
0x10 vector
C2 F5 E8 3F AB D7 AA B3 EC 89 13 35
1188.825561 -54.997646 -109.012428
object position
0x1C int32 00 00 00 00 0 elapsed time in frames
Transform matrices
Like all matrices in Oni, they are composed of 3 vectors defining rotation/scaling/shearing and a 4th vector defining a translation.
In the above table the 4 vectors are presented as rows (Direct 3D convention), although OpenGL and Oni use them as columns.
Affine transformations use a 4x4 matrix with 4 extra coefficients (in the presentation above, one would add one column on the right):
three projection transform coefficients (all of them are zero here); one final coefficient (always 1.0 for an affine transform matrix).
Alternatively, one can think of the 3x4 matrix as a 3x3 rotation/scaling matrix and a position vector
  • Let X=(x, y, z) be the position of a vertex in the M3GM
  • Let M=(m11, m21, m31; m12, m22, m32; m13, m23, m33) be the 3x3 matrix
  • Let R=(m14, m24, m34) be the translation vector
Then the absolute position of the vertex in the 3D world will be: X M + R
(left multiplication is used because of the row-major notation above)
Initial transform matrix
It is used to position the object in the environment before the animation is played.
When the animation is played, they use the fixed transform matrix and a quaternion.
Fixed transform matrix
This transformation is applied before the quaternion+position transform at every keyframe.
The only transform that can't be handled by the quaternion+position is scaling/mirroring.
Thus, the fixed transform is a scaling matrix most of the time (no rotation or translation).
In the above example, the fixed transform performs a scaling and also swaps Y and Z axes.
Quaternions
Those are used in Oni whenever interpolation or rotation is involved (e.g., TRAM rotation)
In this case, rotation at intermediate frames is interpolated from the keyframe quaternions.




ONI BINARY DATA
Mtrl << Other file types >> OBDC
OBAN : Object Animation
Level file