ANIM (File Format): Difference between revisions

Jump to navigation Jump to search
imported>Jackoalan
imported>Jackoalan
Line 135: Line 135:
[[wikipedia:Delta encoding|delta encoded]] and [[wikipedia:Quantization (signal processing)|quantized]]
[[wikipedia:Delta encoding|delta encoded]] and [[wikipedia:Quantization (signal processing)|quantized]]
to make for a very compact, compressed animation. The data is processed sequentially to reconstruct the
to make for a very compact, compressed animation. The data is processed sequentially to reconstruct the
uncompressed bone channel data.
uncompressed bone channel data as quaternions.


In addition to the bitstream quantization, the format includes a bitmap specifying which frames of the animation have
In addition to the bitstream quantization, the format includes a bitmap specifying which frames of the animation have
Line 146: Line 146:


Once resolved, rotation components are divided by ''rotation_divisor'', resulting in an axis-angle
Once resolved, rotation components are divided by ''rotation_divisor'', resulting in an axis-angle
[[wikipedia:Axis–angle_representation#Rotation_vector|rotation vector]]. The magnitude of this vector
[[wikipedia:Axis–angle_representation#Rotation_vector|rotation vector]]. This rotation vector is converted
is the ''angle'' part and is multiplied by π and combined with the ''angle sign-bit'' to get the rotation in radians.
to quaternion imaginary components with the W component derived via normalization and a ''sign-bit''
packed into the bitstream:
 
<pre>
q = &pi; / 2.0 / rotation_divisor
X = sin(rx * q)
Y = sin(ry * q)
Z = sin(rz * q)
W = sqrt(MAX((1.0 - (X^2 + Y^2 + Z^2)), 0.0))
W = sign_bit ? -W : W
</pre>


Translation components are multiplied by ''translation_multiplier'', yielding world units.
Translation components are multiplied by ''translation_multiplier'', yielding world units.
Line 189: Line 199:
|Word-packed bitstream laid out as described by the descriptor table. The bitstream is unpacked just like ''key_bitmap'' (least-significant to most-significant).  
|Word-packed bitstream laid out as described by the descriptor table. The bitstream is unpacked just like ''key_bitmap'' (least-significant to most-significant).  
Key values are tightly-packed, quantized integers whose bit-depth is specified by the ''q_*'' values in the descriptor table.  
Key values are tightly-packed, quantized integers whose bit-depth is specified by the ''q_*'' values in the descriptor table.  
Each bone-channel key-set starts with a single bit providing the ''angle sign-bit'' (1 for negative, 0 for positive).
Each bone-channel key-set starts with a single bit providing the ''W sign-bit'' (1 for negative, 0 for positive).


The key integers are signed using [[wikipedia:Two's complement|Two's complement]] representation.
The key integers are signed using [[wikipedia:Two's complement|Two's complement]] representation.
Anonymous user

Navigation menu