OBD:TRAM/raw0x34: Difference between revisions

m
localized image
m (→‎Compression size 6: reformulating)
m (localized image)
 
(5 intermediate revisions by one other user not shown)
Line 5: Line 5:




[[image:tram_r11.gif]]
[[Image:tram_r11.gif]]




Line 30: Line 30:




Here's the minimal structure of the body animation tracks for a TRAM file (address stored at 0x34 in the dat)
Here's the minimal structure of the body animation tracks for a TRAM file (address stored at 0x34 in the .dat). The example below is for '''SHINZOMidle1''': those bone tracks are found at 0x480020 in the original level18_Final.raw. The global structure is 19 bone tracks, preceded by a list of their offsets (the "header").
 
(The example below is for '''SHINZOMidle1''' : those bone tracks are found at 0x480020 in the original level18_Final.raw)
 
The global stucture is 19 bone tracks, preceded by a list of their offsets (the "header").


Information required to read this part :
Information required to read this part :
*number of body parts (at 0x16A in the dat, always 19 in Oni)
*number of body parts (at 0x16A in the .dat, always 19 in Oni)
*"compression size" (at 0x160 in the dat, 6 for almost all anims, 16 for a few)
*"compression size" (at 0x160 in the .dat, 6 for almost all anims, 16 for a few)
*frame count (at 0x16C in the dat)
*frame count (at 0x16C in the .dat)


The size of a bone track is not known in advance. See "General info" below.
The size of a bone track is not known in advance. See "General info" below.




http://geyser.oni2.net/OBD/tram/raw0x34/SHINZOMidle1.png
[[Image:TRAM 0x34.png]]




Line 57: Line 53:
|0x00
|0x00
|Pelvis
|Pelvis
|style="background:fuchsia"|2600
|style="background:fuchsia"|26 00
|0x26
|0x26
|-
|-
|0x02
|0x02
|Lt Thigh
|Lt Thigh
|style="background:lime"|3300
|style="background:lime"|33 00
|0x33
|0x33
|-
|-
|0x04
|0x04
|Lt Calf
|Lt Calf
|style="background:aqua"|4000
|style="background:aqua"|40 00
|0x40
|0x40
|-
|-
|0x06
|0x06
|Lt Foot
|Lt Foot
|style="background:yellow"|4D00
|style="background:yellow"|4D 00
|0x4D
|0x4D
|-
|-
|0x08
|0x08
|Rt Thigh
|Rt Thigh
|style="background:#888888"|5A00
|style="background:#888888"|5A 00
|0x5A
|0x5A
|-
|-
|0x0A
|0x0A
|Rt Calf
|Rt Calf
|style="background:fuchsia"|6700
|style="background:fuchsia"|67 00
|0x67  
|0x67  
|-
|-
|0x0C
|0x0C
|Rt Foot
|Rt Foot
|style="background:lime"|7400
|style="background:lime"|74 00
|0x74
|0x74
|-
|-
|0x0E
|0x0E
|Mid
|Mid
|style="background:aqua"|8100
|style="background:aqua"|81 00
|0x81
|0x81
|-
|-
|0x10
|0x10
|Chest
|Chest
|style="background:yellow"|8E00
|style="background:yellow"|8E 00
|0x8E
|0x8E
|-
|-
|0x12
|0x12
|Neck
|Neck
|style="background:#888888"|9B00
|style="background:#888888"|9B 00
|0x9B  
|0x9B  
|-
|-
|0x14
|0x14
|Head
|Head
|style="background:fuchsia"|A800
|style="background:fuchsia"|A8 00
|0xA8  
|0xA8  
|-
|-
|0x16
|0x16
|Lt Shoulder
|Lt Shoulder
|style="background:lime"|B500
|style="background:lime"|B5 00
|0xB5  
|0xB5  
|-
|-
|0x18
|0x18
|Lt Arm
|Lt Arm
|style="background:aqua"|C200
|style="background:aqua"|C2 00
|0xC2  
|0xC2  
|-
|-
|0x1A
|0x1A
|Lt Wrist
|Lt Wrist
|style="background:yellow"|CF00
|style="background:yellow"|CF 00
|0xCF  
|0xCF  
|-
|-
|0x1C
|0x1C
|Lt Fist
|Lt Fist
|style="background:#888888"|DC00
|style="background:#888888"|DC 00
|0xDC  
|0xDC  
|-
|-
|0x1E
|0x1E
|Rt Shoulder
|Rt Shoulder
|style="background:fuchsia"|E900
|style="background:fuchsia"|E9 00
|0xE9  
|0xE9  
|-
|-
|0x20
|0x20
|Rt Arm
|Rt Arm
|style="background:lime"|F600
|style="background:lime"|F6 00
|0xF6  
|0xF6  
|-
|-
|0x22
|0x22
|Rt Wrist
|Rt Wrist
|style="background:aqua"|0301
|style="background:aqua"|03 01
|0x103  
|0x103  
|-
|-
|0x24
|0x24
|Rt Fist
|Rt Fist
|style="background:yellow"|1001
|style="background:yellow"|10 01
|0x110  
|0x110  
|}
|}
Line 162: Line 158:
!Angle
!Angle
!Short
!Short
!Raw hex
|-
|-
|0°
|0°
|0x0000
|0x0000
|0x0000
|-
|-
|45°
|24°
|0x2000
|0x1111
|0x0020
|-
|-
|90°
|48°
|0x4000
|0x2222
|0x0040
|-
|-
|180°
|72°
|0x8000
|0x3333
|0x0080
|-
|-
|270°
|96°
|0xC000
|0x4444
|0x00C0
|}
|}
An orientation consists of three angles, each of them stored in quantized form, as a 2-byte signed integer (short).  
An orientation consists of three angles, each of them stored in quantized form, as a 2-byte signed integer (short).  
:*Oni converts from the stored integer to an angle through multiplication by 360°/65535 = '''0.00549324'''78828[...]
:*Oni converts from the stored integer to an angle through multiplication by 360°/65535 = '''0.00549324'''78828[...]
:*Thus, when quantizing angles from a new animation, multiply the angles by 65535/360° = '''182.041'''6667[...]
:*Thus, when quantizing angles from a new animation, multiply the angles by 65535/360° = '''182.041'''6667[...]
(It would make more sense here to take the ratio with 65536 rather than 65535, but Oni indeed uses 65535.)
:*A quantized angle of 65535 never occurs in Oni, so apparently they consistently used only 0 through 65534.


Note that these angles cannot be used directly for interpolation, they must first be converted to quaternions.
Note that these angles cannot be used directly for interpolation, they must first be converted to quaternions.
Line 334: Line 323:
|(92°, 6°, 335°)
|(92°, 6°, 335°)
|}
|}
In this example, there are only two keyframes for every bone, and the orientation is identical for both keyframes : in fact, Shinatama remains completely frozen during the whole anim.
In this example, there are only two keyframes for every bone, and the orientation is identical for both keyframes : in fact, Shinatama's pose remains completely frozen during the whole anim (apart from a slight vertical jitter supplied by the height track).
 
'''N.B.''' An animation with frame count 10, like the above '''SHINZOMidle1''', also has a ''duration'' of 10 game ticks which extends 1 tick past the final rotation keyframe. If an intermediate pose needs to be calculated during the final tick (e.g., during slowmo), it will be interpolated between the final keyframe of the current animation and the first keyframe of the following animation. In the case of '''SHINZOMidle1''', the rotation pose is exactly the same throughout the animation, so the pose during the last tick of an idle loop will be constant as well (apart from the height shift).
 
====Origin and direction of the angles====
====Origin and direction of the angles====
If the (0°, 0°, 0°) orientation is set for every bone, then all the bones point along the x axis of the character (from right to left) and face upwards
If the (0°, 0°, 0°) orientation is set for every bone, then all the bones point along the x axis of the character (from right to left) and face upwards
Line 447: Line 439:
|}
|}
|}
|}
Those animations exactly coincide with the set of overlay animations, i.e. animations that do not animate/move the character as a whole, and merely apply variations (typically to the upper body) on top of the main animation.