OBD:OBAN: Difference between revisions

From OniGalore
Jump to navigation Jump to search
No edit summary
m (changed family)
 
(22 intermediate revisions by 5 users not shown)
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=General | desc='''OBAN'''s are arrays for storing keyframes in an object or camera animation, as well as basic info like whether the animation loops, and how it does so. | align=center}}




<CENTER>[[OBD:Mtrl|<==]] <FONT SIZE=5>OBAN File</FONT> [[OBD:OBDC|==>]]<BR>
[[Image:oban_a.gif]]
<FONT SIZE=2>Object AnimationFile</FONT></CENTER>




http://www6.fh-eberswalde.de/user/dkriesch/onistuff/images/oban_a.gif
{{Table}}
{{OBD Table Header}}
{{OBDtr|0x00|res_id|FF0000|01 '''86 00 00'''|134|00134-Blackvan_FB.OBAN}}
{{OBDtr|0x04|lev_id|FFFF00|01 00 00 '''06'''|3  |level 3}}
{{OBDtr|0x08|char[12]|00FF00|00 00 00 00    |0  |padding }}
{{OBDtr|0x14|int32  |00FF00|00 00 00 00    |0  |flags; used values:
:0x'''01''' 00 00 00 - loop animation normally
:0x'''02''' 00 00 00 - loop animation back to back
:0x'''04''' 00 00 00 - select start frame randomly
:0x'''08''' 00 00 00 - autostart animation (after an animated object is created)
:0x'''10''' 00 00 00 - local animation; this animation does not contain world positioning information, the object position is determined by the origin matrix in [[OBOA]]; local animations also use a Z-up coordinate system
}}
|- ALIGN=CENTER VALIGN=TOP
|0x18||matrix||
{|border=1 cellspacing=0 style="white-space:nowrap"
|-BGCOLOR="#FFC8C8"
|C2 F5 E8 3F||AB D7 AA B3||EC 89 13 35
|-BGCOLOR="#FFFFC8"
|EC 89 13 35||ED 89 13 B4||C2 F5 E8 BF
|-BGCOLOR="#C8FFC8"
|B1 D7 AA 33||C2 F5 E8 3F||EB 89 13 B4
|-BGCOLOR="#C8FFFF"
|6B 9A 94 44||97 FD 5B C2||5D 06 DA C2
|}
|
{|border=1 cellspacing=0 style="white-space:nowrap"
|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
|}
|ALIGN=LEFT|initial position transform matrix
|- ALIGN=CENTER VALIGN=TOP
|0x48||matrix||
{|border=1 cellspacing=0 style="white-space:nowrap"
|-BGCOLOR="#FFC8FF"
|C2 F5 E8 3F||00 00 00 00||00 00 00 00
|-BGCOLOR="#FFC800"
|00 00 00 00||C2 F5 E8 3F||00 00 00 00
|-BGCOLOR="#C800C8"
|00 00 00 00||00 00 00 00||C2 F5 E8 3F
|-BGCOLOR="#C87C64"
|00 00 00 00||00 00 00 00||00 00 00 00
|}
|
{|border=1 cellspacing=0 style="white-space:nowrap"
|1.819999||0.0||0.0
|-
|0.0||1.819999||0.0
|-
|0.0||0.0||1.819999
|-
|0.0||0.0||0.0
|}
| ALIGN=LEFT | fixed transform matrix
{{OBDtr|0x78|int16|B0C3D4|50 00|80  | fubared animation frame length (in 1/60 seconds); does not work}}
{{OBDtr|0x7A|int16|E7CEA5|F5 01|501 | animation length in frames}}
{{OBDtr|0x7C|int16|FFDDDD|00 00|0  | stop frame for the first "half" of the animation; used by door animations to distinguish between open and close sequences }}
{{OBDtr|0x7E|int16|64AAAA|65 00|101  | 101 keyframes in array}}
{{OBDtrBK|First keyframe (black outline)}}
|- ALIGN=CENTER VALIGN=TOP
|0x00||quaternion||
{|border=1 cellspacing=0 style="white-space:nowrap"
|-BGCOLOR="#EBEBEB"
| F4 04 35 BF||6A 19 C4 B3||CE 3C 03 B4||F3 04 35 BF
|}
|
{|border=1 cellspacing=0 style="white-space:nowrap"
| -0.7071068|| -9.131584e-8|| -1.222244e-7|| -0.7071067
|}
|ALIGN=LEFT|object rotation
|- ALIGN=CENTER VALIGN=TOP
|0x10||vector||
{|border=1 cellspacing=0 style="white-space:nowrap"
|-BGCOLOR="#8C8CCC"
|C2 F5 E8 3F||AB D7 AA B3||EC 89 13 35
|}
|
{|border=1 cellspacing=0 style="white-space:nowrap"
|1188.825561||-54.997646||-109.012428
|}
|ALIGN=LEFT|object position
{{OBDtr|0x1C|int32|FF00C8|00 00 00 00  |0  |elapsed time in frames}}
|}


