Skip to main content
Top

2000 | OriginalPaper | Chapter

Instancing and Grouping

Author : Thomas Driemeyer

Published in: Rendering with mental ray®

Publisher: Springer Vienna

Activate our intelligent search to find suitable subject content or patents.

search-config
loading …

Instances are scene elements that place other elements such as objects, lights, cameras, and subgroups in the right place in 3D space where they can be rendered. Every instance references exactly one element to be instanced, plus additional information: The element to be instanced may either be the quoted name of an object, light, camera, or instance group, or a geometry shader introduced with the geometry keyword. In the geometry shader case, the shader is called at scene preprocessing time just before rendering, and is expected to generate an object, light, camera, or instance group with which preprocessing can then proceed. Procedural elements are deleted automatically after rendering.The transform keyword allows specification of a matrix that converts the parent coordinate space above the instance to the space of the instanced element. This matrix is optional but will nearly always be used because it provides the relation between world space (at the top of the scene graph) and object space (at the bottom of the scene graph). The camera is also placed in 3D space with an instance, so the camera instance transformation matrix converts world space to camera space.The mot ion transform statement does a very similar thing, except that it specifies the motion transformation matrix, which gives rise to motion blur. If the motion matrix is omitted, it effectively defaults to an identity matrix. The alternate form motion off cancels any motion transformation inherited from above, which effectively nails the instanced element in place in the 3D world, as far as blurring is concerned, even if it belongs to a moving sub-scene. See chapter 8 for details on motion blurring.The tag statement sets a label1 in the instance, which can be used for identification purposes. The mental ray rendering software does not use it but makes it available to shaders, which can alter their behavior based on the label.The data statement allows attaching user data2 to the instance. User data is not used by mental ray but can be accessed by shaders. See page 240 for details. If the null keyword is used instead of the name of a user data block, any existing user data block reference is removed from the instance; this is useful for incremental changes. If more than one data statement is specified, they are connected to a chain in the order specified. Shaders can traverse the chain.The material statement allows. If the name of a material (not a material shader) is given, it replaces any inherited material with this one and propagates it down the instanced element or subgraph. For this and the other kinds of inheritance, see chapter 14.The hide statement allows disabling the instance. If set to on, the instance and its contents are ignored, as if it and its reference in the parent instance group had been removed. This is useful for quick preview rendering of parts of the scene without massive changes to the database.The visible, shadow, trace, caustic, and globillum flags are used for flag inheritance. They are propagated down the scene graph and override similar flags in geometric objects. See chapter 14 for details.Finally, parameters may attached to an instance much like parameters can be defined for named shaders. If an instance does not require parameters, it is not required — and in fact not efficient — to use an opening parenthesis directly followed by a closing parenthesis as is done in shader definitions because that would store a null parameter block, as opposed to omitting the parameter block. Like shader parameters, instance parameters must be declared. The declaration used is the declaration of the inheritance shader specified in the options block, and it is the same for all instances in the scene.

Metadata
Title
Instancing and Grouping
Author
Thomas Driemeyer
Copyright Year
2000
Publisher
Springer Vienna
DOI
https://doi.org/10.1007/978-3-7091-3697-3_14

Premium Partner