MTL Files
Material Definitions for OBJ Files


MTL is a data directory which contains examples of MTL files. An MTL file is an auxilliary file containing definitions of materials that may be accessed by an OBJ file. The OBJ file must specify the name of the MTL file by a command such as

        mltlib file_name
      
It is presumed that the MTL file names and defines various materials, such as, perhaps, "shinyred" or "iron". Then, within the OBJ file, the command
        usemtl shinyred
      
indicates that all subsequence faces should be rendered with this material, until a new material is invoked.

An MTL file contains a sequence of definitions of materials. Each definition begins with a newmtl statement that defines the name of the material, followed by lines specifying particular properties.

Example MTL File:

        newmtl shinyred
        Ka  0.1986  0.0000  0.0000
        Kd  0.5922  0.0166  0.0000
        Ks  0.5974  0.2084  0.2084
        illum 2
        Ns 100.2237
      

MTL File Characteristics:

Comments begin with a '#' character in column 1. Blank lines may be inserted for clarity. Otherwise, the file consists of a sequence of newmtl statements, followed by a definition of various properties for that material.

The quantities that may be defined for a material include:

Ka r g b
defines the ambient color of the material to be (r,g,b). The default is (0.2,0.2,0.2);
Kd r g b
defines the diffuse color of the material to be (r,g,b). The default is (0.8,0.8,0.8);
Ks r g b
defines the specular color of the material to be (r,g,b). This color shows up in highlights. The default is (1.0,1.0,1.0);
d alpha
defines the transparency of the material to be alpha. The default is 1.0 (not transparent at all) Some formats use Tr instead of d;
Tr alpha
defines the transparency of the material to be alpha. The default is 1.0 (not transparent at all). Some formats use d instead of Tr;
Ns s
defines the shininess of the material to be s. The default is 0.0;
illum n
denotes the illumination model used by the material. illum = 1 indicates a flat material with no specular highlights, so the value of Ks is not used. illum = 2 denotes the presence of specular highlights, and so a specification for Ks is required.
map_Ka filename
names a file containing a texture map, which should just be an ASCII dump of RGB values;

Licensing:

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

Reference:

  1. The Alias Wavefront website.

Sample Files:

You can go up one level to the DATA page.


Last revised on 14 June 2004.