A UV pass converts UV values to R/G values and creates a rasterized version of UV space. Using a UV pass, you can replace textures in 3D renderings as a post-process, without the need to track new textures in place.
To create a UV pass for your workflow, do as follows:
- Create a pass contribution map for the object(s) for which you want to retexture.
Select your object, and in your Render Layer Editor, select Contribution > Create and Associate Pass Contribution Map.
- Open the Render Settings window; select mental ray as your renderer, and click the Passes tab. Click the Create new render pass button and select UVPass from the Create Render Passes window and click Create and Close to create the UV pass.
- Click the Associate Selected Passes button to associate the UV pass with your scene, and then with your pass contribution map.
- In the UV pass Attribute Editor, select Hold-Out. This option blacks out all other objects in your scene other than the object you are retexturing.
Ensure that Filtering is disabled.
Note: In general, it is not advisable to perform filtering on a UV pass.
- Select Embed object ID in Blue channel. Selecting this option embeds values from the miLabel attribute on shape nodes directly to float values in the empty blue channel in the UV pass.
This option allows you to separate the object(s) in your compositing software in order to make further changes.
-
Create and add the miLabel attribute to the object's shape node. Click Select in the object's shape node Attribute Editor. Then select Attributes > Add Attribute.
- Enter miLabel as the Long name and select Integer as your Data Type.
Note: You must use the name miLabel spelled exactly as stated.
You can now see the MI Label attribute under the Extra Attributes section of the shape node.
- Enter your MI Label value. To group objects, give all objects an identical MI Label.
- Under the Passes tab, click again and select Coverage from the Create Render Passes window and click Create and Close to create a coverage pass. The coverage pass provides the alpha for the object you want to retexture.
- Click to associate the coverage pass with your render layer and then with your pass contribution map.
- Render your pass using the .exr format. In the Common tab, select OpenEXR (exr) under File Output > Image format.
Note: Currently, only the OpenEXR file format is supported.
Note: Under the Quality tab, Framebuffer section, you must set your Data type to 32-bit float or 16-bit half float to avoid your image being clamped.
In your compositing software, you can then do as follows:
- use your UV pass to displace a new image into your scene's texture co-ordinates to produce a re-textured image that can be multiplied by your coverage pass and merged back into your original render
- use expressions or keying to extract the value of your blue channel and then use it to apply changes to your objects
Note:
You may want to render textures and lighting as separate passes to facilitate re-lighting in compositing. You can do so by multiplying the Diffuse Material Color pass by the Direct Irradiance pass after using the UV pass to retexture.