Create a ticket
Follow

Q100170: Handling Textures in Katana

SUMMARY

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.

 

MORE INFORMATION

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.

    mceclip1.png

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

    mceclip4.png

  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/

    mceclip5.png

  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.

    mceclip6.png

  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).

    mceclip7.png

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

    mceclip8.png

  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.

    mceclip9.png

  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.

mceclip10.png

 

ATTACHMENTS

Was this article helpful?

We're sorry to hear that

Please tell us why
2 out of 5 found this helpful