Skip to content

MATERIAL

Jocelyn Beedie edited this page Oct 3, 2021 · 5 revisions

MATERIAL files

The MATERIAL files contain information about materials. Generally, they apply information such as textures and reflection information to MESH files.

Format

struct Material {
    // Color multiplication between 0.0 and 1.0
    float color[4];
    // RBG emission color (additive). Each component is between 0.0 and 1.0. 
    float emission[3];
    // Not sure, but it might be used for reflections maps.
    // If `reflection_texture_id` is 0, then this is junk. I think it's a reflection multiplier?
    float reflection_unknown;
    // 3x3 matrix transform
    float transform[9];
    // Rotation represented by `transform`
    float rotation;
    // Offset represented by `transform`
    Vector2 offset;
    // Scale represented by `transform`
    Vector2 scale;
    // Some kind of flag  info. Unsure what it does
    uint32_t flags_unk;
    // how to render the material.
    uint32_t flags_render;
    // almost always 0, only 1 in certain circumstances.
    uint32_t unk1;
    // unsure, but it seems to indicate the origin of the material.
    // I think 0 means that the material is specific to this archive, while 1 is imported from Totem's material library.
    uint8_t unk2;
    // The id of the BITMAP file for the texture. May be 0 to represent no texture.
    int32_t texture_id;
    // The id of the BITMAP file for the reflection texture. May be 0 to represent no texture.
    int32_t reflection_texture_id;
};

Render flags

Bit 0: if set, material is not rendered.
Bit 3: Blend based on color of texture.
Bit 5: Blend based on alpha of texture.

Rest of bits are unknown.

Clone this wiki locally