MDL Materials
Cornell University Program of Computer Graphics

The material parameters which can be texture mapped are specified as chunks. Currently this applies to colors and the phong exponent. Colors can be specified as either a color chunk or a texture chunk. You cannot specify both a texture and color chunk. Color chunks can be spectral (spctrl), rgb (rgb), or scalar (sclr). Other material modifiers (e.g. bump mapping) would appear in the optional chunks at the end of a material.

### Phong exponents

When texture mapping Phong exponents the following formula should be used:
```   e = 10^(0.0001*t^2)
```

where e is the Phong exponent and t is the 0-255 value from the texture map.

### Inline versus named materials

There are two different ways to make a diffuse red sphere. The first is to define the material inline:

```sphr "white sphere"
lmbrtn rgb 0.8 0.2 0.2 end end
0.0 0.0 0.0 1.0  % center,radius
end
```
The other way is to define a material with a name and reference that name:

```nmdMtrl "red"
lmbrtn
rgb 0.8 0.2 0.2 end
end
end

sphr "white sphere"
mtrlNm "red" end
0.0 0.0 0.0 1.0  % center, radius
end
```

### Using textures for material properties

Anywhere a material specifies a color, a texture can be used in place of the color. You can think of a color as a texture map that always returns the same value. For example, to define a diffuse material whose reflectance is defined by a texture map in a ppm file:

```   lmbrtn
imgFl "foo.ppm" "ppm" end
end
```
Alternatively, you could name the image and reference it:

```   nmdImg "foo"
imgFl "foo.ppm" "ppm" end
end

lmbrtn
imgNm "foo" end
end
```
Finally, you could define the pixels inline:

```   nmdImg "foo"
imgDt 2 3  % a 2 by 3 image with rgbs
rgbLst
0.1 0.1 0.1
0.1 0.1 0.1
0.1 0.1 0.1
0.1 0.1 0.1
0.1 0.1 0.1
0.1 0.1 0.1
end
end
end
```