The Gearbox model tag contains the render models (LODs) and shader_model references for objects such as vehicles, scenery, and weapons among others. It is not collideable nor animated on its own, and objects may reference additional model_collision_geometry and model_animations tags.
Don't confuse this tag with the Xbox-only model, which Gearbox modified for the PC port. It is therefore used in all derivatives of that port, like Mac, Demo, and MCC. Unlike the Xbox version, the Gearbox model uses uncompressed vertices.
Shaders
Each "part" of a model can reference a different shader, like the Warthog's windscreen using a shader_transparent_glass while its body uses a shader_model. While a model can technically reference any kind of shader, referencing a shader_environment (used for BSPs) is not recommended because it renders incorrectly in Custom Edition.
Markers
...
Regions
Regions render in the order they are stored in the tag. When naming regions, consider that they will be sorted by name when compiled into the .gbxmodel
. This can be important for skyboxes and objects with multiple layers of alpha-blended transparent shaders which aren't z-culled and need a correct sorting order to be explicitly defined, assuming the object is viewed mostly from one direction.
Permutations
...
Structure and fields
Field |
Type |
Comments |
flags |
bitfield(32) |
|
Flag | Mask | Comments | blend shared normals | 0x1 | | parts have local nodes | 0x2 | | ignore skinning | 0x4 | | |
node list checksum |
i32 |
|
super high detail cutoff |
f32 (pixels) |
|
high detail cutoff |
f32 (pixels) |
|
medium detail cutoff |
f32 (pixels) |
|
low detail cutoff |
f32 (pixels) |
|
super low detail cutoff |
f32 (pixels) |
|
super low detail node count |
u16 (nodes) |
|
low detail node count |
u16 (nodes) |
|
medium detail node count |
u16 (nodes) |
|
high detail node count |
u16 (nodes) |
|
super high detail node count |
u16 (nodes) |
|
|
pad(2) |
|
|
pad(8) |
|
base map u scale |
f32 |
|
base map v scale |
f32 |
|
|
pad(116) |
|
markers |
Block? |
- Internal to the tag and may be hidden in tools.
|
Field | Type | Comments | name | char[32] | | magic identifier | i16 | | | pad(2) | | | pad(16) | | instances | Block? | | Field | Type | Comments | region index | u8 | | permutation index | u8 | | node index | u8 | | | pad(1) | | translation | Point3D (3) | | rotation | Quaternion (4) - i:
f32 - j:
f32 - k:
f32 - w:
f32 | | | |
nodes |
Block? |
|
Field | Type | Comments | name | char[32] | | next sibling node index | Index (nodes) | | first child node index | Index (nodes) | | parent node index | Index (nodes) | | | pad(2) | | default translation | Point3D (3) | | default rotation | Quaternion (4) - i:
f32 - j:
f32 - k:
f32 - w:
f32 | | node distance from parent | f32 | | | pad(32) | | scale | f32 (little endian?) | - Only set when the tag is compiled into a map cache.
| rotation | Matrix3x3 (little endian?) : elements (9): f32
| - Only set when the tag is compiled into a map cache.
| translation | Point3D (little endian?) (3) | - Only set when the tag is compiled into a map cache.
| |
regions |
Block? |
|
Field | Type | Comments | name | char[32] | | | pad(32) | | permutations | Block? | | Field | Type | Comments | name | char[32] | | flags | bitfield(32) | | Flag | Mask | Comments | cannot be chosen randomly | 0x1 | | | permutation number | u16 (Index endian?) | - Only set when the tag is compiled into a map cache.
| | pad(2) | | | pad(24) | | super low | Index (geometries) | | low | Index (geometries) | | medium | Index (geometries) | | high | Index (geometries) | | super high | Index (geometries) | | | pad(2) | | markers | Block? | | Field | Type | Comments | name | char[32] | | node index | Index (nodes) | | | pad(2) | | rotation | Quaternion (4) - i:
f32 - j:
f32 - k:
f32 - w:
f32 | | translation | Point3D (3) | | | pad(16) | | | | |
geometries |
Block? |
|
Field | Type | Comments | flags | bitfield(32) | | Flag | Mask | Comments | unused | 0x1 | | | | pad(32) | | parts | Block? | | Field | Type | Comments | flags | bitfield(32) | | Flag | Mask | Comments | stripped internal | 0x1 | | zoner | 0x2 | | | shader index | Index (shaders) | | prev filthy part index | u8 | - Only set when the tag is compiled into a map cache.
| next filthy part index | u8 | - Only set when the tag is compiled into a map cache.
| centroid primary node | Index: u16 | - Only set when the tag is compiled into a map cache.
| centroid secondary node | Index: u16 | - Only set when the tag is compiled into a map cache.
| centroid primary weight | Fraction: f32 | - Only set when the tag is compiled into a map cache.
| centroid secondary weight | Fraction: f32 | - Only set when the tag is compiled into a map cache.
| centroid | Point3D (3) | | uncompressed vertices | Block? | - Not included when the tag is compiled into a map cache.
| Field | Type | Comments | position | Point3D (3) | | normal | Vector3D (3) | | binormal | Vector3D (3) | | tangent | Vector3D (3) | | texture coords | Point2D (2) | | node0 index | Index (nodes) | | node1 index | Index (nodes) | | node0 weight | f32 | | node1 weight | f32 | | | compressed vertices | Block? | - Not included when the tag is compiled into a map cache.
| Field | Type | Comments | position | Point3D (3) | | normal | u32 | | binormal | u32 | | tangent | u32 | | texture coordinate u | i16 | | texture coordinate v | i16 | | node0 index | i8 | | node1 index | i8 | | node0 weight | u16 | | | triangles | Block? | - Not included when the tag is compiled into a map cache.
| Field | Type | Comments | vertex0 index | Index (uncompressed vertices) | | vertex1 index | Index (uncompressed vertices) | | vertex2 index | Index (uncompressed vertices) | | | do not crash the game | u32 (little endian?) | - Only set when the tag is compiled into a map cache.
| triangle count | u32 (little endian?) | - Only set when the tag is compiled into a map cache.
| triangle offset | u32 (little endian?) | - Only set when the tag is compiled into a map cache.
| triangle offset 2 | u32 (little endian?) | - Only set when the tag is compiled into a map cache.
| do not screw up the model | u32 (little endian?) | - Only set when the tag is compiled into a map cache.
| vertex count | u32 (little endian?) | - Only set when the tag is compiled into a map cache.
| | pad(4) | | bullshit | u32 (little endian?) | - Only set when the tag is compiled into a map cache.
| vertex offset | u32 | | | pad(1) | | | pad(1) | | | pad(1) | | num nodes | u8 | | local node indices | u8 x24 | | | |
shaders |
Block? |
|
Field | Type | Comments | shader | Reference? : shader
| | permutation | Index: u16 | | | pad(2) | | | pad(12) | | |
This information was partially generated using Invader tag definitions.
Acknowledgements
Thanks to the following individuals for their research or contributions to this topic:
- Fubih (Regions render order tip)
- Kavawuvi (Invader tag definitions)
- MosesOfEgypt (Tag structure research)