Skip to content

Quad Info Struct

skzk edited this page Mar 19, 2025 · 15 revisions

The quad_info struct defines the properties of terrain quads generated by various items.

Structure

Field(s) Description
u16 material_count

for each: token material
u16 material_rot

The list of materials applied on this terrain. The first entry is the main material.

material_rot is the UV rotation of the material texture.

u16 color_count
u32 color (repeated)
The list of colors applied to this terrain, as RGBA. By default, this list only contains white.
u16 size_x
u16 size_y

The amount of terrain quad rows and columns.

The grid size of a terrain is determined by the item's length and settings and can't be set freely. The game will complain about it if you do. They are calculated as follows:

Rows

The game has a hardcoded sequence for row sizes:

1, 1, 1, 2, 6, 6, 10, 10, 10, 20, 40, 50, 50, 50, 100.

With a terrain size of 10, for example, you get 5 rows: 1 + 1 + 1 + 2 + 6.

Columns

TODO: Complete this section

u32 storage_size Total amount of terrain quads (the above two values multiplied).
u32 data (repeated) Now we get into the actual quad data; one uint per quad.

Data is stored as nibbles.

Nibble 0:
Main material. The value is an index of the material list above.

Nibble 1:
Blend material. Will be blended on top of the main material. Also an index of the material list.

Nibble 2:
Blend opacity.

Nibble 3:
Bottom left color.

Nibble 4:
Bottom right color.

Nibble 5:
Top left color.

Nibble 6:
Top right color.

Nibble 7:
Vegetation type override. This nibble is split once again into two values:
Bit 0: No detail vegetation (bool)
Bit 1-3: Vegetation type.
Normal = 0; No vegetation = 1; Low poly vegetation = 2; High poly vegetation = 3.


u32 offset_count Amount of terrain vertex offsets.
The following three fields are repeated for each offset:
u16 offset_pos_x
u16 offset_pos_y
Coordinates of the quad corner in the grid.
float3 data The overridden position of the quad, relative to the position of the backward node.
End of repeated section

u32 normal_count Not sure what these normals do exactly, but the structure is the same as above.
The following three fields are repeated for each normal:
u16 offset_pos_x
u16 offset_pos_y
Coordinates of the quad corner in the grid.
float3 data The overridden normal.
End of repeated section
Clone this wiki locally