User Tools

Site Tools


banjo_kazooie:model_data

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
banjo_kazooie:model_data [2024/02/19 00:09]
ThatCowGuy [Vertex Store Setup]
banjo_kazooie:model_data [2024/05/02 22:33] (current)
BanjoFreak64 [Header]
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 00cc=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=CI402=CI8, 04=RGBA16, 08=RGBA32, 0x10=IA8,''​+Afterwardsan array of Meta-Information Elements follows (Tex MetaSection)where Texture parameters are stored.\\ 
 +Each Meta Element is 0x10 Bytes largeand 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 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 57: Line 76:
 | 0x00000016 | [<color #​00a2e8>​mm mm</​color>​] | s16 Largest Distance to Origin | | 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 is stored like this:  It is stored like this: 
Line 79: Line 98:
  
 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. 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 102: 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 119: 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]]. 
 +----
  
banjo_kazooie/model_data.1708301367.txt.gz · Last modified: 2024/02/19 00:09 by ThatCowGuy