Keywords: main

Next: 1.7 Light Sources Up: 1. Functionality Previous: 1.5 Atmospheres and Volumes

# 1.6 Materials

A material determines the response of a surface to illumination. Materials in mental ray consist of a material name and one mandatory and seven optional shaders, each of which can be a standard shader or a user-provided C function:

- The first function is the material shader itself. It may not be omitted. The material shader determines the color of a point on an object, based on its parameters which may include object colors, textures, lists of light sources, and other arbitrary parameters.

- An optional volume shader controls rays passing through the inside of the object. This is functionally equivalent to atmosphere calculations, but takes place inside objects, not outside.

- An optional photon shader determines how the material interacts with indirect illumination if caustics or global illumination are enabled, much like the main material shader determines how the material interacts with direct illumination.

- An optional photon volume shader determines how the inside of the object interacts with indirect illumination if caustics or global illumination are enabled, much like the volume shader determines how the volume interacts with direct illumination.

- An optional environment shader provides an environment map for non-raytraced reflections.

- An optional displacement shader can be named that displaces a free-form surface at each point in the direction of the local surface normal. Displacement maps affect the triangles resulting from the tessellation of free-form surfaces and polygonal meshes.

- An optional shadow shader determines the way shadow rays pass through the object. This can be used for calculating colored shadows.

- An optional contour shader specifies how contours should be drawn in and around the object that this material is applied to, if contour rendering is enabled.

The shading function may be either a user written function linked at run time, or it may be one of the standard functions. Shaders may define parameters that control their behavior. Shaders are completely free to define any set of parameters required for their function, but there is a set of commonly used terms and parameter names that will be found in many parameter lists.

Parameters have names and values. For example, a shader might have a parameter named `"diffuse"` with the value `1.0 1.0 0.0`, which specifies a yellow color. Parameters can be given in any order. Parameters can also be omitted; mental ray will substitute null values. Here is a list of commonly used parameters. Note that data types may vary: some shaders may accept a single scalar value for parameters such as transparency while others expect a color (three or four scalars) to specify the transparency of red, green, blue, and perhaps alpha separately. For a description of the parameters accepted by a specific shader, refer to the documentation of the shader library that the shader belongs to.

The index of refraction controls the bending of light as it passes through a transparent object. Although actually dependent on the ratio of indices between the transparent material being entered and that being left, in practice one may say that the higher the index of refraction, the more the light is bent. Typical values are 1.0 for air, 1.33 for water and 1.5 for glass.

The shinyness material parameter effectively controls the size of highlights on a surface. It is also known as the specular exponent. The higher the value, the smaller the highlight.

The dissolve parameter controls the fading transparency of a material independent of refractive effects. This is more accurately described as a blending operation between the surface and whatever lies beyond. If the transparency is 0.0, the surface is completely opaque. A value of 0.5 would cause an equal blend of the surface and the background. A value of 1.0 would result in an invisible surface. This parameter is used by the Wavefront-compatible shaders only.

The transparency parameter controls the refractive transparency of a material. Unlike dissolve, this parameter has a physically correct interpretation. The range is, as for transparency, from 0.0 for opaque to 1.0 for a completely transparent surface. The interpretation of transparency is left entirely to the material shader.

The reflect parameter controls the reflectivity of a material. If reflect is 0.0 no reflections would be visible on a surface. A perfect mirror would have a reflect value of 1.0.

The ambient component approximates the color of a light source which illuminates a surface from all directions without attenuation or shadowing.

The diffuse component is the color of the surface which is dependent on its angle to a light source but independent of the position of the viewer. A piece of felt is an example of a material with only a diffuse component.

The specular component is the color of the surface which is dependent both on the position of the light source and the position of the viewer. It is the color of highlights on the surface.

The transmit component ( transmission filter) is a color which filters light refracted through an object. A piece of glass which imparts a green tint to the objects seen through it would have a green transmit component. This parameter is used by the Wavefront shader only.

Finally, the shade component ( shadow filter) is a color which filters light as it passes through a transparent object which casts a shadow. A blue glass ball would have a blue shade component. This parameter is also used by the Wavefront shader only.

Next: 1.7 Light Sources Up: 1. Functionality Previous: 1.5 Atmospheres and Volumes