Skip to main content

Module materials

Module materials 

Source
Expand description

Material system for RigidModel files.

§Overview

Materials define how meshes are rendered in Total War games. Each material type has specific properties that control textures, shaders, vertex formats, and rendering behavior. The material system supports 40+ different material types for various rendering scenarios.

§Material Types

Materials are categorized by their rendering purpose:

§Standard Rendering

  • DefaultMaterial (68): Full-featured material for most meshes
  • Decal (71): Applied decals on surfaces
  • Tree (74), TreeLeaf (75): Vegetation rendering
  • Grass (69): Grass
  • Water (83): Water surfaces
  • Unlit (84): No lighting calculations

§Skeletal Animation (Weighted)

  • WeightedSkin (70): Character skin with bone weights
  • WeightedCloth (58), Cloth (60): Cloth simulation
  • Weighted (65): Generic weighted material

§Terrain

  • RsTerrain (66): Terrain block of the tiles’ meshes (and, up to version 6, WeightedTextureBlend (96) and ProjectedDecalV4 (97))
  • CustomTerrain (49), GlobalTerrain (98): Terrain variants
  • WeightedTextureBlend (96), TerrainBlend (86): Texture blending
  • TiledDirtmap (63): Tiled dirt textures

§Special Effects

  • Collision (61), CollisionShape (62): Collision meshes (invisible)
  • DebugGeometry (46): Debug visualization
  • PointLight (38), StaticPointLight (45): Light sources
  • Rope (93): Rope rendering

§Projected Decals

  • ProjectedDecal (67), ProjectedDecalV2 (87), ProjectedDecalV3 (95), ProjectedDecalV4 (97, from version 7)

§Material Data Structure

Materials contain:

  • Vertex format: Determines vertex data layout
  • Textures: Diffuse, normal, specular, masks, etc.
  • Transformation matrices: 3x4 matrices for positioning/attachment
  • Attachment points: Named locations for effects/weapons
  • Shader parameters: Strings, floats, integers, vectors
  • Cloth-specific data: Physics simulation parameters (cloth materials only)

§Texture Types

Materials reference textures by type:

  • Diffuse (0): Base color texture
  • Normal (1): Normal mapping for surface detail
  • Specular (11), GlossMap (12): Reflectivity
  • Mask (3): Alpha/transparency mask
  • AmbientOcclusion (5): Baked ambient lighting
  • Decal variants: Special decal textures

§Implementation Details

Different material types have different data structures:

  • Default materials: Full data (textures, params, attachment points)
  • RsTerrain: Minimal (name + 5 unknown u32 fields)
  • WeightedTextureBlend: Name + 6 unknown u32 fields
  • AlphaBlend: Name only
  • Cloth: Default data + cloth simulation sections (cloth_links, cloth_triangle_counts, cloth_triangles)

See individual material variant modules for format-specific details.

Structs§

AttachmentPointEntry
Named attachment point for visual effects, weapons, or equipment.
ClothBone
A bone of the cloth simulation of a weighted cloth material, attached to a vertex of its mesh.
ClothLink
A distance constraint of a cloth simulation between two of its particles.
ClothTriangle
A triangle of a cloth simulation, by the indices of its three particles.
ClothTriangleCount
The number of triangles of a cloth simulation touching one of its particles.
Material
Complete material definition with textures, transforms, and shader parameters.
Rope
Texture reference with type and file path. The simulation data of a rope material: a chain of nodes joined by links.
RopeLink
A link between two nodes of a rope.
RopeNode
A node of a rope.
Texture

Enums§

MaterialType
Material type identifier determining rendering behavior and data structure.
TextureType
Texture type identifier for shader texture slots.