Difference between revisions of "FF7/Battle model format (PSX)"
my_wiki>Cyberman (→Playstation Battle Model Format) |
my_wiki>Cyberman (→Playstation Battle Model Format) |
||
Line 1: | Line 1: | ||
− | == Playstation | + | == Playstation battle model format == |
The entire file is compressed using [[FF7/LZS format|LZS format]] and is decompressed into the playstation user memory for a battle. The file consists of several section blocks, a header, compiled HRC and model information, battle animations, a texture image in [[PSX/TIM_format|TIM format]], and optional weapon models. All integers short or long are little endian based. This includes some of the [[FF7/Animation Format|animation data]] as well. | The entire file is compressed using [[FF7/LZS format|LZS format]] and is decompressed into the playstation user memory for a battle. The file consists of several section blocks, a header, compiled HRC and model information, battle animations, a texture image in [[PSX/TIM_format|TIM format]], and optional weapon models. All integers short or long are little endian based. This includes some of the [[FF7/Animation Format|animation data]] as well. | ||
− | === Battle | + | === Battle model header === |
The header section is a sequence of little endian 32 bit unsigned integers. The first integer (entitled SectionCount) contains the number of pointers offset from the begining of the file. The remaining integers are SectionCount number of pointers. | The header section is a sequence of little endian 32 bit unsigned integers. The first integer (entitled SectionCount) contains the number of pointers offset from the begining of the file. The remaining integers are SectionCount number of pointers. | ||
− | === Battle | + | === Battle model HRC/model information === |
This is the first section and consists of real model data and bone structure. Without the animation information the model CANNOT be displayed properly. | This is the first section and consists of real model data and bone structure. Without the animation information the model CANNOT be displayed properly. | ||
− | ==== HRC | + | ==== HRC data ==== |
This data resembles [[PSX/HRC|Hierarchy files (.HRC)]], from the PsyQ library. To be correct the HRC files were used to generate this information hence it's called HRC data. The HRC data begins with an unsigned 32 bit integer (BoneCount) indicating the number of bones. Following this is the '''root bone''', which is allays zero'd. After the root bone is BoneCount number of bones. The bone information is stored in a structure like the thus (using C conventions): | This data resembles [[PSX/HRC|Hierarchy files (.HRC)]], from the PsyQ library. To be correct the HRC files were used to generate this information hence it's called HRC data. The HRC data begins with an unsigned 32 bit integer (BoneCount) indicating the number of bones. Following this is the '''root bone''', which is allays zero'd. After the root bone is BoneCount number of bones. The bone information is stored in a structure like the thus (using C conventions): | ||
<pre>typedef struct | <pre>typedef struct | ||
Line 20: | Line 20: | ||
Where offset is relative to the begining of the section. If Offset is 0 then the object is a '''Joint''' otherwise it's a bone. All FF7 bone lengths are negative. | Where offset is relative to the begining of the section. If Offset is 0 then the object is a '''Joint''' otherwise it's a bone. All FF7 bone lengths are negative. | ||
− | ==== Model | + | ==== Model information ==== |
Following the HRC Data is the model information, these are referenced by offsets in the '''Bone''' structure. Each bone has it's own model section specific too it. Each bone section has the following information uint32 VertexCount (int bytes), Vertices, Textured Triangle Count (Poly Count Structure), Textured Triangles, Textured Quadric Count (PCS), Textured Quadrics, Triangle Count (PCS), Triangles, Quadric Count (PCS), Quadrics. If the count of any of these is zero then the follow data is a Poly Count Structure. | Following the HRC Data is the model information, these are referenced by offsets in the '''Bone''' structure. Each bone has it's own model section specific too it. Each bone section has the following information uint32 VertexCount (int bytes), Vertices, Textured Triangle Count (Poly Count Structure), Textured Triangles, Textured Quadric Count (PCS), Textured Quadrics, Triangle Count (PCS), Triangles, Quadric Count (PCS), Quadrics. If the count of any of these is zero then the follow data is a Poly Count Structure. | ||
Line 88: | Line 88: | ||
The Flags field on the Textured polygons contains the texture palette offset for the [[PSX/TIM_format|TIM]] texture file associated with the model. The TexPage is not used in any of the battle models however battle scenes do use this to refer another page of texture data (for 8bpp [[PSX/TIM_format|TIM]]'s used in them). | The Flags field on the Textured polygons contains the texture palette offset for the [[PSX/TIM_format|TIM]] texture file associated with the model. The TexPage is not used in any of the battle models however battle scenes do use this to refer another page of texture data (for 8bpp [[PSX/TIM_format|TIM]]'s used in them). | ||
− | === Battle | + | === Battle animations === |
This is identical to the PC version of FF7. | This is identical to the PC version of FF7. | ||
− | === Texture | + | === Texture information === |
see [[PSX/TIM_format|TIM format]] | see [[PSX/TIM_format|TIM format]] | ||
− | === Weapon | + | === Weapon models === |
These are identical to the bone model structures, as the weapon models are treated as bones in character animation. They have NO texture data period. | These are identical to the bone model structures, as the weapon models are treated as bones in character animation. They have NO texture data period. |
Revision as of 22:38, 4 August 2005
Contents
Playstation battle model format
The entire file is compressed using LZS format and is decompressed into the playstation user memory for a battle. The file consists of several section blocks, a header, compiled HRC and model information, battle animations, a texture image in TIM format, and optional weapon models. All integers short or long are little endian based. This includes some of the animation data as well.
Battle model header
The header section is a sequence of little endian 32 bit unsigned integers. The first integer (entitled SectionCount) contains the number of pointers offset from the begining of the file. The remaining integers are SectionCount number of pointers.
Battle model HRC/model information
This is the first section and consists of real model data and bone structure. Without the animation information the model CANNOT be displayed properly.
HRC data
This data resembles Hierarchy files (.HRC), from the PsyQ library. To be correct the HRC files were used to generate this information hence it's called HRC data. The HRC data begins with an unsigned 32 bit integer (BoneCount) indicating the number of bones. Following this is the root bone, which is allays zero'd. After the root bone is BoneCount number of bones. The bone information is stored in a structure like the thus (using C conventions):
typedef struct { uint16 Parent; int16 Length; uint32 Offset; } FF7_bone;
Where offset is relative to the begining of the section. If Offset is 0 then the object is a Joint otherwise it's a bone. All FF7 bone lengths are negative.
Model information
Following the HRC Data is the model information, these are referenced by offsets in the Bone structure. Each bone has it's own model section specific too it. Each bone section has the following information uint32 VertexCount (int bytes), Vertices, Textured Triangle Count (Poly Count Structure), Textured Triangles, Textured Quadric Count (PCS), Textured Quadrics, Triangle Count (PCS), Triangles, Quadric Count (PCS), Quadrics. If the count of any of these is zero then the follow data is a Poly Count Structure.
All structure information is 32 bit aligned for the PSX GPU.
typedef struct { uint16 Count; uint16 TexPage; } PolyCount; typedef struct { int16 X; int16 Y; int16 Z; int16 Unused; } Vertex; typedef struct { uint8 Red; uint8 Green; uint8 Blue; uint8 Unused; } Color; typedef struct { uint16 A; uint16 B; uint16 C; uint16 D; } PolyIndices; typedef struct { PolyIndices Vertexs; Color Colors[3]; } ColorTriangle; typedef struct { PolyIndices Vertexs; Color Colors[4]; } ColorQuadric; typedef struct { PolyIndices Vertex; uint8 U0, V0; unint16 Flags; uint8 U1, V1; uint8 U2, V2; } TexTriangle; typedef struct { PolyIndices Vertex; uint8 U0, V0; unint16 Flags; uint8 U1, V1; uint8 U2, V2; uint8 U3, V3; uint16 Unused; } TexQuadric;
The Flags field on the Textured polygons contains the texture palette offset for the TIM texture file associated with the model. The TexPage is not used in any of the battle models however battle scenes do use this to refer another page of texture data (for 8bpp TIM's used in them).
Battle animations
This is identical to the PC version of FF7.
Texture information
see TIM format
Weapon models
These are identical to the bone model structures, as the weapon models are treated as bones in character animation. They have NO texture data period.