In addition to BSP raytracing acceleration and ray depth, the Optimization tab of the mental ray Rendering Options property editor contains a number of useful memory optimization settings. This section describes those settings.
Location: The Render Manager > Renderer > Optimization
or
The Render Manager > Globals > mental ray > Optimization
The Render Type options allow you to specify what mental ray renders:
• Full Render: renders the scene according to the rest of the rendering options.
• Lightmaps Only: renders only the lightmaps required for the lightmap shaders used by the scene.
For more information about lightmaps, see Lightmaps.
• Final Gathering Only: generates only the final gathering maps required by the scene.
For more information about final gathering maps, see Final Gathering.
• Photon Map Only: generates only the photon maps required for the scene.
For more information about photon maps, see Global Illumination and Caustics.
Location: The Render Manager > Renderer > Optimization
or
The Render Manager > Globals > mental ray > Optimization
Activating the Memory Limit allows you to specify how much virtual memory mental ray can use to render your scene. When this setting is deactivated, no memory limit is set.
Location: The Render Manager > Renderer > Optimization
or
The Render Manager > Globals > mental ray > Optimization
Each frame is rendered one tile at a time. You can set the size of the tiles, as well as the order in which they are rendered.
Render Tile Size allows you to define the size of the tile used when rendering an image. Usually, you would use a smaller tile size when you are performing a distributed rendering that has a host and/or slaves operating at different speeds.
Assigning a smaller tile size avoids delaying the faster hosts/slaves by not making them wait for slower slaves that may be taking more time to render a large tile.
The Tile Order specifies the order, or more accurately the pattern in which tiles are rendered. There are two possible settings:
• Hilbert renders tiles in a pattern defined by a Hilbert curve. This is usually the preferable setting, particularly when rendering large meshes.
• Spiral renders tiles from the center of the frame outward in a spiral pattern.
Location: The Render Manager > Renderer > Optimization
or
The Render Manager > Globals > mental ray > Optimization
At render time, XSI splits large objects into many pieces, each of which can be computed separately. It then sends a minimal amount of object data to the mental ray renderer which, in turn, uses a system of callbacks to request only portions of the object that it needs. For example, if you are rendering the head of a very large character, only the head (or part of it) is created and sent to the renderer. Should mental ray run out of memory, it can flush portions of the object that it no longer needs and call them again later, if necessary.
The practical upshot of this system is that, in addition to being able to free up memory for the renderer as needed, XSI seldom, if ever needs a huge chunk of contiguous memory to compute a large object.
Setting the Mesh Splitting Factor
Mesh splitting is usually a transparent process, meaning that you don’t have to adjust any options to make it work. However, should you find yourself running out of memory while trying to render an exceptionally demanding scene, you may be able to get it to render by changing the Mesh Splitting Factor.
The Mesh Splitting Factor affects the size (in triangles) and number of pieces that are created when the mesh is split. The default value of 1 splits a given mesh into the number of pieces that the underlying computations determine to be appropriate. Lowering the factor value to, say, 0.5 doubles the number of pieces, but halves their size.
For example, let’s say you have an object composed of 64000 tesselated triangles. With the splitting factor set to 1, the object might be split into four pieces of 16000 triangles each. If you lower the factor to 0.5, the object is then split into eight pieces of 8000 triangles each.
As a rule, you should not have to adjust the splitting factor at all. However, in certain circumstances, you may have to lower it to get your scene to render properly:
• If you are dealing with extremely large objects (millions, or tens of millions of triangles) that are difficult to render, lowering the factor value allows mental ray to more easily flush unneeded pieces of the mesh, and makes it less likely that mental ray will run out of memory when rendering your scene.
For example, if a given tile only contains half of a split-object piece, the other half is not needed but still takes up memory. If the object is split into smaller pieces, it is more likely that the unnecessary piece can be flushed.
• If scene objects have very heavy displacement, the tesselated displaced surface resulting from a split piece can be too large to fit in memory. In that case, lowering the mesh splitting factor creates more split pieces whose smaller size helps to compensate for the extra geometry added by the displacement.
|
Lowering the mesh splitting factor is only one of a number of optimizations that you can make to get a large and demanding scene to render. For information about other such optimizations, see Optimizing Large Scenes for Scalability. |
Advanced users may also find that raising the mesh splitting factor is useful is certain circumstances:
• If the mesh is being subdivided into so many pieces that the amount of memory required to manage them is slowing down a render
• If scene objects have very light displacement. This is because, to ensure correct displacement, each split piece of a displaced object requires additional information about the triangles on the borders that is shares with other pieces.
If the object is split into too many pieces of too small a size, this extra information can greatly increase the size of each piece, and the resulting redundant calculations can slow down rendering. Increasing the splitting factor forces XSI to split the object into larger pieces with less redundant information.
• If you are running XSI on a 64-bit system, larger pieces of a split object can be fit into memory. In this case, increasing the splitting factor may yield a marginal increase in render speed.
Although there is no easy way to find out how a given object is split, there are a couple of things you can do:
• Read through an .mi file from the scene, where you can see the number of objects into which the object is split. For more information about echoing .mi files, see Exporting to MI Archives.
• Write a custom diagnostic shader that renders each piece of the split object in a different color. For more information about writing custom shaders, see the Help > SDK Guides > SDK Customization Guide > mental ray Shaders.
Rendering Objects’ Front and Back Faces
Location: The Render Manager > Renderer > Optimization
or
The Render Manager > Globals > mental ray > Optimization
By default, both faces of an object are rendered — those whose normals are facing the camera as well as those that are not. If you like, you can render just one face of an object. In this instance, the other face is “culled” (ignored).
To specify which face is rendered, set the Visible Geometry Side option to render the front, back, or both faces.
For example, if you select Front, only the polygons facing the camera are rendered. You should select this option if the back faces of the object are not influential in the scene.
To ensure the highest–quality image, you should select Both. You should also make sure to select Both if you are rendering a double–sided transparent object.
Converting Images to .map Format
Location: The Render Manager > Renderer > Optimization
or
The Render Manager > Globals > mental ray > Optimization
When a texture is memory-mapped, it means that the texture is never loaded into memory. Instead, it is accessed directly from disk whenever a shader uses it. When used properly, memory mapped textures can speed up rendering considerably.
The Convert Textures to Memory Maps options allow you to override the Rendering Preferences options for converting your image clips to memory mapped format at render time. For descriptions of these options, and detailed information about working with memory-mapped images, see Using Memory-Mapped Textures in the Texturing guide.
Optimizing Large Scenes for Scalability
If you are having trouble getting a very large scene to render, there are a number of parameters that you can adjust to increase scalability and ensure that mental ray does not run out of memory. These parameters are found on the Optimization tab of the mental ray Rendering Options property editor.
The following section describes a general approach to adjusting these parameters, not to increase rendering speed, but to ensure that extremely demanding scenes do in fact render. This is more art than science, and you’ll likely need to do a fair amount of tweaking to get a satisfactory result.
To optimize a large scene for scalability
1. Activate the Dynamic BSP option. This makes the scene’s BSP tree “flushable,” meaning that mental ray can collapse unneeded portions of the BSP tree in order to free up memory. This is especially effective in scenes with heavy displacement. For more information about the BSP tree, see BSP Raytracing Acceleration.
|
Dynamic BSP is can drastically increase render times and should only be used in cases where you are unable to render a scene due to lack of available memory. |
2. Reduce the Mesh Splitting Factor value. This breaks large objects into smaller pieces that mental ray can more easily load in memory. For more information about the mesh splitting factor, see Mesh Splitting.
3. Change the Tile Order to Hilbert. Hilbert tiling order is more efficient than the Spiral tiling order, particularly in cases where a large mesh’s triangle density is unevenly distributed. For more information about tiling order, see Setting Tile Options.
|
Changing the tiling order does not have enough of an effect to get a problem scene to render, but if you’ve managed to get the scene to render, using other optimizations, changing the tiling order may help to marginally reduce render times. |
4. Reduce the Tile Size. A smaller tile size means that less of the scene needs to be loaded into memory to render a given tile. This is another optimization that won’t make or break the render, but may help to slightly reduce render times. For more information about tiling size, see Setting Tile Options.
You can make all of the above changes simultaneously by clicking the Optimize button in the For Heavy Scenes optimization section. This is often a good starting point, after which you can continue to tweak individual parameters until you can get the scene to render.
SOFTIMAGE|XSI v.6.01