mental ray supports **free-form curve**s and surfaces in non-uniform rational B-spline (NURBS), Bézier, Taylor (monomial), cardinal or basis matrix form. Any of these forms
may be rational and may be of degree up to twenty-one. [2] Surfaces may be trimmed.

Internally, free-form surfaces are triangulated (approximated) before rendering. A variety of approximation techniques is available, including uniform and regular parametric, edge length, distance, angle, and combined methods. All versions of mental ray support a large range of methods:

- The uniform parametric technique (referred to in the input file
as
`parametric`) subdivides the surface at equal intervals in parameter space. The input file specifies a factor which is multiplied by the surface degree to obtain the number of subdivisions in each parametric direction per patch. - The regular parametric technique (
`regular parametric`in the input file) is a simpler variant of the previous technique. It subdivides the surface at equal intervals in parameter space. The number of subdivisions per surface is directly specified in the input file. - The edge length technique (using the
`length`keyword) subdivides the surface at equal intervals in camera space (in the`mi1`format) or in object space (in the`mi2`format) - or, rather, the intervals will never exceed the given upper bound. Optionally, this bound may be specified in raster space (in units of pixel diagonals) rather than camera or object space. If, for example, one wanted to approximate a surface with sub-pixel size triangles, one could use the edge length approximation technique with a raster space accuracy of 0.5 pixel diagonals. - The distance-dependent technique (using the
`distance`keyword) subdivides a surface until an upper bound on the maximum distance in the space the object is defined in between the actual surface and its triangle approximation (known as the*distance tolerance*). Length and distance criteria are scale dependent: the size of the object determines the number of triangles, larger objects require more triangles to meet the same length or distance criterion because the length and distance scales with the object. Note that the distance criterion will not resolve features whose scale is below the given tolerance. The distance criterion may be optionally given in raster space, again in units of pixel diagonals. - The angle-dependent technique (using the
`angle`keyword) subdivides a surface until an upper bound on the maximum angle (in degrees) between any two normals on a subdivided portion of the surface (known as the*angle tolerance*) is met. In spite of the apparent advantage of the size-independent angle criterion over the distance criterion, the angle criterion has the undesirable property of resolving small discontinuities ad infinitum, whereas the distance criterion will not resolve features whose scale is below the given tolerance. Either criterion can be disabled by setting the corresponding tolerance to zero.

In addition, mental ray supports a specialized method called
*fine approximation* that is much easier to control and works
very well with high-detail displacement maps. The view-dependent
fine length method is now recommended for all high-detail
tessellations; regular parametric can be used for low-detail
objects or the base surface of finely displaced objects. This
greatly simplifies the choice of methods and parameters.

- Fine approximation can be combined with the length and partly with parametric techniques to create a very fine microtriangle approximation that works especially well for very detailed displacement maps, resolving every little detail instead of introducing tessellation artifacts such as broken edges at contrast boundaries in the displacement map. Due to mental ray's cache manager, fine approximation does not result in excessive memory usage (as non-fine approximation with the same approximation parameters would). See page fineapprox for details. Fine approximation cannot be used together with merging and connections.

The length, distance, and angle criteria can be combined; in
this case refinement continues until all criteria are met. The
`any` keyword changes this so that refinement stops when
*any* criterion is met; this is useful to stop the angle
criterion from adding more triangles when the triangle edges become
smaller than the limit specified by the length criterion, for
example.

View-dependent subdivision, enabled by the `view`
keyword, changes the length and distance criteria to work in
raster space, interpreting the
parameters in pixels instead of 3D units. Effectively, closer
objects are tessellated more finely. This means that objects that
are instanced more than once must be triangulated in multiple ways.
A tradeoff between the additional memory required to store multiple
objects and the reduced total number of instanced triangles must be
evaluated to achieve optimal speed.

The length, distance, and angle approximation techniques use a recursive subdivision process that can also be controlled by two additional parameters, specifying the minimum and maximum number of recursion levels. The subdivision can be forced to proceed at least as far as the given minimum level, and refinement can be halted at the maximum level.

All subdivisions of a free-form surface apart from the regular parametric technique and the Delaunay technique begin at the patch level. (A patch is the smallest unit of a surface.) If, for example, a plane is modeled with ten by ten patches it will be approximated by at least two hundred triangles, although two triangles might be adequate. If mental ray seems to be producing a large number of triangles in spite of a low approximation accuracy, this is often due to the selected patch subdivision algorithm.

Free-form curves (trimming curves) may also be approximated by any of the above described methods using a technique and tolerances which are distinct from those of the surface which the curve trims. The definitions are essentially the same if one considers a curve segment to correspond to a surface patch.

[2] Although the user-settable degree is currently limited to 21, mental ray has no inherent limit.

Copyright © 1986-2010 by mental images GmbH