This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
banjo_kazooie:model_data [2024/02/10 04:31] BanjoFreak64 [Vertex Store Setup] |
banjo_kazooie:model_data [2024/07/29 12:31] (current) ThatCowGuy added Info about RefPoints being used for Jigsaw Look-Ats |
||
---|---|---|---|
Line 20: | Line 20: | ||
| 0x00000030 | [<color #22b14c>kk kk</color> <color #00a2e8>ll ll</color>] | <color #22b14c>kk</color>= Tri count, <color #00a2e8>ll</color>= vert count | | | 0x00000030 | [<color #22b14c>kk kk</color> <color #00a2e8>ll ll</color>] | <color #22b14c>kk</color>= Tri count, <color #00a2e8>ll</color>= vert count | | ||
| 0x00000034 | [00 00 00 00] | ? | | | 0x00000034 | [00 00 00 00] | ? | | ||
- | ''*Geo Types: 0000=normal, 0002= Trilinear MipMapping (RGBA16), 0004=Env mapping, 0006=?'' | + | ''*Geo Types: 0000=normal, 0002= Trilinear MipMapping (RGBA16), 0004=Env mapping, 0006=Trilinear MipMapping (RGBA16) + Environment Mapping'' |
---- | ---- | ||
===== Texture Setup ===== | ===== Texture Setup ===== | ||
- | ^ Offset from TexSetup Start ^ Value/Syntax ^ Description ^ | + | The Texture Setup begins with a Header of Size 0x08: |
- | | 0x00000000 | [<color #ff7f27>aa aa aa aa</color>] | Amount of data in bytes to load (including command) | | + | ^ Offset within TexSetup ^ Value/Syntax ^ Description ^ |
- | | 0x00000004 | [00 <color #22b14c>cc</color> 00 00] | cc=Texture Count | | + | | 0x00000000 | [<color #ff7f27>aa aa aa aa</color>] | Size of DataSection in Bytes | |
- | | 0x00000008 | [<color #A946F2>dd dd dd dd</color>] | Texture[i] segment address from texture data start | | + | | 0x00000004 | [<color #22b14c>cc cc</color>] 00 00 | Texture Count | |
- | | 0x0000000C | [00 <color #b5e61d>ee</color> 00 00 <color #00a2e8>xx</color> <color #ed1c24>yy</color> 00 00] | Texture[i] <color #b5e61d>ee</color> =type*, <color #00a2e8>xx</color> <color #ed1c24>yy</color>=Pixel Grid | | + | |
- | | 0x00000014 | [00 00 00 00] | Wasted data? | | + | |
- | ''*Types: 01=CI4, 02=CI8, 04=RGBA16, 08=RGBA32, 0x10=IA8,'' | + | Afterwards, an array of Meta-Information Elements follows (Tex MetaSection), where Texture parameters are stored.\\ |
+ | Each Meta Element is 0x10 Bytes large, and structured like this: | ||
- | <code>*External texture indices start at FileID 0x1EF6, 0 indexed. | + | ''[<color #A946F2>dd dd dd dd</color>] [<color #b5e61d>ee ee</color>] 00 00 [<color #00a2e8>ww</color>] [<color #ed1c24>hh</color>] 00 00 00 00'' |
+ | |||
+ | ^ Value/Syntax ^ Description ^ | ||
+ | | [<color #A946F2>dd dd dd dd</color>] | Offset of TexData from Tex DataSection Start | | ||
+ | | [<color #b5e61d>ee ee</color>] | Type* of corresponding TexData | | ||
+ | | [<color #00a2e8>ww</color>] [<color #ed1c24>hh</color>] | <color #00a2e8>Width</color> and <color #ed1c24>Height</color> of TexData | | ||
+ | |||
+ | * the types used in BK are the following: | ||
+ | ^ Value ^ TexType ^ Palette ^ Bits / Pixel ^ Color-Format ^ | ||
+ | | 0x01 | CI4 | 0x20 | 4 | RGBA5551 | | ||
+ | | 0x02 | CI8 | 0x200 | 8 | RGBA5551 | | ||
+ | | 0x04 | RGBA16 | - | 16 | RGBA5551 | | ||
+ | | 0x08 | RGBA32 | - | 32 | RGBA8888 | | ||
+ | | 0x10 | IA8 | - | 8 | I4A4 | | ||
+ | |||
+ | External texture indices start at FileID 0x1EF6, 0 indexed. | ||
+ | |||
+ | <code> | ||
Example: 00 00 06 00 00 01 00 00 40 40 00 00 00 00 00 00 | Example: 00 00 06 00 00 01 00 00 40 40 00 00 00 00 00 00 | ||
- | This will load a CI4 64x64 texture from segmented address 0x600.</code> | + | This sets up a 64x64 CI4 Texture from 0x600 Bytes after the DataSection starts.</code> |
+ | |||
+ | And finally, a List of the actual Data Elements follows (Tex DataSection).\\ | ||
+ | Note that there might be additional Data Elements inbetween, if the Texture is mipmapped or animated. | ||
---- | ---- | ||
Line 50: | Line 69: | ||
===== Vertex Store Setup ===== | ===== Vertex Store Setup ===== | ||
^ Offset from VTXSetup Start ^ Value/Syntax ^ Description ^ | ^ Offset from VTXSetup Start ^ Value/Syntax ^ Description ^ | ||
- | | 0x00000000 | [<color #ed1c24>aa aa</color> <color #22b14c>bb bb</color> <color #00a2e8>cc cc</color>] | Draw distance: Negative Coords | | + | | 0x00000000 | [<color #ed1c24>aa aa</color> <color #22b14c>bb bb</color> <color #00a2e8>cc cc</color>] | s16[3] Minimum Coords | |
- | | 0x00000006 | [<color #ed1c24>dd dd</color> <color #22b14c>ee ee</color> <color #00a2e8>ff ff</color>] | Draw distance: Positive Coords | | + | | 0x00000006 | [<color #ed1c24>dd dd</color> <color #22b14c>ee ee</color> <color #00a2e8>ff ff</color>] | s16[3] Maximum Coords | |
- | | 0x0000000C | [<color #ed1c24>gg gg</color> <color #22b14c>hh hh</color>] | Object Coordinate Range | | + | | 0x0000000C | [<color #ed1c24>gg gg</color> <color #22b14c>hh hh</color> <color #00a2e8>ii ii</color>] | s16[3] Center Coords | |
- | | 0x00000010 | [<color #ed1c24>jj jj</color>] | Collision range? (Enemies, Objects) | | + | | 0x00000012 | [<color #22b14c>kk kk</color>] | s16 Largest Distance to Center | |
- | | 0x00000014 | [<color #22b14c>kk kk</color>] | Collision range? (Banjo) | | + | | 0x00000014 | [<color #00a2e8>ll ll</color>] | u16 Vertex Count*2 | |
- | | 0x00000016 | [<color #00a2e8>ll ll</color>] | Vertex Count*2 | | + | | 0x00000016 | [<color #00a2e8>mm mm</color>] | s16 Largest Distance to Origin | |
- | Each 16 byte line of the Vertex Setup following the Start denotes where a vertex is stored in 3D space, from where in 2D space its UVs begin being mapped, and which color and opacity alpha values will be applied to these vertices. | + | Each 16 byte line of the Vertex Setup following the Start denotes where a vertex is stored in 3D space, from where in 2D space its UVs begin being mapped, and which color and opacity alpha values will be applied to these vertices. Pulled from [[https://hack64.net/wiki/doku.php?id=rcpstructs#rsp_geometry_mode:~:text=Edit-,Vertex%20Structure,-Vertices%20are%20points|RCP Structures]] for context. |
- | + | ||
- | It can be displayed like this: | + | |
- | 0x0: <color #A946F2>xx xx</color> <color #00a2e8>yy yy</color> <color #f50569>zz zz</color> 00 00 <color #d1b219>uu uu</color> <color #ff5703>vv vv</color> <color #ed1c24>rr</color> <color #22b14c>gg</color> <color #3644f7>bb</color> <color #8f8f8f>aa</color> | + | |
+ | It is stored like this: | ||
+ | ''[<color #A946F2>xx xx</color> <color #00a2e8>yy yy</color> <color #f50569>zz zz</color> 00 00 <color #d1b219>uu uu</color> <color #ff5703>vv vv</color> <color #ed1c24>rr</color> <color #22b14c>gg</color> <color #3644f7>bb</color> <color #8f8f8f>aa</color>]'' | ||
^ Vertex Structure After Start ^ Value/Syntax ^ Description ^ | ^ Vertex Structure After Start ^ Value/Syntax ^ Description ^ | ||
- | | 0x00000000 | [<color #A946F2>xx xx</color>] | *s32 Vertex Position on X Axis | | + | | 0x00000000 | [<color #A946F2>xx xx</color>] | *s16 Vertex Position on X Axis | |
- | | 0x00000002 | [<color #00a2e8>yy yy</color>] | s32 Vertex Position on Y Axis | | + | | 0x00000002 | [<color #00a2e8>yy yy</color>] | s16 Vertex Position on Y Axis | |
- | | 0x00000004 | [<color #f50569>zz zz</color>] | s32 Vertex Position on Z Axis | | + | | 0x00000004 | [<color #f50569>zz zz</color>] | s16 Vertex Position on Z Axis | |
| 0x00000006 | 00 00 | Padding(?) | | | 0x00000006 | 00 00 | Padding(?) | | ||
- | | 0x00000008 | [<color #d1b219>uu uu</color>] | s32 UV Coordinates: U Axis| | + | | 0x00000008 | [<color #d1b219>uu uu</color>] | s16 UV Coordinates: U Axis| |
- | | 0x0000000A | [<color #ff5703>vv vv</color>] | s32 UV Coordinates: V Axis| | + | | 0x0000000A | [<color #ff5703>vv vv</color>] | s16 UV Coordinates: V Axis| |
- | | 0x0000000C | [<color #ed1c24>rr</color>] | u16 Vertex Color Red Values | | + | | 0x0000000C | [<color #ed1c24>rr</color>] | u8 Vertex Color Red Values | |
- | | 0x0000000D | [<color #22b14c>gg</color>] | u16 Vertex Color Green Values | | + | | 0x0000000D | [<color #22b14c>gg</color>] | u8 Vertex Color Green Values | |
- | | 0x0000000E | [<color #3644f7>bb</color>] | u16 Vertex Color Blue Values | | + | | 0x0000000E | [<color #3644f7>bb</color>] | u8 Vertex Color Blue Values | |
- | | 0x0000000F | [<color #8f8f8f>aa</color>] | u16 Vertex Color Alpha Values | | + | | 0x0000000F | [<color #8f8f8f>aa</color>] | u8 Vertex Color Alpha Values | |
- | *Please note that ''s32'' refers to a value that is 'signed', or a value which may be positive or negative. Positive signed values range from 0000 to 7FFF, negative signed values range from FFFF to 8000. Whereas ''u16'' refers to a value that is unsigned and thus may only be a positive integer from, in this example, 00 to FF. | + | *Please note that ''s16'' refers to 'signed short'; a value which may be positive or negative and takes 16 bits of space. Positive signed values range from 0x0000 to 0x7FFF, negative signed values range from 0xFFFF to 0x8000. Whereas ''u8'' refers to an 'unsigned byte' value that may only be a positive integer from 0x00 to 0xFF. |
<code>Example: 0014 0062 FFE7 0000 FFE0 0014 9292 92FF</code> | <code>Example: 0014 0062 FFE7 0000 FFE0 0014 9292 92FF</code> | ||
- | A vertex will be drawn at position (20, 98, -25). UV mapping will begin at -20 coordinates in the U axis and 20 coordinates in the V axis. This vertex will feature a color of #929292 with full opacity alpha of FF. | + | A vertex will be drawn at position (20, 98, -25). UV mapping will begin at -20 coordinates in the U axis and 20 coordinates in the V axis. This vertex will feature a color of #929292 with full opacity alpha of 0xFF or 255. |
+ | |||
+ | ---- | ||
+ | ===== Collision Setup ===== | ||
+ | The Collision Setup begins with a Header of Size 0x18: | ||
+ | ^ Offset within CollSetup ^ Value/Syntax ^ Description ^ | ||
+ | | 0x00000000 | [''<color #A946F2>xx xx</color> <color #00a2e8>yy yy</color> <color #f50569>zz zz</color>''] | s16[3] Minimum GeoCube Index | | ||
+ | | 0x00000006 | [''<color #A946F2>xx xx</color> <color #00a2e8>yy yy</color> <color #f50569>zz zz</color>''] | s16[3] Maximum GeoCube Index | | ||
+ | | 0x0000000C | [''<color #d1b219>vv vv</color>''] | u16 Y Stride - GeoCubes per X-Row | | ||
+ | | 0x0000000E | [''<color #ff5703>ww ww</color>''] | u16 Z Stride - GeoCubes per XY-Layer | | ||
+ | | 0x00000010 | [''<color #00a2e8>cc cc</color>''] | u16 Total amount of GeoCubes | | ||
+ | | 0x00000012 | [''<color #22b14c>ss ss</color>''] | u16 GeoCube Scale | | ||
+ | | 0x00000014 | [''<color #ed1c24>tt tt</color>''] | u16 Total amount of Collision Tris | | ||
+ | | 0x00000016 | [''00 00''] | Padding | | ||
+ | |||
+ | The entire map is split up into 3D GeoCubes that all share the same scale ''0x<color #22b14c>SSSS</color>^3''. They are set up in a 3D matrix, such that the GeoCube (0,0,0) is stretching from the coordinates (0,0,0) to (0x<color #22b14c>SSSS</color>, 0x<color #22b14c>SSSS</color>, 0x<color #22b14c>SSSS</color>). In Memory, the GeoCubes are stored as a 1D array, where the Y and Z strides are used for the pointer arithmetic of referencing the correct cube: | ||
+ | |||
+ | <code> | ||
+ | cube_arr[cube_x][cube_y][cube_z] | ||
+ | == cube_arr[cube_x + (cube_y * stride_y) + (cube_z * stride_z)] | ||
+ | == cube_arr[cube_ID] | ||
+ | </code> | ||
+ | Following the Header, we have a list of 0x<color #00a2e8>CCCC</color> GeoCube instances of Size 0x08, looking like this: | ||
+ | |||
+ | ^ Value/Syntax ^ Description ^ | ||
+ | | [''<color #A946F2>aa aa</color>''] | u16 Starting Tri ID | | ||
+ | | [''<color #b5e61d>cc cc</color>''] | u16 Tri Count | | ||
+ | |||
+ | These are referring to a Subset ''[start : (start + count))'' of Collision Tris from the then following Collision Tri list. This list contains 0x<color #ed1c24>TTTT</color> Collision Triangles, of Size 0x0C, which are structured like this in BK: | ||
+ | |||
+ | ^ Value/Syntax ^ Description ^ | ||
+ | | [''<color #A946F2>aa aa</color>''] | u16 Vertex ID 1 | | ||
+ | | [''<color #00a2e8>bb bb</color>''] | u16 Vertex ID 2 | | ||
+ | | [''<color #f50569>cc cc</color>''] | u16 Vertex ID 3 | | ||
+ | | [''<color #808080>uu uu</color>''] | <color #808080>unknown</color> | | ||
+ | | [''<color #b5e61d>ii ii ii ii</color>''] | u32 Sound + Collision Flags | | ||
+ | |||
+ | Where every Triangle is defined by the 3 indices as 1-2-3, which is important to determine its front facing direction. | ||
---- | ---- | ||
Line 103: | Line 158: | ||
| 6 | 0x258 | ?? | | | 6 | 0x258 | ?? | | ||
| 7 | 0x2BC | Rippling wave generation, amplitude controlled by bounding box of affected vertices, speed of wave dictated by param. | | | 7 | 0x2BC | Rippling wave generation, amplitude controlled by bounding box of affected vertices, speed of wave dictated by param. | | ||
- | | 8 | 0x320 | ?? | | + | | 8 | 0x320 | Vertex alpha regularly gets brighter and dimmer. Param dictates speed of glow. | |
| 9 | 0x384 | Adds lightning sound effect, no visible change. Param does not seem to affect sound speed. Could be alpha related. | | | 9 | 0x384 | Adds lightning sound effect, no visible change. Param does not seem to affect sound speed. Could be alpha related. | | ||
Line 109: | Line 164: | ||
Example (GV Model A): | Example (GV Model A): | ||
<code>0003 0078 006A 0010 0011 0012 0013 0014 ... 0605 00AA 0015 06AC ... 06C0 0190 0007 0182 ... 018A 0000 0000 0000</code> | <code>0003 0078 006A 0010 0011 0012 0013 0014 ... 0605 00AA 0015 06AC ... 06C0 0190 0007 0182 ... 018A 0000 0000 0000</code> | ||
- | Loads 3 effects, the first being 78 (Medium Scroll) with the full vertex count of the effect being 106 (6A) vertices. Verts in the bin that scroll range from vertex lines 16 (0010) to 122 (0605). The second effect in the bin is effect 00AA (fast scroll) with a 21 (15) vertex count ranging from vertex lines 1708 (06AC) to 1729 (06C0). The third effect in the bin is effect 0190 (??) with a 7 vertex count ranging from vertices 386 (0182) to 393 (018A). There is a 4 or 6 byte padding buffer at the end of most effects setups. | + | Loads 3 effects, the first being 78 (Medium Scroll) with the full vertex count of the effect being 106 (6A) vertices. Verts in the bin that scroll range from vertex lines 16 (0010) to 122 (0605). The second effect in the bin is effect 00AA (fast scroll) with a 21 (15) vertex count ranging from vertex lines 1708 (06AC) to 1729 (06C0). The third effect in the bin is effect 0190 (Move Star Door) with a 7 vertex count ranging from vertices 386 (0182) to 393 (018A). There is a 4 or 6 byte padding buffer at the end of most effects setups. |
---- | ---- | ||
Line 120: | Line 175: | ||
Note only the 1st texture in the model can be animated, however it can be animated with 4 different framecounts/framerates. | Note only the 1st texture in the model can be animated, however it can be animated with 4 different framecounts/framerates. | ||
- | --- | + | ---- |
+ | |||
+ | ===== GeoLayout Setup ===== | ||
+ | This Setup consists of a List of [[https://hack64.net/wiki/doku.php?id=banjo_kazooie:geometry_layouts|GeoLayout Commands]]. There is no Header in this Setup. | ||
+ | |||
+ | The Reference-Point Command (''0x0A'') appears to be used to determine what Banjo should look at when solving a Jigsaw. The Reference-Point Index is set to ''0x1E'' in that case, and the Bone-Index is always ''0xFFFF'' (-1) connecting the Point to the origin. Therefor the XYZ Coordinates that are included in the Command represents the actual Position of the Reference-Point within the Map. If a second Jigsaw is in the same Room, it gets the Index ''0x1F'' instead, which is the case for the CC and RBB Jigsaws. | ||
+ | ---- | ||