Author Topic: CHRONO CROSS FILE EXPLORATION THREAD  (Read 83946 times)

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: CHRONO CROSS FILE EXPLORATION THREAD
« Reply #495 on: May 10, 2008, 05:45:58 pm »
Ah, the unknown data was throwing me off after all.

I've attached a proposal for a revised Section 1-1 model. It has 8-byte headers consistently, and the number of sections should add up to the number indicated in the first four bytes of the header. Headers are in bolded boxes.

Besides the unknown data highlighted in red, I'm a little miffed that only the 16-byte mode vertex assignment headers have offsets into Section 1-3 (regardless of whether you use this proposed model or M's model with 4-byte headers for the 8-byte mode vertex assignments). Section 1-1-2's header is an offset from the beginning of Section 1-3, and Section 1-1-4's header is an offset from the end of the previous run of 8-byte mode vertices in Section 1-3. In other words, each 16-byte mode vertex assignment header seems to report the length of the previous 8-byte mode run in Section 1-3. Why the 8-byte mode data requires no such offset, I haven't a clue.

I'm really hoping that the model data from offset 0x20 ~ 0x40 is simply a Section 1 header, since it seems to report the starts of Section 1-2, Section 1-3, and Section 1-4, as we found waaay long ago. Could the unknown data be some kind of "footer" to the 16-byte mode vertex assignments?

In any case, time to figure out what this unknown data does...

[attachment deleted by admin]
« Last Edit: May 11, 2008, 09:38:43 am by FaustWolf »

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: CHRONO CROSS FILE EXPLORATION THREAD
« Reply #496 on: May 10, 2008, 06:42:22 pm »
First results in. Zeroing out the entire range 0x28C ~ 0x2AC freezes the game, so we know that it's way important.

Here's what happens when I change the four-byte value starting at address 0x290 from 24 00 80 01 to 24 00 80 00:


The result is eerily similar to wiping out "...all the data at the beginning of Section 1-2, offsets 0x0358 ~ 0x0FB8."
http://www.chronocompendium.com/Forums/index.php/topic,4770.msg84651.html#msg84651

Thus, this piece of unknown data may be somehow responsible for completing the process by which texture pieces are mapped to the polygons. Maybe.

Quick link to our wiki for viewer's convenience.
http://www.chronocompendium.com/Term/Character_Battle_Models.html#Example_1:_Serge
« Last Edit: May 11, 2008, 09:37:48 am by FaustWolf »

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: CHRONO CROSS FILE EXPLORATION THREAD
« Reply #497 on: May 10, 2008, 08:49:34 pm »
Alrighty, it appears that all the unknown data affects Section 1-2's relationship to the model. Here's some test results for perusal.

Changed four bytes @ 0x29C from 60 0C 00 00 to 60 0D 00 00:


Changed four bytes @ 0x2A0 from 38 26 00 00 to 38 27 00 00:


Changed four bytes @ 0x2A8 from 6C 4D 00 00 to 6C 5E 00 00:
...and there was no discernable effect on the model. Perhaps the polygons affected are too small to be seen easily.

Changed four bytes @ 0x348 from 24 00 0C 00 to 24 00 0E 00:


Changed four bytes @ 0x350 and four bytes at 0x354 from 2C 00 20 00 90 00 00 00 to 2C 00 22 00 A0 00 00 00:


My guess is that they're pointers, but perhaps it's best to wait until we take an in-depth look at Guile's model so that we have something to compare these unknown data to. Once I've got all known sections of Serge wiki-fied, I'll analyze Guile, locate differences in structure from Serge's, and bring those up here for collective analysis.


EDIT: Luminaire, I said earlier I'd let you know about another theory of joint rotation that M posted about earlier. He gave us a link to "Gimbal lock" joint information here: http://www.chronocompendium.com/Forums/index.php/topic,4770.msg87978.html#msg87978
« Last Edit: May 10, 2008, 10:13:20 pm by FaustWolf »

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: CHRONO CROSS FILE EXPLORATION THREAD
« Reply #498 on: May 11, 2008, 11:43:01 am »
Fourth post in a row. I'm such a poor role model. :P

I know we've been over Section 2 ad infinitum, but wanted to make sure I've got the joint articulation format right, and to bring up the XYZ rotation order issue again.

A map of Serge's Section 2 is attached to the post. The format I have might be described as:


PB PB PB PB XR XR ZR ZR - YR YR XC XC ZC ZC YC YC
CB CB CB CB

Where...
 PB = "Parent Bone" index.
 XR = X rotation
 ZR = Z rotation
 YR = Y rotation
 XC = X coordinate in 3D space relative to last joint
 ZC = Z coordinate in 3D space relative to last joint
 YC = Y coordinate in 3D space relative to last joint
 CB = "Child Bone" index.


