Difference between revisions of "Sonic Heroes/Model Format"
From Sonic Retro
Igorseabra4 (talk | contribs) (Created page with "{{SCHG SH}} Sonic Heroes runs on a modified version of the RenderWare engine. Due to that, much of the model information regarding games created on similar versions of it, su...") |
Igorseabra4 (talk | contribs) |
||
Line 36: | Line 36: | ||
00 00 00 00 // unknown, always this value | 00 00 00 00 // unknown, always this value | ||
0D 00 01 40 // unknown, always this value | 0D 00 01 40 // unknown, always this value | ||
− | float32[3] // Boundary box | + | float32[3] // Boundary box maximum |
− | float32[3] // Boundary box | + | float32[3] // Boundary box mininum // Maximum values must be the bigger than minimum |
// END MODEL HEADER STRUCT | // END MODEL HEADER STRUCT | ||
Line 55: | Line 55: | ||
// END MATERIAL NUMBER STRUCT | // END MATERIAL NUMBER STRUCT | ||
− | // MATERIAL SECTION // this section occours ''numMaterials'' times | + | // MATERIAL REF SECTION // this section occours ''numMaterials'' times |
int32 0x07 // section identifier | int32 0x07 // section identifier | ||
int32 // section size | int32 // section size | ||
Line 66: | Line 66: | ||
int32 0x00 // ununsed flags | int32 0x00 // ununsed flags | ||
int8[4] RGBA // Material RGBA (usually 255, 255, 255, 255) | int8[4] RGBA // Material RGBA (usually 255, 255, 255, 255) | ||
− | int32 | + | int32 84 3E F5 2D // always this value, unused |
− | bool32 // uses texture? ( | + | bool32 // uses texture? (usually 0x01) |
float32[3] // ambient, specular, diffuse // don't know if these are used. always (1, 1, 1) | float32[3] // ambient, specular, diffuse // don't know if these are used. always (1, 1, 1) | ||
Line 102: | Line 102: | ||
string // alpha texture name (unused, always left blank) | string // alpha texture name (unused, always left blank) | ||
− | // END TEXTURE | + | // END ALPHA TEXTURE NAME SECTION |
// TEXTURE EXTENSION // this section does absolutely nothing | // TEXTURE EXTENSION // this section does absolutely nothing | ||
Line 120: | Line 120: | ||
// END MATERIAL EXTENSION | // END MATERIAL EXTENSION | ||
− | // END MATERIAL SECTION | + | // END MATERIAL REF SECTION |
// END MATERIAL LIST SECTION | // END MATERIAL LIST SECTION | ||
Line 136: | Line 136: | ||
int32 // number of triangles (''numTriangles'') | int32 // number of triangles (''numTriangles'') | ||
int32 // number of vertices (''numVertices'') | int32 // number of vertices (''numVertices'') | ||
− | float32[3] // Boundary box | + | float32[3] // Boundary box maximum |
− | float32[3] // Boundary box | + | float32[3] // Boundary box mininum // These last 4 values are the same as the ones in the model header |
− | + | 84 D9 50 2F // always this, unknown | |
int32 0x00 // unknown, always 0x00 | int32 0x00 // unknown, always 0x00 | ||
''numVertices''*float32[3] // X, Y, Z position coordinate for each vertex | ''numVertices''*float32[3] // X, Y, Z position coordinate for each vertex | ||
Line 156: | Line 156: | ||
int32 // section size | int32 // section size | ||
int32 0x1400FFFF | int32 0x1400FFFF | ||
− | uint32 // flags (0 = | + | uint32 // flags (0 = triangle lists, 1 = triangle strips; Sonic Heroes always uses tristrips, don't know if it even supports trilists) |
− | uint32 // number of meshes (numMeshes; usually same number of materials) | + | uint32 // number of objects/meshes (''numMeshes''; usually same number of materials) |
uint32 // total number of indices | uint32 // total number of indices | ||
− | numMeshes*( | + | ''numMeshes''*( |
− | uint32 // number of indices (numIndices) | + | uint32 // number of vertex indices in this mesh (''numIndices'') |
uint32 // material index | uint32 // material index | ||
− | uint32[numIndices] // vertex indices | + | uint32[''numIndices''] // vertex indices |
) | ) | ||
Line 180: | Line 180: | ||
// END WORLD SECTION | // END WORLD SECTION | ||
− | === Texture Flag Struct Settings === | + | ==== Texture Flag Struct Settings ==== |
Texture filtering modes (unsure if all of them work in SH) | Texture filtering modes (unsure if all of them work in SH) | ||
− | *0 - FILTERNAFILTERMODE (filtering is disabled) | + | * 0 - FILTERNAFILTERMODE (filtering is disabled) |
− | *1 - FILTERNEAREST (Point sampled) | + | * 1 - FILTERNEAREST (Point sampled) |
− | *2 - FILTERLINEAR (Bilinear) | + | * 2 - FILTERLINEAR (Bilinear) |
− | *3 - FILTERMIPNEAREST (Point sampled per pixel mipmap) | + | * 3 - FILTERMIPNEAREST (Point sampled per pixel mipmap) |
− | *4 - FILTERMIPLINEAR (Bilinear per pixel mipmap) | + | * 4 - FILTERMIPLINEAR (Bilinear per pixel mipmap) |
− | *5 - FILTERLINEARMIPNEAREST (Mipmap interp point sampled) | + | * 5 - FILTERLINEARMIPNEAREST (Mipmap interp point sampled) |
− | *6 - FILTERLINEARMIPLINEAR (Trilinear) | + | * 6 - FILTERLINEARMIPLINEAR (Trilinear) |
Texture addressing modes (unsure if all of them work in SH) | Texture addressing modes (unsure if all of them work in SH) | ||
− | *0 - TEXTUREADDRESSNATEXTUREADDRESS (no tiling) | + | * 0 - TEXTUREADDRESSNATEXTUREADDRESS (no tiling) |
− | *1 - TEXTUREADDRESSWRAP (tile in U or V direction) | + | * 1 - TEXTUREADDRESSWRAP (tile in U or V direction) |
− | *2 - TEXTUREADDRESSMIRROR (mirror in U or V direction) | + | * 2 - TEXTUREADDRESSMIRROR (mirror in U or V direction) |
− | *3 - TEXTUREADDRESSCLAMP | + | * 3 - TEXTUREADDRESSCLAMP |
− | *4 - TEXTUREADDRESSBORDER | + | * 4 - TEXTUREADDRESSBORDER |
{{SCHGuides}} | {{SCHGuides}} | ||
[[Category:Sonic Community Hacking Guide]] | [[Category:Sonic Community Hacking Guide]] |
Revision as of 01:23, 9 January 2017
SCHG: Sonic Heroes |
---|
Main Article |
Mechanic Editing |
DOL Editing |
Model Editing |
Collision Format Model Format |
Level Editing |
Camera Editing |
Particle Editing |
Particle Editing |
Sound Editing |
Music List |
SCHG How-Tos |
Custom Object Material Effect Tutorial |
Sonic Heroes runs on a modified version of the RenderWare engine. Due to that, much of the model information regarding games created on similar versions of it, such as Tony Hawk's Pro Skater 3 and some games of the Grand Theft Auto franchise applies to it as well. However, Sonic Heroes still has data which is specific for itself. There are currently no public tools that can generate custom models that are fully compatible with Sonic Heroes. The information on this page applies to the PC version only. The Gamecube version of the game uses a slighly different format.
Object Models
Models for objects and characters are located in DFF files, contained inside ONE archives. Those models can be imported and viewed in model editors using existing scripts for other games.
Level Models
Level models in Sonic Heroes are located in little endian BSP (binary space partitioning) files, contained inside .ONE archives in the dvdroot folder. Multiple BSPs are in each ONE archive, for the game to know which ones to display, it uses the *_blk.bin file. The archives can be opened with HeroesONE, and can be converted to OBJ using a modified version of BSP2OBJ.
Each BSP is a stream of binary data, divided into multiple sections, which can have multiple children and sibling sections. Each section starts with an array of three int32: the first one is an identifier for the section type, then there's the total size of the section, then there's 0x1400FFFF, which is the RenderWare engine version identifier (it's little endian so it's displayed FF FF 00 14 in the hex editor).
The total size of the section, as said above, includes the section itself and all children sections, but does not include this 0x0C byte "header". So get the total number of bytes in the section and subtract 0x0C to put there. Notice where each section starts and ends. All sections included into another one are children. The WORLD section, which includes the entire file, has in its header the total number of bytes in the file minus 0x0C.
Note that "struct" sections have an identifier of 0x01, "extension" sections have an identifier of 0x03 and all other sections have different identifiers. Most extensions do nothing, except for the Atomic Extension, which contains the Bin Mesh PLG section which contains triangle strips.
The file is little endian. It has the following structure, in order:
// WORLD SECTION int32 0x0B // section identifier int32 // section size int32 0x1400FFFF // MODEL HEADER STRUCT int32 0x01 // section identifier int32 // section size (always 0x40) int32 0x1400FFFF int32 0x01 // unknown, always this value 00 00 00 80 // unknown, always this value 00 00 00 80 // unknown, always this value 00 00 00 80 // unknown, always this value int32 // number of triangles (numTriangles) int32 // number of vertices (numVertices) 00 00 00 00 // unknown, always this value 01 00 00 00 // unknown, always this value 00 00 00 00 // unknown, always this value 0D 00 01 40 // unknown, always this value float32[3] // Boundary box maximum float32[3] // Boundary box mininum // Maximum values must be the bigger than minimum // END MODEL HEADER STRUCT // MATERIAL LIST SECTION int32 0x08 // section identifier int32 // section size int32 0x1400FFFF // MATERIAL NUMBER STRUCT int32 0x01 // section identifier int32 // section size int32 0x1400FFFF int32 // number of materials (numMaterials), materials are ordered by a zero-based index numMaterials*int32 0xFFFFFFFF // there is a -1 for each material // END MATERIAL NUMBER STRUCT // MATERIAL REF SECTION // this section occours numMaterials times int32 0x07 // section identifier int32 // section size int32 0x1400FFFF // MATERIAL STRUCT int32 0x01 // section identifier int32 // section size (always 0x1C) int32 0x1400FFFF int32 0x00 // ununsed flags int8[4] RGBA // Material RGBA (usually 255, 255, 255, 255) int32 84 3E F5 2D // always this value, unused bool32 // uses texture? (usually 0x01) float32[3] // ambient, specular, diffuse // don't know if these are used. always (1, 1, 1) // END MATERIAL STRUCT // TEXTURE SECTION int32 0x06 // section identifier int32 // section size int32 0x1400FFFF // TEXTURE FLAG STRUCT int32 0x01 // section identifier int32 // section size (always 0x04) int32 0x1400FFFF int8 // byte, texture filtering mode (usually 0x02) 4bit // half the byte: U adressing mode (usually 0001) 4bit // half the byte: V adressing mode (usually 0001) bool8 // byte: use mipmap? (usually 0x01) // END TEXTURE FLAG STRUCT // DIFFUSE TEXTURE NAME SECTION int32 0x02 // section identifier int32 // section size int32 0x1400FFFF string // texture name // END DIFFUSE TEXTURE NAME SECTION // ALPHA TEXTURE NAME SECTION // unused section, alphas are set in the TXD int32 0x02 // section identifier int32 // section size (always 0x04) int32 0x1400FFFF string // alpha texture name (unused, always left blank) // END ALPHA TEXTURE NAME SECTION // TEXTURE EXTENSION // this section does absolutely nothing int32 0x03 // section identifier int32 // section size (0x00) int32 0x1400FFFF // END TEXTURE EXTENSION // END TEXTURE SECTION // MATERIAL EXTENSION // this section does absolutely nothing int32 0x03 // section identifier int32 // section size (0x00) int32 0x1400FFFF // END MATERIAL EXTENSION // END MATERIAL REF SECTION // END MATERIAL LIST SECTION // ATOMIC SECTION int32 0x09 // section identifier int32 // section size int32 0x1400FFFF // ATOMIC STRUCT int32 0x01 // section identifier int32 // section size int32 0x1400FFFF int32 // model flags (usually 0x00) int32 // number of triangles (numTriangles) int32 // number of vertices (numVertices) float32[3] // Boundary box maximum float32[3] // Boundary box mininum // These last 4 values are the same as the ones in the model header 84 D9 50 2F // always this, unknown int32 0x00 // unknown, always 0x00 numVertices*float32[3] // X, Y, Z position coordinate for each vertex numVertices*int8[4] // RGBA vertex color for each vertex numVertices*float32[2] // U, V texture mapping coordinate for each vertex numTriangles*int16[4] // (materialIndex, vertex1, vertex2, vertex3) index for each triangle // END ATOMIC STRUCT // ATOMIC EXTENSION int32 0x03 // section identifier int32 // section size int32 0x1400FFFF // BIN MESH PLG SECTION int32 0x050E // section identifier int32 // section size int32 0x1400FFFF uint32 // flags (0 = triangle lists, 1 = triangle strips; Sonic Heroes always uses tristrips, don't know if it even supports trilists) uint32 // number of objects/meshes (numMeshes; usually same number of materials) uint32 // total number of indices numMeshes*( uint32 // number of vertex indices in this mesh (numIndices) uint32 // material index uint32[numIndices] // vertex indices ) // END BIN MESH PLG SECTION // END ATOMIC EXTENSION // END ATOMIC SECTION // WORLD EXTENSION // this section does absolutely nothing int32 0x03 // section identifier int32 // section size (0x00) int32 0x1400FFFF // END WORLD EXTENSION // END WORLD SECTION
Texture Flag Struct Settings
Texture filtering modes (unsure if all of them work in SH)
- 0 - FILTERNAFILTERMODE (filtering is disabled)
- 1 - FILTERNEAREST (Point sampled)
- 2 - FILTERLINEAR (Bilinear)
- 3 - FILTERMIPNEAREST (Point sampled per pixel mipmap)
- 4 - FILTERMIPLINEAR (Bilinear per pixel mipmap)
- 5 - FILTERLINEARMIPNEAREST (Mipmap interp point sampled)
- 6 - FILTERLINEARMIPLINEAR (Trilinear)
Texture addressing modes (unsure if all of them work in SH)
- 0 - TEXTUREADDRESSNATEXTUREADDRESS (no tiling)
- 1 - TEXTUREADDRESSWRAP (tile in U or V direction)
- 2 - TEXTUREADDRESSMIRROR (mirror in U or V direction)
- 3 - TEXTUREADDRESSCLAMP
- 4 - TEXTUREADDRESSBORDER