Materials & Textures
PBR material system and texture library for MC3 scenes.
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
| Attribute | Type | Default | Description |
|---|---|---|---|
id | ID | — | Unique material identifier. Referenced by object material attributes. |
roughness | float 0–1 | 0.5 | PBR roughness factor |
metallic | float 0–1 | 0.0 | PBR metallic factor |
normal_scale | float | 1.0 | Normal map intensity multiplier |
occlusion_strength | float 0–1 | 1.0 | AO strength |
alpha_mode | opaque|mask|blend | opaque | Transparency mode |
alpha_cutoff | float 0–1 | 0.5 | Alpha threshold for mask mode |
double_sided | boolean | false | Disable back-face culling |
Child Elements
| Element | Content type | Description |
|---|---|---|
<base_color> | RGB or RGBA vec | Base color tint. Alpha defaults to 1.0 when 3 components given. |
<emissive_color> | RGB vec3 | Emissive light emission. |
<base_color_texture> | texture IDREF | Albedo / diffuse map. |
<metallic_roughness_texture> | texture IDREF | ORM map: R=occlusion, G=roughness, B=metallic. |
<normal_texture> | texture IDREF | Tangent-space normal map. |
<occlusion_texture> | texture IDREF | Ambient occlusion map. |
<emissive_texture> | texture IDREF | Emissive 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>
| Attribute | Values | Default |
|---|---|---|
id | ID | — |
uri | path (relative to .mc3.xml) | — |
wrap_u | repeat|clamp|mirror | repeat |
wrap_v | repeat|clamp|mirror | repeat |
filter | linear|nearest | linear |
color_space | srgb|linear | srgb |
mip_maps | boolean | true |
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};
};