Material template library Wavefront .obj file




1 material template library

1.1 basic materials
1.2 texture maps
1.3 texture options
1.4 vendor specific alterations

1.4.1 physically-based rendering







material template library

the material template library format (mtl) or .mtl file format companion file format .obj, defined wavefront technologies, describes surface shading (material) properties of objects within 1 or more .obj files. .obj file references 1 or more .mtl files (called material libraries ), , there, references 1 or more material descriptions name. .mtl files ascii text define light reflecting properties of surface purposes of computer rendering, , according phong reflection model. standard has widespread support among different computer software packages, making useful format interchange of materials.


the mtl format, although still used, outdated , not support later technologies such specular maps , parallax maps. however, due open , intuitive nature of format, these can added custom mtl file generator.


the mtl format defines number of formats.


basic materials

a single .mtl file may define multiple materials. materials defined 1 after in file, each starting newmtl command:



# define material named colored
newmtl colored

the ambient color of material declared using ka. color definitions in rgb each channel s value between 0 , 1.



ka 1.000 1.000 1.000 # white

similarly, diffuse color declared using kd.



kd 1.000 1.000 1.000 # white

the specular color declared using ks, , weighted using specular exponent ns.



ks 0.000 0.000 0.000 # black (off)
ns 10.000 # ranges between 0 , 1000

materials can transparent. referred being dissolved. unlike real transparency, result not depend upon thickness of object. value of 1.0 d default , means opaque, value of 0.0 tr .



d 0.9 # implementations use d
tr 0.1 # others use tr (inverted: tr = 1 - d)

multiple illumination models available, per material. these enumerated follows:



0. color on , ambient off
1. color 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


illum 2

texture maps

textured materials use same properties above, , additionally define texture maps. below example of common material file. see full wavefront file format reference more details.



newmtl textured
ka 1.000 1.000 1.000
kd 1.000 1.000 1.000
ks 0.000 0.000 0.000
d 1.0
illum 2
map_ka lemur.tga # ambient texture map
map_kd lemur.tga # diffuse texture map (most of time, will
# same ambient texture map)
map_ks lemur.tga # specular color texture map
map_ns lemur_spec.tga # specular highlight component
map_d lemur_alpha.tga # alpha texture map
map_bump lemur_bump.tga # implementations use map_bump instead of bump below


bump lemur_bump.tga # bump map (which default uses luminance channel of image)
disp lemur_disp.tga # displacement map
decal lemur_stencil.tga # stencil decal texture (defaults matte channel of image)

texture map statements may have option parameters (see full spec).



map_ka -o 1 1 1 ambient.tga # texture origin (1,1,1)
refl -type sphere clouds.tga # spherical reflection map

texture options

-blendu on | off # set horizontal texture blending (default on)
-blendv on | off # set vertical texture blending (default on)
-boost float_value # boost mip-map sharpness
-mm base_value gain_value # modify texture map values (default 0 1)
# base_value = brightness, gain_value = contrast
-o u [v [w]] # origin offset (default 0 0 0)
-s u [v [w]] # scale (default 1 1 1)
-t u [v [w]] # turbulence (default 0 0 0)
-texres resolution # texture resolution create
-clamp on | off # render texels in clamped 0-1 range (default off)
# when unclamped, textures repeated across surface,
# when clamped, texels fall within 0-1
# range rendered.
-bm mult_value # bump multiplier (for bump maps only)

-imfchan r | g | b | m | l | z # specifies channel of file used
# create scalar or bump texture. r:red, g:green,
# b:blue, m:matte, l:luminance, z:z-depth..
# (the default bump l , decal m )
bump -imfchan r bumpmap.tga # says use red channel of bumpmap.tga bumpmap

for reflection maps...



-type sphere # specifies sphere refl reflection map
-type cube_top | cube_bottom | # when using cube map, texture file each
cube_front | cube_back | # side of cube specified separately
cube_left | cube_right

vendor specific alterations

because of ease in parsing files, , unofficial spreading of file format, files may contain vendor specific alterations.


according spec, options supposed precede texture filename. however, @ least 1 vendor generates files options @ end.



bump texbump.tga -bm 0.2 # bump multiplier of 0.2

physically-based rendering

the creators of online 3d editing , modeling tool, clara.io, proposed extending mtl format contain following paramters represent physically-based rendering parameters:



pr/map_pr # roughness
pm/map_pm # metallic
ps/map_ps # sheen
pc # clearcoat thickness
pcr # clearcoat roughness
ke/map_ke # emissive
aniso # anisotropy
anisor # anisotropy rotation
norm # normal map, same format bump parameter







Comments

Popular posts from this blog

File format Wavefront .obj file

CEFR alignment Euroexam International

Books Soma Valliappan