What is an MTL file?
An MTL file is the material library of an OBJ model: a small text file that gives each material its colours, shininess, transparency and texture images. It holds no geometry, so it cannot be opened on its own. To see the model in colour, drop the .obj, the .mtl and the images together on the OBJ viewer: it opens in your browser and nothing is uploaded.
| File extension | .mtl |
|---|---|
| Type | Material library for OBJ models (text) |
| Developed by | Wavefront Technologies |
| Encoding | ASCII text |
| Colour / materials | Yes – it is the colour and texture description of an OBJ |
| MIME type | — |
| Opens in 3dfiles | Not on its own – drop it together with its .obj on the OBJ viewer |
| Limits in 3dfiles | The .mtl is found by the file name on the OBJ's mtllib line, and the texture images by the file names in the .mtl; folders in those paths are ignored. Only one file name per mtllib line is matched. Dropped alone, an .mtl is reported as not being a 3D file. |
How to open an MTL file with its OBJ
- Put the .obj, the .mtl and the texture images in one drop: select all of them, or ZIP the folder, and drop that on the OBJ viewer.
- Check the name: the viewer looks for the .mtl whose file name is written after
mtllibin the .obj. If the .mtl was renamed, open the .obj in a text editor and correct that line. - To read or edit the materials themselves, open the .mtl in any text editor.
- To end up with one file that keeps its materials, convert the set to GLB, which embeds the textures. In Blender the import is File → Import → Wavefront (.obj).
What happens to materials when you convert here
- OBJ to GLB: colours and the textures that were dropped with the model are embedded in the one file. Textures that were not dropped are left out.
- A coloured or textured model to OBJ: the download is a ZIP with the .obj, a new .mtl and the textures as PNG files. A model with a single plain colour is saved as a lone .obj.
- OBJ to STL, PLY, 3MF or STEP: the textures are dropped, because these outputs cannot store them.
About the MTL format
OBJ files describe shape only. The Wavefront material library format, in the words of its specification, contains one or more material definitions, stored in ASCII format with the .mtl extension. The OBJ names its library with a mtllib line and switches between materials with usemtl lines; when no material is given, the specification says, a white material is used.
That split is why OBJ models so often arrive grey: the .obj was sent without its .mtl, or the .mtl without the images it names. All three kinds of file have to travel together, ideally in one folder or one ZIP.
What an MTL file looks like inside
MTL
newmtl oak
Ka 0.2 0.2 0.2
Kd 0.8 0.6 0.4
Ks 0.1 0.1 0.1
Ns 20
d 1.0
illum 2
map_Kd oak_diffuse.jpgnewmtl starts a material and names it. Ka, Kd and Ks are the ambient, diffuse and specular reflectivity as RGB values; Ns is the specular exponent; d is the dissolve, where 1.0 is fully opaque; illum picks one of the illumination models numbered 0 to 10; map_Kd names the image used as the colour texture.
Common problems
The model is still grey
Either the .mtl or the images were not in the drop, or the .obj names a different .mtl than the one you have. An OBJ that lists several file names on one mtllib line is not matched here either: leave one name on the line.
Textures show in one program but not in another
Many exporters write absolute paths such as C:\Users\…\wood.jpg into the .mtl. This viewer ignores the folder and matches the file name; other programs follow the path literally, so edit the map_Kd lines to plain file names.
Questions about MTL files
Do I need the MTL file?
Only for colour. The shape is entirely in the .obj, so for 3D printing or measuring the .mtl can be ignored. For rendering, AR or a product view you need it and its images.
Can I open an MTL file by itself?
As text, yes: any text editor shows it. As a 3D view, no, because it has no geometry. Dropped alone on the viewer it is reported as not being a 3D file.
Can I convert an MTL file to something else?
Not alone. Converted together with its .obj to GLB, the materials and textures are packed into the one file.
What do Ka, Kd and Ks mean?
The ambient, diffuse and specular reflectivity of the material, each given as RGB values. Kd is the one you see as the base colour.