An .mtl file is a material library: plain text in the same style as OBJ,
with one statement to a line and # for comments. A model names its
libraries with mtllib and picks a material with usemtl.
Texture maps are on the MTL texture maps page.
newmtl Painted_Steel
Ka 0.1 0.1 0.1
Kd 0.8 0.1 0.1
Ks 0.5 0.5 0.5
Ns 96
Ni 1.45
d 1
illum 2
map_Kd steel_diffuse.png
newmtl – A material
newmtl name starts a material. Every statement until the next
newmtl describes it. Writers keep names free of spaces, and a model’s
usemtl must repeat the name exactly; this site’s explorer takes
everything after newmtl as the name, spaces included.
Colours
| Statement | Meaning |
|---|---|
Ka | The ambient colour. |
Kd | The diffuse colour. |
Ks | The specular colour. |
Tf | The transmission filter: which colours pass through a transparent surface. |
Ke | The emissive colour. It is not in the original specification; the physically based extension, which many programs use, adds it. |
Each takes one of three forms. Do not mix them in one statement.
| Form | Meaning |
|---|---|
Kd r [g b] | RGB, usually from 0 to 1. If only r is given, g and b equal it. |
Kd spectral file.rfl [factor] | A spectral curve in an .rfl file, multiplied by factor, 1.0 by default. |
Kd xyz x [y z] | CIEXYZ values, usually from 0 to 1. If only x is given, y and z equal it. |
illum – Illumination model
illum number picks one of eleven models.
| Model | Meaning |
|---|---|
| 0 | Colour on, ambient off |
| 1 | Colour on, ambient on |
| 2 | Highlight on |
| 3 | Reflection on, ray trace on |
| 4 | Transparency: glass on; reflection: ray trace on |
| 5 | Reflection: Fresnel on, ray trace on |
| 6 | Transparency: refraction on; reflection: Fresnel off, ray trace on |
| 7 | Transparency: refraction on; reflection: Fresnel on, ray trace on |
| 8 | Reflection on, ray trace off |
| 9 | Transparency: glass on; reflection: ray trace off |
| 10 | Casts shadows onto invisible surfaces |
A material needs model 3 or above for reflection maps to appear.
The equations of the models
The specification (Paul Bourke’s copy of the Advanced Visualizer manual, chapter 5, read on 2026-11-18) gives each model as a colour equation. The terms: Ia ambient light, Ij the intensity of light j, Ir the intensity from the reflected direction (reflection map and ray tracing), It the intensity from the transmitted direction, Ka, Kd and Ks the reflectances, Tf the transmission filter, and the unit vectors N (normal), L (light), V (view) and H (the bisector of L and V). A sum runs over the lights.
| Model | Colour |
|---|---|
| 0 | Kd (constant colour) |
| 1 | Ka·Ia + Kd · Σ (N·Lj) Ij (Lambertian) |
| 2 | Ka·Ia + Kd · Σ (N·Lj) Ij + Ks · Σ ((H·Hj)^Ns) Ij (Blinn’s form of Phong highlights) |
| 3 | As model 2, plus Ks · Ir, where Ir is the reflection map plus ray tracing (a reflection term as in Whitted’s model) |
| 4 | The same equation as model 3, for glass: the dissolve is adjusted by the larger of the average highlight and reflected-light intensities, so that a very low dissolve (about 0.1) still shows highlights and reflections |
| 5 | As model 3, with Fresnel reflection in the highlight and reflection terms: Fr(Lj·Hj, Ks, Ns) Ij and Fr(N·V, Ks, Ns) Ir; at grazing angles Ks approaches 1.0 |
| 6 | As model 3, plus (1.0 − Ks) · Tf · It: light refracts through the surface (by the optical density Ni), the share being 1 − Ks, filtered by Tf |
| 7 | As model 5, plus a Fresnel transmission term (1.0 − Kx) · Ft(N·V, 1.0 − Ks, Ns) · Tf · It (the specification prints “Kx”, which is not defined there) |
| 8 | As model 3 with Ir from the reflection map only, no ray tracing |
| 9 | As model 4 with Ir from the reflection map only, no ray tracing |
| 10 | Shadow matte: the colour is black and the matte channel is M = 1 − W / P, where P = S1 + S2 + … is the sum of each light’s summed brightness S, and W = S1·Q1 + S2·Q2 + … weights each by its visibility factor Q (0 blocked by shadow objects, 1 not blocked; between for partly dissolved blockers). S is the sum of the light’s spectral samples, three by default. |
The explorer lists the model by name and does not apply these equations.
d and Tr – Transparency
d factor is the dissolve. 1.0, the default, is fully opaque; 0.0 is fully
clear. It applies to every illumination model.
d -halo factor makes the dissolve depend on the angle between the
surface and the viewer: it is factor where the surface faces the viewer
and rises to 1.0 at its edges, as 1.0 − (N·v) × (1.0 − factor). A sphere with
d -halo 0.0 is fully clear at its centre and grows more opaque towards
its rim.
Tr is written by some programs instead of d, with the
meaning inverted: 0 is opaque and 1 is clear, so Tr = 1 − d.
It is not in the original specification.
Ns, Ni and sharpness
| Statement | Meaning |
|---|---|
Ns exponent | The specular exponent, usually from 0 to 1000. Higher values give a tighter highlight. |
Ni density | The optical density, or index of refraction, from 0.001 to 10. 1.0 means light does not bend. Glass is about 1.5. Values below 1.0 are not recommended. |
sharpness value | How sharp reflections are, 0 to 1000, 60 by default. Values above 100 can cause aliasing on flat surfaces seen at sharp angles. |
Physically based extension
These statements are not part of the original format. They were proposed by the creators of Clara.io to add physically based rendering, and have been adopted by Blender and tinyobjloader, among others. They take one number.
| Statement | Meaning |
|---|---|
Pr | Roughness |
Pm | Metallic |
Ps | Sheen |
Pc | Clearcoat thickness |
Pcr | Clearcoat roughness |
aniso | Anisotropy |
anisor | Anisotropy rotation |
The extension’s texture maps, and the normal map norm, are on the
MTL texture maps page.
In the explorer
An .mtl opened on its own shows a tree of its materials and statements,
a table of the materials with their Kd, Ns, d,
illumination model and number of maps, and a palette of the diffuse colours. Every
statement of this page, including Tr, sharpness, the
spectral and xyz colour forms and the physically based
statements, is read and range-checked (illum 0 to 10, d and
Tr 0 to 1, Ni and Ns not negative).
The pictures of a model use a library only when the model is opened from a folder that
holds it, as the overview says: Kd
(or xyz, converted to RGB), d or Tr and
map_Kd are drawn. If the library the model names is not there but one
with the model’s own name and the extension .mtl is, that one is used and
the materials table says so.
Not described
What this page leaves out, and what the explorer does not do.
Known, not yet covered
- Reference: how the physically based statements combine with
KdandKs: the Clara.io proposal and the Blender and tinyobjloader code show it, and it is not written up. Which programs writeTris not checked. - Viewer: only
Kd(or itsxyzform),d,Trandmap_Kdchange the pictures.Ka,Ks,Ke,Tf,Ns,Ni,sharpness,illumand the physically based values are read, range-checked and listed, and not applied.
Unknown
- Reference and viewer: the spectral reflectance file (
.rfl) thatspectralnames: no public layout was found. The colour is checked and not converted. - Reference and viewer: real physically based files: none was available, so these statements are tested on built files only.