Is this an accurate way of describing the format? I changed my earlier notation so that both rotation and 3D coordinate order are commensurate with the debug mode X-Z-Y rotation order. I'm hoping 3D coordinate specifications follow the same order for simplicity.

Also, just so I understand how the joints, bone lengths, and rotations are interrelated, is this an accurate portrayal?


According to this model, Section 2 gives each joint a relation to a parent bone and a child bone. A particular joint's X-Z-Y coordinates are given relative to its counterpart on the parent bone I guess, and bone length would be the displacement between X1Z1Y1 and X0Z0Y0. Presumably the vertices for a specific bone are assigned to that bone's originating joint in Section 1-1. Maybe? Before I wikify this, I want to make sure it's accurate to everyone else's current understanding.
 

[attachment deleted by admin]
« Last Edit: May 11, 2008, 11:46:30 am by FaustWolf »

Luminaire85

  • Guru of Time Emeritus
  • Chronopolitan (+300)
  • *
  • Posts: 311
    • View Profile
    • Chrono Cinema
Re: CHRONO CROSS FILE EXPLORATION THREAD
« Reply #499 on: May 11, 2008, 12:28:42 pm »
My understanding is that it's closer to this:

PJ PJ PJ PJ XR XR YR YR - ZR ZR XC XC YC YC ZC ZC
BI BI BI BI

Where...
 PJ = Index of parent joint (-1 if no parent)
 XR = X rotation (range: -4096 to 4095, where 4096 = 360 degrees)
 YR = Y rotation (range: -4096 to 4095, where 4096 = 360 degrees)
 ZR = Z rotation (range: -4096 to 4095, where 4096 = 360 degrees)
 XC = X coordinate in 3D space relative to parent joint
 YC = Y coordinate in 3D space relative to parent joint
 ZC = Z coordinate in 3D space relative to parent joint
 BI = Current bone index (-1 if current joint and parent joint do not form a bone)

Of course, I don't have that part of my import script working 100% yet, so the above should be taken with at least two grains of salt.

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: CHRONO CROSS FILE EXPLORATION THREAD
« Reply #500 on: May 12, 2008, 12:13:55 am »
Awesome, I've put your model in the wiki for now Luminaire. That explains the FF FF values we see on occasion; I hadn't a clue what those meant before.
« Last Edit: May 12, 2008, 12:33:21 am by FaustWolf »

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: CHRONO CROSS FILE EXPLORATION THREAD
« Reply #501 on: May 12, 2008, 11:59:44 pm »
General Theory of Chrono Cross Model Data

If everyone agrees, this will be carved into the Grand Obelisk of Chrono knowledge.

The Character Battle Model format consists of the following, in order:


