Our raytracer originally used materials modelled after OpenGL's style of material properties. For comparison, the components of a material specification in this system are included here.

```
material {
float		ambient[3];
float		diffuse[3];
float		specular[3];
float		emissive[3];
float		kspec;
float		ktrans;
}

```

There are many problems with this model. First of all, ambient lighting is a hack to make up for the deficiencies of local illumination methods. Second, the diffuse and specular triplets can have any magnitude, effectively creating more diffuse or specular light than is incident to the material. Third, kspec is again, a hack to allow for modification of the specular character of a material. The second problem is especially important for our program because if the sum of the magnitudes of the diffuse and specular triplets is greater than or equal to one, our system's lighting will never converge.

We came up with a new model which we feel will better accompany our system. It's properties are as follows.

```
material {
float		diffuse[3];
float		specular[3];
float		luminance;
float		reflectance;
float		specularity;
float		roughness;
float		transparentDepth;
float		refractiveIndex;
}

```

The diffuse and specular triplets have returned, but this time their function is different - each will be normalized, so their magnitudes are one. This way, they don't affect the magnitude of light, just the color. Illuminance replaces emissive, but it's just a scalar - that's because it's multipled by the diffuse multipler to get the emitted light. Reflectance represents how much of the total incident light is reflected, and so has a range of [0,1). This avoids the problem of a material reflecting more light than is incident. Specularity determines how much of the reflected light is diffuse and how much is specular. A specularity value of zero represents entirely diffuse, and a specularity value of one represents entirely specular.

The last three values, roughness, transparentDepth and refractiveIndex, are for more complicated material rendering. Roughness is a measure of how rough the surface is on a macroscopic scale, resulting in blurred specular reflections. TransparentDepth takes the place of ktrans. ktrans has a range of [0,1], while transparentDepth has a range of [0,inf). The difference is that ktrans represents the spectrum from totally opaque to totally transparent, whereas transparentDepth represents the distance light propogates through the material, in world units. A transparentDepth of 0 means light doesn't propogate at all through the material, so it's totally opaque. A transparentDepth near infinity means light propogates very far through the material, so much so that it's almost 100% transparent. Since no material is ever actually 100% transparent, transparentDepth doesn't need to handle that possibility. RefractiveIndex is the measure of the refractive index of the material, with a range of [0,inf). It allows for refraction of light rays at the boundary of this material and others, in accordance with Snell's law. Air has a refractive index of 1.

The equations for calculation of total excident light are as follows.

```
excident_diffuse  = (incident * reflectance * (1 - specularity) * diffuse)
+ (illuminance * diffuse);

excident_specular = incident * reflectance * specularity * specular;

excident_total    = excident_diffuse + excident_specular;

```

All materials copyright 2002 Harvey Mudd College