Class
Shape
Synopsis
Creates instances of shapes and lights as defined by the nodes
and node_idxs
parameters. Per instance transformation, visibility and shader overrides can be specified via the builtin instance_matrix
, instance_visibility
and instance_shader
parameters. Any other per instance shape or light overrides or user parameters can be specified via constant array type user parameters, started with the instance_
prefix. For example overriding intensity of light instances:
declare instance_intensity constant ARRAY FLOAT instance_intensity 10 1 FLOAT 1.4 1 1 1 1 2.2 2 1 1 1
In case all instances share the same parameter value, a single value can be set. For example:
declare instance_intensity constant ARRAY FLOAT instance_intensity 1
Currently instance generation is quite expensive, generating huge amount of instances (e.g. 10 millions) can result in high node init and node update time and memory usage.
Array parameters
Specifying per instance array type parameters requires some special care. Arrays can be defined as constant, uniform, varying, etc, called the category of the array. By default the same category is set as defined on the referenced shapes or lights. In case the array does not exist, the category can be explicitly set via a string type user parameter, started with the arraycategory_
prefix.
This example defines the integer array called myparam on each 3 instances and sets the category to uniform:
declare instance_myparam constant ARRAY ARRAY instance_myparam 3 1 ARRAY 10 1 INT 2 3 2 3 2 3 2 3 2 3 10 1 INT 2 1 2 1 2 3 2 3 2 3 10 1 INT 1 1 1 2 2 2 3 3 3 3 declare arraycategory_myparam constant STRING arraycategory_myparam "uniform"
Override specific instances
In certain cases only some of the instances have overrides and specifying a value for each instance would be inefficient. A user data array with the instanceidxs_
prefix can be declared in this case, which tells the list of instances with overrides.
This example defines overrides of parameter myparam for instance 0 and 3, keeping the default value on all other instances.
declare instance_myparam constant ARRAY ARRAY instance_myparam 2 1 ARRAY 10 1 INT 2 3 2 3 2 3 2 3 2 3 10 1 INT 2 1 2 1 2 3 2 3 2 3 declare instanceidxs_myparam constant ARRAY UINT instanceidxs_myparam 2 1 UINT 0 3
If the same override is defined on multiple instances, they can be defined only once and a user data array with the valueidxs_
prefix can be used to describe the relationship between overrides and instances.
This example defines an override of parameter myparam for instance 0 and 3, and a different override for instance 1 and 4.
declare instance_myparam constant ARRAY ARRAY instance_myparam 2 1 ARRAY 10 1 INT 2 3 2 3 2 3 2 3 2 3 10 1 INT 2 1 2 1 2 3 2 3 2 3 declare instanceidxs_myparam constant ARRAY UINT instanceidxs_myparam 4 1 UINT 0 3 1 4 declare valueidxs_myparam constant ARRAY UINT valueidxs_myparam 4 1 UINT 0 0 1 1
visibility
You can selectively disable an object's visibility for the various types of rays in the renderer. By default, objects are visible to all types of rays. Camera - Camera (AA) rays (i.e., primary or view rays). Shadow - shadow rays fired in the direct lighting calculations. Specular - specular_reflection rays. Transmission - transmission rays. Diffuse - indirect_diffuse rays (i.e. global illumination or GI rays). Specular - indirect_specular rays (i.e. specular reflection rays). To set the visibility, add up the values of the rays you want to "see" the object. For example, if an object is visible to the camera (primary visibility), and to transmission (both diffuse and specular), then that’s visibility 13 (1 + 4 + 8).Ray type Decimal Value Camera (Primary Visibility) 1 Shadow (Casts Shadows) 2 Diffuse transmission 4 Specular transmission 8 Volume 16 Diffuse reflection 32 Specular reflection 64 SSS (subsurface) 128
sidedness
Just like you can disable the visibility for specific ray types, you can also change an object's sidedness depending on the ray type. By default, objects are double-sided for all rays. By unclicking any of these checkboxes, the object will become single-sided, which means that those parts of the object whose normal vector points away from the incoming ray direction will not be rendered.
receive_shadows
Determines whether or not the object picks up shadows from other objects.
self_shadows
Determines whether or not the object casts shadows on itself.
invert_normals
Invert normals (so that normals face inwards and not outwards).
ray_bias
Raytrace bias value specified for the object.
matrix
Transformation matrix. This can be either a single matrix or an array of matrices that define the SRT motion of the object for the current frame (the matrices define the motion for the full-frame, not just between the shutter open - close time).
transform_type
Specifies what type of motion the object has. Options are linear
, rotate_about_center
, and rotate_about_origin
. linear
corresponds to the linear interpolation between matrices. rotate_about_origin
corresponds to curved_motionblur=true
. Unlike, rotate_about_origin
which sets the rotation pivot at the origin, rotate_about_center
will rotate about the object's center. This is the default mode and is useful for wheels, propellers, and other objects which spin.
shader
An array of nodes pointing to the shader or shaders in the case of per-face shader assignment.
opaque
As of Arnold 5.3, this flag is set automatically by changing the opacity or transmission on a material. Determines whether the object is considered opaque (transparent). By default, Arnold built-in shaders set the Exceptions are opaque
flag automatically, based on whether or not the shader settings would require disabling the opaque
flag on the object to render correctly. For example, it's no longer necessary to manually disable the opaque
flag to get transparent shadows for a glass shader. curves
and points
when min_pixel_width
is in use, and OSL shaders.
matte
The matte option enables you to create holdout effects by rendering the alpha as zero.
use_light_group
A boolean to enable selective light linking
light_group
An array of nodes pointing to the lights that will affect the node if use_light_group is enabled.
use_shadow_group
A boolean to enable selective shadow linking.
shadow_group
An array of nodes pointing to the lights that will not cast shadows on the polymesh, if use_shadow_group is enabled.
trace_sets
An array of strings each of which names a trace set. A custom shader must be used to make effective use of these strings via the AiShaderGlobalsSetTraceSet and the AiShaderGlobalsUnsetTraceSet API calls. It is possible to tag objects to be part of one or many trace sets. The trace_set shader tags specific rays with an inclusive or exclusive trace set. Both geometry and rays can be tagged with trace sets: The way those two tags interact makes it possible to control visibility for specific rays:
motion_start
motion_end
The time at which the last motion key of the shape is sampled. Other motion keys must be uniformly spaced within this range. Times can be absolute or relative as long as shutter and motion times use the same convention. By convention, the times are frame relative. For example, start and end times -0.5 to 0.5 indicate that two motion keys will be sampled midway between the previous and current frame, and the current frame and next frame. This is applied to cameras, lights, and shapes.
id
Unique ID for a node in the Arnold scene.
override_nodes
Nodes inside the procedural can be replaced by other nodes with this parameter. This may be used for example to replace shaders in an existing .ass procedural. When the parameter is enabled, nodes in the immediate parent scope of the procedural will replace identically named nodes inside the procedural.
namespace
Procedurals can declare a custom namespace using this parameter. This custom namespace can be used instead of the procedural name, to reference contents through absolute or relative paths. Multiple procedurals can share the same namespace by using the same custom name. Also, they can declare an empty name and they will use the global namespace.
operator
The operator graph is evaluated specifically for this procedural from the operator node defined here, denoted as the target operator.
nodes
Array of shapes and lights from the scene which will be instanced.node_idxs
This array describes which shape or light is referenced by each instance by defining the index in thenodes
array. If all instances reference the same shape, a single value can be specified instead of an array.