Object animations are used to animate [[OBD:OBOA|objects]] (doors included), [[OBD:TRIG|triggers]], cameras and characters. Object animations may be referenced from OBOA but they can also be set using env_setanim script command. Camera animations are never referenced from data files, they're started from script using cm_anim/cm_interpolate. Because of this the only way to tell if an animation is intended for camera or for an object is to look at the level scripts.


{| BORDER=1 WIDTH=100% CELLPADDING=2 CELLSPACING=0
Characters can have an object animation applied to them by using chr_envanim/chr_envanim_block. The object animation controls the movement of the character and it's normally used together with a [[OBD:TRAM|Totoro animation]] that has the 'real world' flag set. This can be used to make the character appear attached to another animated object, for example the motorcycle in the opening of Lab level.
|- ALIGN=CENTER BGCOLOR="#FFDDBB"
| WIDTH=15% | <B>Hex</B>
| WIDTH=15% | <B>Translation</B>
| WIDTH=70% | <B>Meaning</B>
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#FF0000" | 01 86 00 00
| 134
| ALIGN=LEFT | 00134-Blackvan_FB.OBAN
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#FFFF00" | 01 00 00 06
| 3
| ALIGN=LEFT | level 3
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#00FF00" | 00 00 00 00
| 0
| ALIGN=LEFT | Space marker. Don't alter it.
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#FFC8C8" | C2 F5 E8 3F
| 1.819999
| ALIGN=LEFT | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#FFC8C8" | AB D7 AA B3
| -7.955471e-8
| ALIGN=LEFT | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#FFC8C8" | EC 89 13 35
| 5.496247e-7
| ALIGN=LEFT | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#FFFFC8" | EC 89 13 35
| 5.496247e-7
| ALIGN=LEFT | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#FFFFC8" | ED 89 13 B4
| -1.374061e-7
| ALIGN=LEFT | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#FFFFC8" | C2 F5 E8 BF
| -1.819999
| ALIGN=LEFT | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#C8FFC8" | B1 D7 AA 33
| 7.955475e-8
| ALIGN=LEFT | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#C8FFC8" | C2 F5 E8 3F
| 1.819999
| ALIGN=LEFT | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#C8FFC8" | EB 89 13 B4
| -1.374061e-7
| ALIGN=LEFT | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#C8FFFF" | 6B 9A 94 44
| 1188.825561
| ALIGN=LEFT | x-position
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#C8FFFF" | 97 FD 5B C2
| -54.997646
| ALIGN=LEFT | y-position (height)
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#C8FFFF" | 5D 06 DA C2
| -109.012428
| ALIGN=LEFT | z-position
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#FFC8FF" | C2 F5 E8 3F
| 1.819999
| ALIGN=LEFT | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#FFC8FF" | 00 00 00 00
| 0.000000
| ALIGN=LEFT | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#FFC8FF" | 00 00 00 00
| 0.000000
| ALIGN=LEFT | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#FFC800" | 00 00 00 00
| 0.000000
| ALIGN=LEFT | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#FFC800" | C2 F5 E8 3F
| 1.819999
| ALIGN=LEFT | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#FFC800" | 00 00 00 00
| 0.000000
| ALIGN=LEFT | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#C800C8" | 00 00 00 00
| 0.000000
| ALIGN=LEFT | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#C800C8" | 00 00 00 00
| 0.000000
| ALIGN=LEFT | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#C800C8" | C2 F5 E8 3F
| 1.819999
| ALIGN=LEFT | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#C87C64" | 00 00 00 00
| 0.000000
| ALIGN=LEFT | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#C87C64" | 00 00 00 00
| 0.000000
| ALIGN=LEFT | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#C87C64" | 00 00 00 00
| 0.000000
| ALIGN=LEFT | unknown
|- 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 | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#EBEBEB" | 6A 19 C4 B3
| -9.131584e-8
| ALIGN=LEFT | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#EBEBEB" | CE 3C 03 B4
| -1.222244e-7
| ALIGN=LEFT | unknown
|- ALIGN=CENTER VALIGN=TOP BGCOLOR="#FFEEDD"
| BGCOLOR="#EBEBEB" | F3 04 35 BF
| -0.7071067
| ALIGN=LEFT | unknown
|- 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
|}


