Home

newmtl

newmtl is a directive in the Wavefront MTL (material template library) file format used to begin the definition of a material. In OBJ workflows, the OBJ file can reference an external MTL file with a statement like mtllib and assign materials to faces with usemtl; the MTL file stores surface properties that shading engines use to render the material.

A material definition starts with a line containing newmtl followed by the material name. Subsequent lines

Texture maps can be attached using map_Kd for the diffuse texture, map_Ks for a specular map, and

Example: newmtl brass Ka 0.33 0.25 0.20 Kd 0.78 0.65 0.50 Ks 0.80 0.70 0.60 Ns 20

In use, the OBJ file’s mtllib statement loads the MTL file and usemtl selects which material applies

describe
the
material’s
properties
until
the
next
newmtl
line
or
the
end
of
the
file.
The
most
common
properties
are
Ka
(ambient
color),
Kd
(diffuse
color),
and
Ks
(specular
color),
each
given
as
three
floating-point
values
for
red,
green,
and
blue.
Ns
sets
the
specular
exponent
or
shininess.
The
d
value
specifies
opacity
(1.0
is
opaque;
0
is
fully
transparent)
and
Tr
is
an
alternative
transparency
value.
Ni
controls
optical
density.
illum
selects
the
illumination
model
used
by
the
renderer
(for
example,
different
models
for
diffuse,
specular,
or
combined
shading).
map_Bump
or
bump
for
a
normal
or
bump
map.
Additional
maps
and
shading
options
may
be
supported
by
different
tools,
but
the
core
set
covers
most
common
materials.
d
1.0
illum
2
map_Kd
brass_diffuse.jpg
to
each
face.