Create a ticket

Q100170: Handling Textures in Katana


Textures are handled in a variety of different ways by shader libraries and studio pipelines and Katana offers a flexible framework to assign textures, following some common conventions. 

Below is a summary of some of these options that work with the 3Delight, RenderMan and Arnold renderers. Please also see the attached example scene that demonstrates both approaches explained here.



Using material attributes to declare textures

The simplest way to give each object its own texture is to create a material per object and explicitly declare the textures as string parameters in the shader. Each object is then assigned the relevant material.

This approach is the most labour-intensive, especially when working with a scene that contains a large number of objects, and lacks flexibility when changes to a material have to be made.

Often many objects can share the same material, but need to be assigned different textures. In this case, it is possible to set up the scene so that each object picks up its own textures:


Using object attributes to declare textures

Rather than setting the texture on the material, the objects to be rendered can point to the relevant texture file via an arbitrary attribute.


Creating an example scene

The following are instructions on how to use object attributes to declare textures. This example is using the 3Delight renderer:

  1. Add a CameraCreate, a NetworkMaterialCreate, and two Pony nodes from the Help > I want a pony menu. Be sure to change the name parameter on each of the Pony nodes so they are unique.
  2. Create and AttributeSet node downstream of each Pony and set the path to the Scene Graph location of the respective upstream Pony.


  3. Edit each of the AttributeSet nodes and change each attributeName parameter to 'geometry.arbitrary.basecolor.value' and type parameter to 'string'.


  4. Set the stringValue of each AttributeSet to point to a unique texture file. You may can find example files included with Katana at $KATANA_ROOT/demos/tx_files/


  5. Jump into the NetworkMaterialCreate node (Shortcut: Ctrl+MMB or Ctrl+Enter when selected) and create a dlPrincipled and a dlTexture shading node.
  6. Edit the dlTexture node and set the Texture File parameter to '{attr:geometry.arbitrary.basecolor.value}'; this reads the file path from the attribute set previously.


  7. Connect the outputColor port of the dlTexture to the input of the Base > Color port of the dlPrincipled node and jump out of the NetworkMaterialCreate (Shortcut: Ctrl+Backspace).


  8. Select all nodes, except the Pony nodes, and press 'M' to create a merge node downstream.


  9. Create and connect a MaterialAssign node below the Merge, adding a custom CEL reference with the value '/root/world/geo//*', and setting the materialAssign parameter to '/root/materials/NetworkMaterial'. This will apply the material to all locations below the 'geo' location in the Scene Graph.


  10. Finally, create a GafferThree node downstream of the MaterialAssign and add an Environment Light from the Add 3Delight menu.

When rendering you will now see two different textures applied to the ponies from a single material.




Was this article helpful?

We're sorry to hear that

Please tell us why
2 out of 5 found this helpful