mental ray supports free-form curves and surfaces in non-uniform rational B-spline (NURB), 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.1.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, uniform spatial, curvature dependent, and combined 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 uniform spatial technique (spatial in the input file) 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 uniform spatial approximation technique with a raster space accuracy of 0.5 pixel diagonals. Note that the apparent size of a subdivided portion of a surface is computed as if the surface was parallel to the screen. Thus, the triangulation does not become more coarse towards the edge of the object's silhouette. This has the advantage that the object will be well approximated even if seen in a mirror from a different angle, but such a definition can also result in an overly fine triangulation.
View-dependent subdivision 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. Camera dependency works best if it is used for objects that are not instanced too many times.
The curvature dependent technique (known as curvature in the input file), subdivides a surface until two approximation criteria are satisfied simultaneously. The first is an upper bound on the maximum distance in the space the object is defined in between the actual surface and its polygonal approximation (known as the distance tolerance). The second is 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). Note that the first criterion is scale dependent while the second is scale independent. That is, one must know the size of the object in order to choose a suitable tolerance in the first case but not the second. In spite of this apparent advantage of the 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. The distance criterion may be optionally given in raster space, again in units of pixel diagonals.
It is also possible to use an approximation technique which combines the bounds of the spatial technique and the curvature dependent technique.
Both the uniform spatial and curvature dependent 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 technique2.1begin at the patch level. 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.
The curvature dependent approximation technique with the distance tolerance given in raster space and the angle tolerance set to zero has proved to be the most useful technique for high quality rendering.
For a quick rendering to examine materials or object positions, the uniform parametric technique may be used with a factor of zero.
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. An important difference is that the uniform spatial, curvature dependent, and combined approximation techniques will coalesce curve segments if possible. A straight line consisting of one hundred co-linear segments may be approximated by a single line segment.