======== Model Data ======== Banjo-Tooie uses a file-system in which most resources are packed into file blocks throughout the ROM, and are unpacked into RAM when needed. Among these are the model files, each with their own syntax and load-lines. This page's purpose is to cover the syntax and properties of said model files. Note that it is //very// similar to [[https://hack64.net/wiki/doku.php?id=banjo_kazooie:model_data|Banjo-Kazooie's model format]], just with more features like collision changes, optimised texture headers, and F3DEX2 instead of F3DEX. ===== Header ===== ^ Address ^ Value/Syntax ^ Description ^ | 0x00000000 | [00 00 00 0B] | START | | 0x00000004 | [aa aa aa aa] | Geometry Layout Offset | | 0x00000008 | [bb bb cc cc] | bb=Texture Setup Offset (Usually 00 50), cc=Geo Type* | | 0x0000000C | [dd dd dd dd] | Display List Setup Offset | | 0x00000010 | [ee ee ee ee] | Vertex Store Setup Offset | | 0x00000014 | [00 00 00 00] | ? | | 0x00000018 | [ff ff ff ff] | Animation Setup | | 0x0000001C | [gg gg gg gg] | Collision Setup | | 0x00000020 | [hh hh hh hh] | Effects Setup End Address | | 0x00000024 | [hh hh hh hh] | Effects Setup | | 0x00000028 | [ii ii ii ii] | Vertex-Bone Mapping | | 0x0000002C | [jj jj jj jj] | Texure Animation Setup | | 0x00000030 | [00 00 00 00] | ? | | 0x00000034 | [00 00 kk kk] | Related to external textures??? | | 0x00000038 | [ll ll ll ll] | Vertex Normals | | 0x00000044 | [nn nn oo oo] | nnnn= Tri count, oooo= vert count | | 0x00000048 | [00 00 00 00] | ? | | 0x0000004C | [00 00 00 00] | ? | ''*Geo Types: 0000=normal, 0002= Trilinear MipMapping (RGBA16), 0004=Env mapping, 0010=?'' ---- ===== Texture Setup ===== ^ Offset from TexSetup Start ^ Value/Syntax ^ Description ^ | 0x00000000 | [aa aa aa aa] | Amount of data in bytes to load (including command) | | 0x00000004 | [bb bb cc 00] | bb=Texture Count, cc=External Textures(01y 00n) | | 0x00000008 | [dd dd dd dd] | Texture[i] segment address from texture data start OR External Texture Index* | | 0x0000000C | [ee ff xx yy] | Texture[i] ee = 0x80 for MIP Mapping (00 otherwise), ff =type*, xxyy=Pixel Grid | ''*Types: 01=CI4, 02=CI8, 04=RGBA16, 08=RGBA32, 0x10=IA8,'' *External texture indices start at FileID 0x1EF6, 0 indexed. Example: 00 00 13 28 80 04 20 20 External texture file ID= 1EF6+1328 = 321E This will load an RGBA16 32x32 mipmapped texture from FileID 0x321E. ---- ==== Display List Setup ==== ^ Offset from DLSetup Start ^ Value/Syntax ^ Description ^ | 0x00000000 | [aa aa aa aa 00 00 00 00] | F3DEX2 Command Count | | 0x00000008 | [[http://hack64.net/wiki/doku.php?id=f3dex2|F3DEX2]] | F3DEX2 Display List | ---- ==== Vertex Store Setup ==== ^ Offset from VTXSetup Start ^ Value/Syntax ^ Description ^ | 0x00000000 | [aa aa bb bb cc cc] | Draw distance: Negative Coords | | 0x00000006 | [dd dd ee ee ff ff] | Draw distance: Positive Coords | | 0x0000000C | [xx xx yy yy zz zz] | Object Coordinate Range | | 0x00000012 | [jj jj] | Collision range? (Enemies, Objects) | | 0x00000014 | [kk kk] | Collision range? (Banjo) | | 0x00000016 | [ll ll] | Vertex Count*2 | ---- ==== Animation Setup ==== ^ Offset from Setup Start ^Value/Syntax ^Description ^ | 0x00000000 | [aa aa aa aa] | Translation Scale (float) | | 0x00000004 | [bb bb 00 00] | Bone Count| ^ Offset From Bone Start ^ ^ ^ | 0x00000000 | [xx xx xx xx] | Bone X Translation (float) | | 0x00000004 | [yy yy yy yy] | Bone Y Translation (float) | | 0x00000008 | [zz zz zz zz] | Bone Z Translation (float) | | 0x0000000C | [cc cc dd dd] | cccc=Bone ID, dddd=Parent Index | ---- ==== Effects Setup ==== ^ Offset from Setup Start ^ Value/Syntax ^ Description ^ | 0x00000000 | [aa aa] | Effect Count | | 0x0000002 | [bb bb cc cc] | bbbb=Effect ID, cccc=Effect Vertex Count| | 0x0000006 | [dd dd ee ee] | dddd, eeee...=Effect Vertex Index List | | ...||| Effect IDs are 100*Type + Param (decimal) where Param is usually used to control the speed of the effect, and Type is taken from ^Type^DLL Name^Description^ | 0 | | Code room letters | | 1 | idscroll | Texture scrolling (along vertical axis) | | 2 | idlight | Flickering vertex color, for fake lighting around flames | | 3 | idwater | Oscillating texture scrolling | | 4 | | | | 5 | idglow | Vertex color regularly gets brighter and dimmer | | 6 | | | | 7 | idwave | Rippling water surface, amplitude controlled by bounding box of affected vertices | | 8 | idglowa | Like glow, but only for vertex alpha | | 9 | idflasha | | | 10 | idflash | | | 11 | | | | 12 | idwibble | All wibbles use a spherical wave to change some vertex parameters (usually texture coordinate and color). This one is faster, with a smaller amplitudes| | 13 | idwibble | Standard wibble | | 14 | idwibble | Only wibble color | | 15 | idwibble | Only wibble texture coordinates | | 16 | idwibble | Also move up and down, like idwave | | 17 | idbounce | Used for bouncy castle | | 18 | idtwinkle | Used for mine crystals; occasionally choose a center vertex and briefly brighten the vertex colors on its neighbors with random delays| | 19 | idflame | | | 20 | idtwinklea | | | 21 | idwibble | Fast wibble, with larger amplitudes| | 22 | idtwinklecolour | | ---- ==== Vertex-Bone Mapping ==== ^ Offset from Setup Start ^Value/Syntax ^Description ^ | 0x00000000 | [aa aa bb bb] | aaaa=Has Norms, bbbb=Entry Count | ^ Offset From Entry Start ^ ^ ^ | 0x00000000 | [cc cc dd dd ee ee] | cccc=Bone ID, dddd=Position Count, eeee=Normal Count | | 0x00000006 | [xx xx yy yy zz zz] | Vertex Position (in bone space) | | ... | | | | 0x6 + 6*Positions | [xx yy zz 00] | Vertex Normal (in bone space) | | ... | | | | 0x6 + 6*Positions + 4*Normals | [ee ee ff ff] | eeee, ffff,...=Vertex IDs | Each vertex is assumed to have its own normal, but some share positions. The initial vertices are assigned the first position, then an ID of -1 in the list indicates that the following vertices should use the next position in the list, and -2 indicates the end. Thus there are (Normal Count) + (Offset Count) entries in the ID list, including the negative values. ---- ==== Texture Animation Setup ==== Up to five entries corresponding to segments 0xF,0xD,0xE,0xC,0xB of the following form: ^ Offset from Entry Start ^Value/Syntax ^Description ^ | 0x00000000 | [aa aa bb bb] | aaaa=Block Size, bbbb=Block Count | | 0x00000004 | [cc cc cc cc] | Frames Per Second (float)| A block is contiguous memory holding texture data which gets loaded into the corresponding segment. The chosen block advances at the specified framerate, looping back around to the beginning. ----