Keywords: main

Next: 1.8 Light Sources Up: 1. Functionality Previous: 1.6 Atmospheres and Volumes

# 1.7 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/C++ shader:

- The first shader is the material shader itself. This is the only one that 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.

- 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.

- An optional lightmap shader3.x causes the object to be sampled to create a light map, which collects arbitrary information (usually illumination) about an object that can later be used during rendering.

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. The declaration of a shader, which is provided by the author of the shader, defines the list of possible parameters, including names and types (such as ``color'' or ``vector''. The definition of a shader is done in a scene file, and provides the values. For example, a shader might have a color parameter named `"diffuse"` with the value `1.0 1.0 0.0`, which specifies a yellow color. Parameter values can be given in any order. Parameters can also be omitted; mental ray will substitute null values. Shaders are typically programmed to provide reasonable defaults in this case.

Next: 1.8 Light Sources Up: 1. Functionality Previous: 1.6 Atmospheres and Volumes