## Bump, Displacement, and Reflection Mapping

Just as a texture map can vary a parameter such as the diffuse color over every point on a surface, a bump map can be associated with a material, perturbing the normal at every point on a surface which uses the material, simply by applying an appropriate shader. This will affect the shading, though not the geometry, giving the illusion of a pattern being embossed on the surface.

Bump maps, like texture maps, require a texture space. In addition, bump maps require a pair of basis vectors to define the coordinate system in which the normal is displaced. A bump map defines a scalar x and a scalar y displacement over the texture space. These components are used together with the respective basis vectors in order to calculate a perturbed surface normal. The basis vectors can be automatically defined for free-form surfaces in a way which conforms to the texture space; for polygons and subdivision surfaces, the basis vectors must be explicitly given along with the texture coordinates for every polygon vertex. However, most commonly basis vectors are computed procedurally by shaders during rendering.

displacement map is a scalar map which is used to displace a free-form surface, polygon, or subdivision surface at each point in the direction of the local normal. Like texture, bump and reflection maps, displacement maps are controlled by shaders that are used by mental ray to determine the displacement of points on the surface, in order to decide how to deform the surface and introduce geometric detail.

The surface must be triangulated finely enough to reveal the details of the displacement map. In general, the triangles must be smaller than the smallest feature of the displacement map which is to be resolved.

Displacement mapped polygons are at first triangulated as ordinary polygons. The initial triangulation is then further subdivided according to the specified approximation criteria. The parametric technique subdivides each triangle a given number of times. All the other techniques take the displacement into account. The length criterion, for example, limits the size of the edges of the triangles of the displaced polygons and ensures that at least all features of this size are resolved. As the displaced surface is not known analytically, the distance criterion compares the displacements of the vertices of a triangle with each other. The criterion is fulfilled only if they differ by less than the given threshold. Subdivision is finest in areas where the displacement changes. The angle criterion limits the angle under which two triangles meet in an edge contained in the triangulation. Subdivision stops as soon as the given criterion or combination of them is satisfied or the maximum subdivision level is reached. This does not preclude the possibility that at an even finer scale new details may show up which would again violate the approximation criteria.

mental ray supports rendering subdivision surfaces natively, and handles displacement mapping on subdivision surface as part of the tessellation to the limit surface. If detailed displacement on a smooth polygon mesh is the primary goal then the ccmesh primitive should be used for its superior performance.

For displacement mapped free-form surfaces approximation techniques can be specified either on the underlying geometric surface or for the surface resulting from the displacement. If one wants to control the approximation from the geometric surface, the most suitable technique for use with displacement mapping on free-from surfaces is usually the view dependent uniform spatial subdivision technique, which allows specification of triangle size in raster space.

In addition to or even instead of specifying the subdivision criteria for the base surface, they can be given for the displaced surface itself. This approximation statement works exactly the same way as for polygons, i.e. an initial tessellation is subdivided until the criteria on the displaced surface are met.

The final type of map is an environment map. This is a color-mapped virtual sphere of usually infinite radius which surrounds any object referencing the given material. This sphere is also seen by refracted rays; the environment seen by first-generation (primary) rays can also be specified but is part of the camera, not of any particular material. In general, if a ray does not intersect any objects, or if casting such a ray would exceed the trace depth, the ray is considered to strike the sphere of the environment map of the last material visited, or the camera environment map in the case of first-generation rays that did not hit any material. An environment shader is used to determine the color of each point of the sphere.

The environment map always covers the entire sphere exactly once. Rotations, translations, and repetitions are supported by special shader parameters or remapping shader nodes such as the ones found in the base shader library. There are also environment shaders that implement cubical instead of spherical environment maps, and cubical maps of finite instead of infinite size.

As described before, textures can be used for any purpose whatever to control shader behavior, in addition to the examples in this section.