Square Enix © Goodbye Kansas

Table of Contents

This tutorial shows how to create a UV pass using the Sampler Info render element. 



Using UV passes you can replace objects' texture during compositing without the need to re-render the scene.

In this step by step guide, we show how to create one or multiple UV passes using the Sampler Info render element in Maya. The UV pass holds information for all objects where the UV channel has the same name, so we use a mask to separate them and apply texture only to the needed object.

For that, we export an .exr file and show a simple workflow on how to make masks in Nuke with the help of the Cryptomatte render element.

The Cryptomatte render element is not mandatory - any other masking/matte channel can be used, such as the Multi Matte or Object ID (RE) render elements.




Setup in Maya

Step 1: Add Sampler Info

Add the Sampler Info render elements from Render Settings > Render Elements.

In the Extra Attributes rollout, select the UVW Coordinates option for Type.


Step 2: Add Cryptomatte Render Element

Add also the Cryptomatte render element to the scene.

Using the Cryptomatte render element makes it easy to get an object mask without any additional work. However, you need to have the Cryptomatte plugin in Nuke to work with it.


Alternative Step 2: Multimatte


If you don't have the Cryptomatte plugin, here is an alternative setup in Maya using Multimatte render element.

  1. Choose the object(s) you want to mask.
  2. Go to Attributes > V-Ray and select Object ID.
  3. Set an Object ID for each of the selected objects.



4. Go to Render Settings > Render Elements and add the Multimatte
5. Input the object's ID as one of the RGB IDs.



Step 3: Image Format


Go to the Common tab of the Render Settings and select exr (multichannel) option for Image Format.

Then you can proceed with rendering.

A standard .exr (or any other format) output can also be used, however it requires more steps in Nuke to make sure the STmap is fed with both the RGB color and the UV channel.


Setup in Nuke


Step 1: Load the multichannel exr


In Nuke, create a Read node and load the multichannel .exr.



Step 2: Load the texture map


Now, create another Read node and load the texture map.

Then, create an STmap node and set the exr node as an STmap and the texture as a source.





From the STMap properties, select the samplerInfo as a UV channel.



Step 3: Merge Node


Create a Merge node with the default Over operation and connect the A input to the STmap and the B input to the exr image.


Step 4: Adjust the position


Now we see the top image but it is not positioned where we want it.

Add a Transform node after our texture map and adjust the position to your liking.


Step 5: Cryptomatte


Create a Cryptomatte node after the .exr image and switch to it in the Viewer.




Enable the Picker Add option and while holding down Ctrl select the object(s) that need to be masked.




Connect the Cryptomatte node to the mask input of the Merge node.



Alternative Step 5: Multimatte


If you are working with Multimatte, add a Shuffle node as a mask to the Merge node.

As an Input Layer, select the multimatte from the list and connect the selected channel (red in this case) to the rgba.alpha Output Layer.




Now the texture is properly placed only on the object we want to.

Feel free to do further adjustments to your scene or render.