;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 ([[wp:Row-_and_column-major_order|Direct 3D convention]]), although OpenGL and Oni use them as columns.
:[[wp: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):
::three [[wp:3D_projection|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, it coresponds to the first animation frame.
: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 scales the van up by 1.82 (along all three axes).
;Quaternions
:Those are used in Oni whenever interpolation of 3D rotation is involved (e.g., [[OBD_talk:TRAM/raw0x34#Quaternions|TRAM rotation]])
:In this case, rotation at intermediate frames is interpolated from the keyframe quaternions.


<HR>
<CENTER>[[OBD:Mtrl|<==]] <B>OBAN File</B> [[OBD:OBDC|==>]]</CENTER>
<HR>


----
----
{{OBD_File_Footer | type=OBAN | prev=Mtrl | next=OBDC | name=Object Animation | family=General | align=center}}


[[Main Page]] >> [[OBD:Oni Binary Data|Oni Binary Data]] >> [[OBD:File types|File Types]] >> OBAN File
{{OBD}}

Latest revision as of 21:40, 9 December 2023

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 char[12] 00 00 00 00 0 padding
0x14 int32 00 00 00 00 0 flags; used values:
0x01 00 00 00 - loop animation normally
0x02 00 00 00 - loop animation back to back
0x04 00 00 00 - select start frame randomly
0x08 00 00 00 - autostart animation (after an animated object is created)
0x10 00 00 00 - local animation; this animation does not contain world positioning information, the object position is determined by the origin matrix in OBOA; local animations also use a Z-up coordinate system
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 1.819999 0.0
0.0 0.0 1.819999
0.0 0.0 0.0
fixed transform matrix
0x78 int16 50 00 80 fubared animation frame length (in 1/60 seconds); does not work
0x7A int16 F5 01 501 animation length in frames
0x7C int16 00 00 0 stop frame for the first "half" of the animation; used by door animations to distinguish between open and close sequences
0x7E int16 65 00 101 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

Object animations are used to animate objects (doors included), triggers, cameras and characters. Object animations may be referenced from OBOA but they can also be set using env_setanim script command. Camera animations are never referenced from data files, they're started from script using cm_anim/cm_interpolate. Because of this the only way to tell if an animation is intended for camera or for an object is to look at the level scripts.

Characters can have an object animation applied to them by using chr_envanim/chr_envanim_block. The object animation controls the movement of the character and it's normally used together with a Totoro animation that has the 'real world' flag set. This can be used to make the character appear attached to another animated object, for example the motorcycle in the opening of Lab level.

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, it coresponds to the first animation frame.
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 scales the van up by 1.82 (along all three axes).
Quaternions
Those are used in Oni whenever interpolation of 3D 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
General file