Character Battle Models

From Chrono Compendium
Revision as of 03:47, 23 April 2008 by FaustWolf (Talk | contribs)

Jump to: navigation, search

As they exist on the game CD, Chrono Cross character battle models consist of applicable textures followed by the model geometry itself. The model data begin with a header that points to various sections, and the sections have their own subheaders and subsections.

Below Serge's, Kid's, and Guile's models are employed as examples of how the model data (vertices, shaders, animations, etc) are structured within the model file itself. Keep in mind that all data is represented in "Little Endian" Mode, meaning we humans must employ a byte-order reversal technique to understand it. For example, 06 00 00 00 means 0x06, and F8 4E 00 00 means 0x4EF8.

Also keep in mind that offset ranges are relative, meaning pointer tables report locations that are are a certain number of bytes from the beginning of the current header/subheader. This makes no difference in the overall file header when you're looking at the model data file as excised from the game CD, but it most certainly affects the correct interpretation of subheaders. Therefore, the offsets reported in subheader pointer tables are accompanied by (true offsets) from the beginning of the model file.

Example 1: Serge

HEADER...
OFFSETS  OFFSET VALUES
00000000 06 00 00 00 20 00 00 00-F8 4E 00 00 C8 50 00 00
00000010 28 52 00 00 CC A2 00 00-00 00 00 00 DC AB 00 00

SECTION 1 SUBHEADER...
OFFSETS  OFFSET VALUES
00000020 02 00 00 00 14 00 00 00-80 02 00 00 05 02 2B 04
00000030 F9 00 00 00 38 03 00 00-C8 28 00 00 28 42 00 00
00000040 11 00 00 00 00 00 00 00

Split into 4-byte chunks, the header and subheaders can be interpreted in the following way. "Section1," etc., report the beginning offsets of each section:

Header Offset Range: 00 ~ 1F
6 Sections       | Section1 0x20   | Section2 0x4EF8 | Section3 0x50C8
Section4 0x5228  | Section5 0xA2CC | Section6 N/A    | End of File 0xABDC

Section1 Offset Range: 20 ~ 4EF7
SubHeader Offset Range: 20 ~ 47
*Pointer 0x02 | PointerTable Start 0x14(34)| ??? 0x0280              | * 0x042B0205
??? 0xF9      | SubSection2 0x0338(0358)   | SubSection3 0x28C8(28E8)| SubSection4 0x4228(4248)
??? 0x11      | ??? 0x00

SubSection1 Offset Range: 48 ~ 357
SubSection2 (UV Texture Map) Offset Range: 358 ~ 28E7
 SubSection 2 Map...
 0x0358 ~ 0x0FB7: Triangle UV data and pointers (264 triangles)
 0x0FB8 ~ 0x2657: Quad UV data and pointers (362 quads)
 0x2658 ~ 0x26E7: Triangle UV data and pointers (12 triangles)
 0x26E8 ~ 0x28E7: Quad UV data and pointers (32 quads)
  Triangle UV data and pointer setup: U1 V1 U2 V2 U3 V3 P1 P1 - P2 P2 P3 P3
  Quad UV data and pointer setup:     U1 V1 U2 V2 U3 V3 U4 V4 - P1 P1 P2 P2 P3 P3 P4 P4

Rules for interpreting quad pointers... Rule for Positive Pointers (as interpreted in hexadecimal)

  • If you're in one of the first two columns, divide the byte pair value by 0x2, then by 0x8. This value is the index for the vertex to which the UV point is mapped.
  • If you're in one of the last two columns, divide the byte pair value by 0x8. This value is the index for the vertex to which the UV point is mapped.

Rule for Negative Pointers (as interpreted in decimal)

  • If you're in one of the first two columns, divide the byte pair value by 16. Go backward that number of positions into the non-UV data.
  • If you're in one of the last two columns, divide the byte pair value by 8. Go backward that number of positions into the non-UV data.

Rules for interpreting triangle pointers... Rule for Positive Pointers (hex)

  • If you're in the first column, divide the byte pair value by 0x8. This value is the vertex index.
  • If you're in one of the last two columns, divide the byte pair value by 0x2, then by 0x8. This value is the vertex index.

Rule for Negative Pointers (dec)

  • If you're in the first column, divide the byte pair value by 8. Go backward that number of positions into the non-UV data, adding an invisible position to the three extant positions.
  • If you're in one of the last two columns, divide the byte pair value by 16. Go backward that number of positions into the non-UV data, adding an invisible position to the three extant positions.
  • For triangles, switch pointers such that the first UV coordinate gets the second pointer; the second UV coordinate gets the third pointer; the third UV coordinate gets the first pointer. The pointers retain the division properties they had in their original positions.
