OBD:OBAN: Difference between revisions
No edit summary |
m (link fixes) |
||
Line 99: | Line 99: | ||
;Transform matrices | ;Transform matrices | ||
:Like all matrices in Oni, they are composed of 3 vectors defining rotation/scaling/shearing and a 4th vector defining a translation. | :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 ([[ | :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): | ||
::three [[ | ::three [[wikipedia: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 | :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 X=(x, y, z) be the position of a vertex in the M3GM |
Revision as of 13:10, 5 April 2021
|
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:
| ||||||||||||||||||||||||
0x18 | matrix |
|
|
initial position transform matrix | ||||||||||||||||||||||||
0x48 | matrix |
|
|
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 |
|
|
object rotation | ||||||||||||||||||||||||
0x10 | vector |
|
|
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 |
Level file |