Skip to content

Utility#

The Utility texture is very useful if you wish to extract geometric, rendering information and more. It can also be useful when exporting AOVs. For example, with the Utility you can extract world positions, shutter time, normals etc... The attribute Output sets what information the texture should output as color.

The output value is not normalized. For example, if you output P (Position), this will export the real position values and not a normalized color.

Utility set to Area (Ray Differentials)

Utility set to Area Ray Differentials

However some values are output as a normalized color such as Object ID or Shutter Time.

Utility set to Object ID

Utility set to Object ID

Output Modes#

Output Mode Description
P (Position) Return the position of the geometric fragment. Using the Space attribute it is possible to return the fragment in World, Local or Camera space.
N (Normal) Return the normal of the geometric fragment. Using the Space attribute it is possible to return the fragment in World, Local or Camera space. It is also possible to specify which normal to output using the Surface attribute.
dPdu Return the texture u derivatives.
dPdv Return the texture v derivatives.
dPdt (Motion Vector) Return the motion vectors. Using the Space attribute it is possible to return the fragment in World, Local or Camera space.
dNdu Return the normal u derivatives.
dNdv Return the normal v derivatives.
Z (Depth) Return the depth distance to the in Camera space.
E (Eye Position) Return the origin of the ray in World space.
I (Incoming Ray Direction) Return the direction of the ray in World space.
Is Facing? Return if the geometric fragment is facing the ray direction.
uv (Parametric) Return the parametric UV of the geometric fragment
UV Map Return the UV coordinate of the geometric fragment for the specified UV Map set in UV Slot.
Area (Ray Differentials) Return the Area of the geometric fragment in world space.
Shutter Time Return the shutter time between-frame of the geometric fragment. This only works when motion blur is enabled.
Participating Media Return the visibility of the geometric fragment inside a volume.
Item Position (World) Return the world position of the specified item. Note if no item is specified it returns the world position of the rendered object (or top most object if the object is an instance).
Item Rotation (World) Return the world rotation of the item. Note if no item is specified the node returns the rotation of the rendered object (or top most object if the object is an instance).
Item Scale (World) Return the world scale of the specified item. Note if no item is specified it returns the rotation of the rendered object (or top most object if the object is an instance).
Camera Sample Position (Pixel Space) Return the position of the camera sample in the subpixel where (0.5, 0.5) being the center of the pixel and (0, 0) is on the top left.
Time Instance Frame Return the Frame of the instance (which is very useful when using time offset in a scatterer to drive textures for example).

Space#

The Space attribute defines in which space the output value should be expressed in.

Space Mode Description
World Express the information in World space.
Local Express the information in Local space. The local space doesn't take into account any transformation matrix.
Camera Express the information in Camera space.

Surface#

The Surface attribute defines which geometry approximation should be used for the output value.

Surface Mode Description
Geometric Return the information from the actual geometry.
Smoothed Return the information by taking into account smoothing approximation (typically for polymeshes or displaced geometries)
Shading Return the information modified by the shading by taking into account normal and bump maps.

Outputting IDs#

The Utility Texture can be used to output object, shading group, primitive or vertex ID information from the current geometric fragment. This is very useful for example to create variations based on the IDs of your objects in your material network.

Output Mode Description
Object ID Return ID of the object in the render scene. In the event the rendered object is scattered or inside a combiner the node returns the value of the attribute of the actual object being instanced. This behavior can easily be controlled using the Parent Level attribute.
Shading Group ID Return the ID of the shading group of the geometry.
Primitive ID Return the ID of the primitive of the geometry.
Vertex ID Return the ID of the point cloud vertex the object/instance is bound to. This is only useful when objects are in a Combiner or a Scatterer.
Custom ID Return the value of the Custom ID attribute of the item. It is possible to use the Parent Level to get the value of at specific level of the instance hierarchy.

ID Output Mode#

By default IDs are output as color. It is possible to output actual raw IDs using ID Output Mode.

ID Output Mode Description
Raw Color Return the raw ID of the rendered object.
Color Coded Return a encoded color of based on the raw ID instead.

ID Color Seed#

When ID Output Mode is set to Color Coded, it is possible to use the ID Color Seed attribute to change the seed of the random generator used to encode the Object ID.

Retrieving Attribute Values#

Using the Utility node, it is possible to inject the value of an attribute to a texture network. To get the value of an attribute, just specify the name of the attribute in Custom Attribute Name. In the event the rendered object is scattered or inside a combiner the node returns the value of the attribute of the actual object being instanced.

This behavior can easily be controlled using the Parent Level attribute. Please remember that the attribute name you specify as Custom Attribute Name must be the scripting name of the attribute which is not the one displayed in the Attribute Editor. The scripting name of an attribute can be visible in the Clarisse Application Log when its value is modified.

Alternatively, you can refer to the technical reference of the documentation to see the scripting name of any objects' attributes.

Note

When the specified attribute is not found on the rendered object, the Utility node returns a pure transparent black color RGBA(0, 0, 0, 0). This is extremely useful since it is possible to use this special return value in your texture network to detect if the attribute actually exists using a Branch texture for example.

Parent Level#

Like the Instance Color texture, it is possible to use the Parent Level attribute to locate a specific object located at a specific level of the instancing hierarchy. This attribute is extremely useful when working with nested combiners or scatterers.

By default, Parent Level is set to 0 so that the node returns the information of the leaf object in the instancing hierarchy.

When set to -1, the node returns the information of the top most combiner or scatterer that owns the instance. Negative values allows you to traverse the instancing hierarchy from the top most parent to the leaf while positive values traverse from the leaf to the top most parent.

For example, if the Utility outputs Object ID on a sphere that is inside a combiner B that is itself inside a combiner A:

  • 0 will return the Object ID of the sphere
  • -1 returns the Object ID of combiner A
  • -2 returns the Object ID of combiner B
  • 1 returns the Object ID of combiner B
  • 2 returns the Object ID of combiner A

Note

Parent Level is only available when Output Mode is set to Object ID, Custom ID or Custom Attribute.