Class defining Material colours and properties.
The interaction between light and various sorts of material can be very complex. In this ray tracer, we use a simplified model, which still has several components. A Material for an object has a number of different Colour properties. The observed Colour of an object comes from the interaction of different types of light and different Material properties:
- The ambientLight from the Scene and the Material's ambientColour combine to give a base Colour.
- Each light which can be seen from the surface provides a number of components:
- A diffuse component, which follows a Lambertian illumination model and uses the Material's diffuseColour.
- A specular component, which follows a Phong illumination model and uses the Material's specularColour and specularExponent.
- Some surfaces create mirror-reflections, which are influenced by the mirrorColour. For example, reflections in a gold surface should appear yellow. Also, not all LightSource objects give white light, and the Colour of an object depends on the interaction between the light and surface colours. This can be achieved by multiplying the Material Colour by that of the LightSource.