SubSection3 (Vertex Pool) Offset Range: 28E8 ~ 4247
 SubSection 3 Map...
 0x28E8 ~ 0x324F: "8-byte mode", 301 vertices
 0x3250 ~ 0x3F6F: "16-byte mode", 210 vertices
 0x3F70 ~ 0x3F97: "8-byte mode", 5 vertices
 0x3F98 ~ 0x4247: "16-byte mode", 43 vertices
  "8-byte mode" setup...
   ZZ ** YY ** XX ** 00 00 - ZZ ** YY ** XX ** 01 00
   ZZ ** YY ** XX ** 02 00 - ZZ ** YY ** XX ** 03 00
  "16-byte mode" setup...
   ZZ ** YY ** XX ** 00 00 - ZZ ** YY ** XX ** 00 00
   ZZ ** YY ** XX ** 01 00 - ZZ ** YY ** XX ** 01 00
    Where...
    ZZ: Magnitude of coordinate on the up & down axis on the screen plane
    YY: Magnitude of coordinate on depth axis; toward or away from you with respect to the 
        screen.
    XX: Magnitude of coordinate on right & left axis on the screen plane
    **: A directional reverser byte. If 00, the vertex is placed in one direction on the axis, 
        and if FF, the vertex gets placed on a coordinate the same "magnitude" but opposite  
        direction on that axis. (In actuality, it merely specifies whether the value is 
        positive or negative in hex).
 ?? ??: The vertex index; two bytes per vertex.

    16-byte mode appears to come into play when a vertex is associated with more than one bone.
    * The first eight bytes represent the vertex's location relative to the first bone it is 
      associated with.
    * The second eight bytes represent the vertex's location relative to the second bone it is 
      associated with.

SubSection4 Offset Range: 4248 ~ 4EF7
 SubSection4 Pattern...
 ?? ?? ?? 00 ?? ?? ?? 00 - ?? ?? ?? 00 ?? ?? ?? 00
 ?? ?? ?? 00 ?? ?? ?? 00 - ?? ?? ?? 00 ?? ?? ?? 00
  The purpose of this SubSection is unknown; all data can be safely 00'd out and not affect   
  Serge's model shape or animations.

Example 2: Kid

HEADER...
OFFSETS  OFFSET VALUES
00000000 06 00 00 00 20 00 00 00-B4 4D 00 00 C4 50 00 00
00000010 24 52 00 00 F0 C6 00 00-00 00 00 00 00 D0 00 00

SECTION 1 SUBHEADER...
OFFSETS  OFFSET VALUES
00000020 02 00 00 00 14 00 00 00-38 02 00 00 D9 01 07 04
00000030 26 02 00 00 74 03 00 00-04 2C 00 00 64 42 00 00
00000040 17 00 00 00 00 00 00 00

Split into 4-byte chunks, the header and subheaders can be interpreted in the following way. "Section1," etc., report the beginning offsets of each section:

Header Offset Range: 00 ~ 1F
6 sections      | Section1 0x20    | Section2 0x4DB4   | Section3 0x50C4
Section4 0x5224 | Section5 0xC6F0  | Section6 N/A      | End of File 0xD000

Section1 Offset Range: 20 ~ 4DB3 
SubHeader Offset Range: 20 ~ 47
*Pointer 0x02 | PointerTableStart 0x14(34)| ??? 0x0238              | * 0x040701D9
??? 0x0226    | SubSection2 0x0374(0394)  | SubSection3 0x2C04(2C24)| SubSection4 0x4264(4284)'
??? 0x17      | ??? 0x00

SubSection1 Offset Range: 48 ~ 393
SubSection2 (UV Texture Map) Offset Range: 394 ~ 2C23
SubSection3 (Vertex Pool) Offset Range: 2C24 ~ 4283
SubSection4 Offset Range: 4284 ~ 4DB3

Example 3: Guile

HEADER...
OFFSETS  OFFSET VALUES
00000000 06 00 00 00 20 00 00 00-3C 4C 00 00 10 4F 00 00
00000010 70 50 00 00 1C E4 00 00-00 00 00 00 2C ED 00 00

SECTION 1 SUBHEADER...
OFFSETS  OFFSET VALUES
00000020 05 00 00 00 20 00 00 00-D8 00 00 00 C6 01 00 00
00000030 B8 01 00 00 5C 02 00 00-4B 03 9A 04 BE 02 00 00
00000040 3C 03 00 00 38 2A 00 00-D0 40 00 00 0D 00 00 00
00000050 00 00 00 00 

Split into 4-byte chunks, the header and subheaders can be interpreted in the following way. "Section1," etc., report the beginning offsets of each section:

Header Offset Range: 00 ~ 1F
6 Sections       | Section1 0x20    | Section2 0x4C3C  | Section3 0x4F10
Section4 0x5070  | Section5 0xE41C  | Section6 N/A     | End of File 0xED2C

Section1 Offset Range: 20 ~ 4C3B
SubHeader Offset Range: 20 ~ 53
*Pointer 0x05              | PointerTableStart 0x20(40)| ??? 0xD8                 | ??? 0x016C
??? 0x01B8                 | ??? 0x025C                | * 0x049A034B             | ??? 0x02BE
SubSection2 0x033C(035C)   | SubSection3: 0x2A38(2A58) | SubSection4: 0x40D0(40F0)| ??? 0x0D
??? 0x00

SubSection1 Offset Range: 54 ~ 35B
SubSection2 (UV Texture Map) Offset Range: 35C ~ 2A57
SubSection3 (Vertex Pool) Offset Range: 2A58 ~ 40EF
SubSection4 Offset Range: 40F0 ~ 4C3B

Example 4: Flea

Example 5: Slash

DISCLAIMER: This is still a working entry. All interpretations are subject to change with time.

SPECIAL THANKS: To Gemini for identifying the battle textures that led us to the models; to Luminaire85 for finding and interpreting the headers and subheaders, fine-tuning various theories, and coding the model viewer; to MDenham for figuring out how the pointers and Section 1-1 work; and to Halkun, Cyberman and yaz0r for providing constant advice and guidance.