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 Both sides next revision
banjo_kazooie:model_data [2024/02/27 04:22]
BanjoFreak64 [Effects Setup]
banjo_kazooie:model_data [2024/03/01 16:45]
ThatCowGuy Adding Collision Segment as documented in Decomp and tested
Line 98: 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.
  
 ---- ----
banjo_kazooie/model_data.txt · Last modified: 2024/05/02 22:33 by BanjoFreak64