home | << prev | next >> | contents |
Assemblies can either be defined in separate files, or created procedurally.
Assembly is created or loaded when its bounding box is hit by a ray or when the bounding box overlaps a tile in the rasterizer renderer. For this reason, mental ray needs to know the bounding box of an assembly, which should be as tight as possible for the best performance and memory consumption.
Assemblies are instantiated similar to objects. The main scene should contain a stub with the following syntax:
assembly "assembly_name" box [min_x min_y min_z max_x max_y max_z] [ motion box [min_x min_y min_z max_x max_y max_z] ] file "file_name" end assembly
The individual parameters are:
Unlike objects, assemblies do not have trace
,
visible
and similar flags. Those flags need to be
defined on an instance
of an assembly.
An assembly file uses the usual mental ray scene file syntax, with one exception: instead of the render directive, an assembly files ends with the up must be specified with the root statement statement specifying a single group which is attached to the main scene DAG when an assembly is loaded:
root "group_name"For compatibility reasons, a
render
statement can be
used instead of the root statement (in which case camera and
options are ignored).
Assemblies can also be created procedurally, detailed description is given in the Assembly API section.
Materials defined in an assembly should reference lights defined in the main scene only. This requirement is due to the fact that the rendering kernel would not be aware of them until all of the assemblies are loaded in order to apply lights on an object from a different assembly or from the main scene.
Transforms, flags, materials and light lists can be inherited from the main scene to an assembly.
An entire assembly is unloaded automatically if mental ray is running low on physical memory. However, a scene could consist of few assemblies only. Especially for scenes using ray tracing and global illumination, the spacial coherency of traced rays is very low. This could lead to frequent loading and unloading of assemblies, which is computationally expensive. In order to improve the performance, it is strongly recommended to use placeholder objects inside of the assemblies. If placeholder objects are used and mental ray is running low on memory, mental ray would first unload the results of placeholder object callbacks, but keep the assembly structure. Individual objects are much faster to recreate than entire assemblies.
For assemblies loaded from files mental ray provides on demand loading of individual objects automatically. For procedurally created assemblies, it is strongly recommended to write geometry shaders with assembly callbacks in such a way that object placeholder callbacks are registered.
In mental ray 3.6 assemblies cannot be nested.
home | << prev | next >> | contents |
Copyright © 1986-2007 by mental images GmbH