MODEL HEADER
*Section 1
  Section 1 Header
   "Constructs"
    UV Map
    Vertex Pool
    VDDM (Vestigial Data that Doesn't Matter)
*Section 2 (Skeleton)
  Skeletal Units
*Section 3 (Yet Uknown; affects model shading and placement on the battlefield)
*Section 4 (Animations)
*Section 5 (Uknown)


MODEL HEADER:

#S #S #S #S S1 S1 S1 S1 - S2 S2 S2 S2 S3 S3 S3 S3
S4 S4 S4 S4 S5 S5 S5 S5 - S6 S6 S6 S6 EF EF EF EF
  Where...
  #S = Number of Sections in the model.
  S1 = Starting Offset of Section 1.
  S2 = Starting Offset of Section 2.
  S3 = Starting Offset of Section 3.
  S4 = Starting Offset of Section 4.
  S5 = Starting Offset of Section 5.
  S6 = Starting Offset of Section 6 (usually set to zero, making it de facto nonexistent).
  EF = End of File address.


Section 1
Section 1 is composed of a number of units I'll call "Constructs" for lack of a better term at the moment. Each "Construct" apparently ties together parts of the model's UV Map, Vertex Pool, the VDDM, and the skeleton defined in Section 2.

Section 1 Header:

#C #C #C #C C1 C1 C1 C1 - C2 C2 C2 C2 ... ?? ?? ?? ?? ?? ?? ?? ??
  Where...
  #C = Number of Constructs
  C1 = Starting Offset of the First Construct, relative to the beginning of Section 1.
  C2 = Starting Offset of the Second Construct, relative to the beginning of Section 1.
  ... = More starting offsets of additional Constructs, relative to the beginning of Section 1.
  ?? = There are four bytes of data that may be a checksum, followed by an additional four bytes
       of unknown purpose.


Construct Format:
Each construct consists of a Header followed by 8-byte mode vertex assignments, 16-byte mode vertex assignments, and a UV Footer.

Construct Header...

UM UM UM UM VP VP VP VP - VD VD VD VD
 Where...
 UM = Offset into the UV Map, relative to the beginning of Section 1;
      start grabbing texture pieces here.
 VP = Offset into the Vertex Pool, relative to the beginning of Section 1;
      start grabbing vertices here.
 VD = Offset into unknown Vestigial Data that can be zero'd out
      with absolutely no effect on the model.

8-byte mode vertex assignment header format: #A #A #A #A VO VO VO VO
8-byte mode vertex assignment format: NV NV JJ JJ
   Where...
    #A = Number of assignments that follow.
    VO = Offset into the Vertex Pool, relative to the VP offset given in the Construct Header.
    NV = Next NV Vertices are assigned to JJ JJ.
    JJ =Index of the joint to which the body of vertices is assigned.

16-byte mode vertex assignment header format: #A #A #A #A PP PP PP PP
16-byte mode vertex assigment format: NV NV 00 00 J1 J1 W1 W1 J2 J2 W2 W2
   Where...
    #A: Number of assignments that follow.
    NV: Next NV Vertices are assigned to J1 J1 and J2 J2.
    VO = Offset into the Vertex Pool, relative to the VP offset given in the Construct Header.
    J1: Index of the first joint to which the body of vertices is assigned.
    W1: Weight of the association between NV and J1 for animation purposes.
    J2: Index of the second joint to which the body of vertices is assigned.
    W2: Weight of the association between NV and J2 for animation purposes.

UV Footer: This tells the game engine where to look in the UV Map
     for the triangles and quads assigned to each construct.
#E #E #E #E TQ TQ ## ## UO UO UO UO...
  Where...
  #E = Number of 8-byte entries.
  TQ = First two bytes in the 8-byte entry. If it's set to 0x24, the next bytes refer to
        triangles; if set to 0x2C, the next bytes refer to quads.
  ## = Number of quads or triangles assigned to the Construct.
  UO = UV Map offset from which to start pulling the triangles or quads.
          Relative to the UM offset given in the construct header.
  ... = More TQ, ##, and UO information for each additional entry.



Section 2
Section 2 sets the model's skeletal orientation.

Section 2 Header

NB NB NB NB
  Where NB = Number of Bones


Bone format...

PJ PJ PJ PJ XR XR YR YR - ZR ZR XC XC YC YC ZC ZC
BI BI BI BI
 Where...
 PJ = Index of parent joint (0xFFFF, or -1 if this bone has no parent joint)
 XR = X rotation (range: 0XF000 ~ 0xFFF, or -4096 to 4095, where 4096 = 360 degrees)
 YR = Y rotation (range: 0XF000 ~ 0xFFF, or -4096 to 4095, where 4096 = 360 degrees)
 ZR = Z rotation (range: 0XF000 ~ 0xFFF, or -4096 to 4095, where 4096 = 360 degrees)
 XC = X coordinate in 3D space relative to parent joint
 YC = Y coordinate in 3D space relative to parent joint
 ZC = Z coordinate in 3D space relative to parent joint
 BI = Current bone index (0xFFFF, or -1 if current joint and parent joint do not form a bone)


Below are Serge & Guile's constructs mapped out for everyone's perusal. You can check Serge's Construct Map against the information we have in the wiki, and I'm going to map out all of Guile's UV Map & Vertex Pool based on his Construct info. If it works out, we'll have confirmed the model. Luminaire, hopefully this will help you fine-tune your model importer so that it can recreate all models properly. I think most of the problems would have originated from Section 1-1 (the "Constructs"), but the number of Constructs determine how many switchovers occur in the UV Map (from triangles to quads and vice versa) and the Vertex Pool (from 8-byte mode to 16-byte mode and vice versa), so I guess any problems encountered there would carry over into the results for Sections 1-2 and 1-3.

Color codes in the attached maps...
Regular text: Section 1 header
Grey background: Construct Header
Boxed, white background: 8-byte and 16-byte mode vertex assignment headers.
Yellow-Plum-Lime-Turquoise-Tan-etc. backgrounds: Vertex Assignments.
Red background: Construct Footer.

Serge's "Constructs"


Guile's "Constructs"



EDIT: Oh! I may have joints and bones mixed up in my model of Construct vertex assignments. Someone let me know if those should be bone indices and not joint indices.

EDIT: Also, I forgot to fit in our findings regarding the UV Map and Vertex Pool data formats, but they're still in the wiki as we described them months ago.
« Last Edit: May 13, 2008, 02:08:51 am by FaustWolf »

Akari

  • Iokan (+1)
  • *
  • Posts: 11
    • View Profile
Re: CHRONO CROSS FILE EXPLORATION THREAD
« Reply #502 on: May 13, 2008, 01:15:34 pm »
By the way, there is not such thing as bone at this stage. All bones was left during exporting model to native game format. Only matrix and their hierarchy left. They may be similar, but not exactly, please remember that.

Maybe "BI = Current bone index (0xFFFF, or -1 if current joint and parent joint do not form a bone)" is index to model part influenced by transformation matrix?

And  - 0xFFF not 4096, but 1 in 12 bit fixed point. It used in transformation packet in GTE.

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: CHRONO CROSS FILE EXPLORATION THREAD
« Reply #503 on: May 13, 2008, 08:21:41 pm »
Luminaire, does Akari's info help things out any with interpreting Section 2 for model viewing purposes?

In other news, the General Theory works for all of Section 1 of Guile's model data, though once again I'm confuzzled as to what the indices mean exactly in Section 2 and as well as what order the rotations are supposed to be in. Attached to this post is a zip file with Excel spreadsheets mapping out Guile's model data as far as we can at this point.

[attachment deleted by admin]
« Last Edit: May 13, 2008, 08:27:19 pm by FaustWolf »

Luminaire85

  • Guru of Time Emeritus
  • Chronopolitan (+300)
  • *
  • Posts: 311
    • View Profile
    • Chrono Cinema
Re: CHRONO CROSS FILE EXPLORATION THREAD
« Reply #504 on: May 13, 2008, 09:06:22 pm »
I had reached the same conclusion about the Section 2 data in the last few weeks I think.

Hopefully I'll have some time to add the new knowledge to my script soon. I don't really expect it to improve the results I'm seeing with the current version, as I think it's the Section 2 data that really needs a second look.

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: CHRONO CROSS FILE EXPLORATION THREAD
« Reply #505 on: May 13, 2008, 11:36:56 pm »
Luminaire and others, let me know if there's any tests I could run to confirm theories on any part of Section 2. Though I think my previous experiments just confused the hell outta me with regard to the rotation orders.

Luminaire85

  • Guru of Time Emeritus
  • Chronopolitan (+300)
  • *
  • Posts: 311
    • View Profile
    • Chrono Cinema
Re: CHRONO CROSS FILE EXPLORATION THREAD
« Reply #506 on: May 13, 2008, 11:57:54 pm »
One thing you might try is zeroing out all of the Section 2 rotation data and seeing what happens. (Hopefully that doesn't result in crashing the game.)

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: CHRONO CROSS FILE EXPLORATION THREAD
« Reply #507 on: May 14, 2008, 02:25:28 pm »
Serge's Extreme Yoga Workout continues!



All the animations from Section 4(?) still act properly on the bones, but Serge is just a bit discombobulated. I'll work on getting some screencaps from choice angles so you can see the effects better.

EDIT: Perhaps we could get a nice static pose if I erased all the data in Section 4 (which I *assume* contains all the animations). Then we could test out the bone angles one at a time to see the rotation order.

EDIT: Here's a collage with more views of what happens when the bone angles in Section 2 are zero'd out.


I need to do a bit of careful teasing to eliminate Section 4 animation data, because the game freezes if any headers are zero'd out there.  :oops:
« Last Edit: May 14, 2008, 03:06:27 pm by FaustWolf »

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: CHRONO CROSS FILE EXPLORATION THREAD
« Reply #508 on: May 14, 2008, 04:30:04 pm »
NOW we're getting somewhere. I can get the standing animation eliminated for the most part, but interestingly, I only partially eliminated said animation and a few frames still seem to work.

This is with all the bone rotations eliminated as well, so no rotations and no animation frames applied in this pic:


What will be eminently useful, perhaps, is if I get a standing-still Serge for you. It should essentially show exactly what your import script should produce!  :lee:

UBER EDIT FTW!
Here's Serge with no animation frames applied. However, note that I suspect Serge's weapon arm still has part of an animation applied, because that's the exact position his arm is in when he gets into battle stance once the un-eliminated frames of his standing animation play. I wonder about his non-weapon arm as well, so I'll go back and shave off as much animation data as I can without getting the model totally screwed up.






Next up will be Guile and Kid, because they each have special extensions -- Guile's long sleeves and Kid's hair braid.
« Last Edit: May 14, 2008, 04:59:32 pm by FaustWolf »

Luminaire85

  • Guru of Time Emeritus
  • Chronopolitan (+300)
  • *
  • Posts: 311
    • View Profile
    • Chrono Cinema
Re: CHRONO CROSS FILE EXPLORATION THREAD
« Reply #509 on: May 14, 2008, 05:22:37 pm »
Excellent.

Are you still zeroing out the rotation data in Section 2? If not, I wouldn't mind seeing a screenshot of that with no animations applied. If the result looks like what my script produces when I ignore those Section 2 rotations, then I will know that I am on the right track.