Docs/Format/Materials & Textures

Materials

Materials use a PBR metallic-roughness model compatible with glTF 2.0.

<materials>
  <material id="brick" roughness="0.8" metallic="0.0"
            alpha_mode="opaque" double_sided="false">
    <base_color>0.8 0.2 0.1 1.0</base_color>
    <base_color_texture>brick_wall</base_color_texture>
    <emissive_color>0 0 0</emissive_color>
    <normal_texture>brick_normal</normal_texture>
  </material>
</materials>

Material Attributes

AttributeTypeDefaultDescription
idIDUnique material identifier. Referenced by object material attributes.
roughnessfloat 0–10.5PBR roughness factor
metallicfloat 0–10.0PBR metallic factor
normal_scalefloat1.0Normal map intensity multiplier
occlusion_strengthfloat 0–11.0AO strength
alpha_modeopaque|mask|blendopaqueTransparency mode
alpha_cutofffloat 0–10.5Alpha threshold for mask mode
double_sidedbooleanfalseDisable back-face culling

Child Elements

ElementContent typeDescription
<base_color>RGB or RGBA vecBase color tint. Alpha defaults to 1.0 when 3 components given.
<emissive_color>RGB vec3Emissive light emission.
<base_color_texture>texture IDREFAlbedo / diffuse map.
<metallic_roughness_texture>texture IDREFORM map: R=occlusion, G=roughness, B=metallic.
<normal_texture>texture IDREFTangent-space normal map.
<occlusion_texture>texture IDREFAmbient occlusion map.
<emissive_texture>texture IDREFEmissive map.

Textures

<textures>
  <texture id="brick_wall"
           uri="textures/brick.png"
           wrap_u="repeat"
           wrap_v="repeat"
           filter="linear"
           color_space="srgb"
           mip_maps="true"/>
</textures>
AttributeValuesDefault
idID
uripath (relative to .mc3.xml)
wrap_urepeat|clamp|mirrorrepeat
wrap_vrepeat|clamp|mirrorrepeat
filterlinear|nearestlinear
color_spacesrgb|linearsrgb
mip_mapsbooleantrue

UV Mapping (<uv_mapping>)

Optional child element on leaf object types. Controls texture coordinate scale/offset/rotation.

<uv_mapping scale="2.5 1.5" offset="0 0" rotation="0"/>
📋

UV mapping is parsed from XML but not yet fully wired into the editor UI or the glTF exporter tessellation pass. Marked as TODO in Mc3Object.hpp.

C++ Representation

struct Mc3Material {
    string name;
    array<float,4> baseColor{0.8f, 0.8f, 0.8f, 1.0f}; // RGBA
    string baseColorTexture;          // texture id
    string normalTexture;
    string emissiveTexture;
    string metallicRoughnessTexture;
    string occlusionTexture;
    float roughness{0.5f};
    float metallic{0.0f};
    float normalScale{1.0f};
    float occlusionStrength{1.0f};
    array<float,3> emissiveColor{0,0,0};
    string alphaMode{"opaque"};
    float alphaCutoff{0.5f};
    bool doubleSided{false};
};