This page provides a QuickStart guide to using V-Ray Materials and Textures in Nuke.
In this tutorial we are going to show V-Ray for Nuke’s ability to generate a rendered element. We’ll also take a look at the VRayMaterialPreview node and how it can be used to rapidly develop the look of a shader using just the VRayMaterialPreview node and a VRayMtl node or shading network that you create, without having to set up an entire scene.
To follow this tutorial, you will need to have the V-Ray for Nuke plugin installed. This tutorial is a companion to go along with the QuickStart video posted on our YouTube channel.
To download the files used in this tutorial, please click on the button below.
Due to licensing issues, the Road_A.hdr file used in the tutorial video is not included in the downloadable assets. Instead, please use one of the provided HDR images in its place.
1) Developing VRay materials using the VRayMaterialPreview node
A very useful feature of V-Ray for Nuke is the VRayMaterialPreview node. This allows us to develop the look of a material within Nuke when connected to just a VRayMtl node, without having to set up a complex scene.
Within the VRayMaterialPreview node, the defaults (with no VRay material connected) provide us with a dome light and the Forest HDR connected using preview geometry of a sphere. The preview geometry can be changed for any of a number of different types via the Geo dropdown.
In a similar way, we can change the HDR used to any of a number of presets via the HDR dropdown, and the entire HDR can be rotated using the Light Rotation slider. We can also change the Format via its dropdown from the default setting of 128x128 to a higher resolution such as 256x256 or 512x512 so you can see more detail.
VRayMaterialPreview Default settings
Let’s change the geometry to cloth by selecting Cloth from the Geo dropdown box. Also change the HDR via the HDR dropdown box to Sunset2, and finally set the preview to a higher resolution by changing the Format dropdown box to 512 x 512. We can also rotate the HDR by changing the value on the Light Direction slider to -41.
2) Adding a VRayMtl node
You can use the VRayMaterialPreview to preview and help us develop a V-Ray material. Create a VRayMtl node and connect it to the material slot on the VRayMaterialPreview node. This simple, fast setup aids in developing the look of a material without your having to set up any other nodes.
VRayMaterialPreview node properties
Click the VrayMtl1 node and change the Diffuse Color values to 1, 0.25, 0.25, and 0.5. The change is represented in the VRayMaterialPreview render using both the selected HDR (complete with the rotation we set) and the Cloth geometry that we set in the Geo dropdown.
VRayMtl1 Main tab properties
Move to the Reflection tab and change the Reflection Color value to 0.5. This change is also represented in the VRayMaterialPreview render.
This is just one simple example; the VRayMaterialPreview node can also develop complex V-Ray materials.
VRayMtl1 Reflection tab properties
3) Setting up the main scene – Starting the basic setup
We need to set up the basic node setup before moving on to the VRay Materials. This is the same basic scene that we created in Quick Start Tutorial 1.
Create a VRayCamera and set all three translate values to 2500. In the rotate values, set x to -45 and y to 35. This will enable you to see the geometry when you load it.
Next, create a VRayRenderer node and connect the Cam connector to the VRayCamera that you just created. Then create a Scene and connect the VRayRenderer to it.
You’ll need a light in the scene so you can see how light affects the material. Create a VRayLightDome. Next, create a Read node (shortcut key: R) and browse for the file Road_A.hdr supplied with this tutorial. Connect the Read node to the tex input of the VRayLightDome so it uses the HDR to light the scene. Then connect the VRayLightDome to your Scene.
Basic Starting Scene Layout
The next step is to load the geometry. Create a VRayProxy node and browse to the sphere_and_frames.vrmesh geometry. This geometry has UVs already created for it, and the texture maps used later in this tutorial are supplied. Connect the VRayProxy node to your Scene.
Next, adjust the VRayCamera values in the Projection tab of the VRayCamera properties. Set the horiz aperture to 35 and the vert aperture to 24 .
You can now see the geometry through the camera in the render being lit by the HDR that is acting as texture to the VRayLightDome.
Basic Scene Layout With VRayProxy loading the Geometry
4) Adding materials and assigning them to the geometry
Add an ApplyMaterial node directly under the VRayProxy node then create a VRayMtl node and connect this to the ApplyMaterial node. Under the Node tab for the VRayMtl1 node type Rust in the label text field to denote that this will be the rust material.
Create a second VRayMtl node for the metal material, and enter Metal as the label. Create another ApplyMaterial node under the first one and connect this to the VRayMtl2 node you just created. In the ApplyMaterial1 node set the filter dropdown box to name, click choose, and pick frames_VRayMaterial2. This means that VRayMtl2 is now only applied to these parts.
Click the ApplyMaterial2 node and in its properties set the filter dropdown box to name, click choose, and pick sphere_VRayMaterial1. This means that VRayMtl1 is now set to be on that geometry.
5) Modifying the Materials
Now it’s time for us to modify the materials. First, let’s change the VRayMtl1 (the Rust material) by clicking it, going to its properties, and setting the Diffuse Color values to 0.123 in the red channel, 0.06 in the green channel and 0.027 in the blue channel.
VRayMtl1 (Rust) Properties – Main tab
Swap to VRayMtl2 (the Metal material) and set the values in its Diffuse Color to 0.018 in the red channel, 0.004 in the green channel and 0.0036 in the blue channel. You should now see these changes reflected in the render.
Now it’s time to make some changes. Go to the Node tab of VRayMtl2 and change the label to Paint instead of Rust. Then change the RGB values of its Diffuse Color to red 0.0029, green 0.057 and blue 0.29.
VRayMtl2 (Paint) Properties – Main tab
VRayMtl2 (Paint) Properties – Reflection tab
Create another VRayMtl node (VRayMtl3) and in the label field of the Node tab, type in Metal. Set the Diffuse Color in the Main tab to values of red 0.1, green 0.1 and blue 0.1.
One of the powerful capabilities of V-Ray for Nuke is the ability to blend materials. To see how this works, create a VRayBlend node and connect VRayMtl1 (Rust) to the B input and VRayMtl2 (Metal) to the A input.
VRayMtl3 (Metal) Properties – Main tab
Create a Read node and bring in the bombLink.1101.jpg texture and the sphere_mask_2.jpg texture so you can use them within the materials. Take the mask connection on the side of the VRayMtlBlend node and connect this to the bombLink.1001.jpg texture. This texture will then act as a mask between the two materials.
The metal material is not quite reflective enough so let’s modify its settings by clicking on VRayMtl3 (Metal) and setting the Reflection Color in the Reflection tab to a value of 0.7. Set the Reflect glossiness to a value of 0.8 to make the reflection on the metal material blurrier. These settings contribute to the metal looking more realistic.
VRayMtl3 (Metal) Properties – Reflection tab
Let’s add some bump to the material by adding a VRayMtlBump node under the VRayMtlBlend node and connecting it to the bombLink.1101.jpg texture. To make the bump less aggressive, click the VRayBump node and set the Bump Mult to 0.2.
Copy the VRayMtl3 (metal) material and paste a copy into the scene, ensuring that it’s not connected to anything else. Add a VRayMtlBlend and connect VRayMtl (Paint) to its A input and VRayMtl4 (Metal) to its B input. Drag the mask arrow from the side of the VRayMtlBlend node and connect this to the sphere_mask_3.jpg texture. When you need to swap the inputs of a node you can do this by using the hotkey Shift + x. Swap the inputs and you’ll see that the scene now shows a worn paint effect.
Let’s change the values on the VRayMtl4 (Metal) node by going to the Main tab in its properties and setting the Diffuse Color to a red value of 0.018, a green value of 0.004 and a blue value of 0.00036. In the Reflection tab change the value of its Reflection Color to 1 and change the Highlight glossiness value to 0.7. Below the VRayMtlBlend add a VRayMtlBump node and connect this also to the sphere_mask_3.jpg texture. Below the VRayMtlBump add a VRayMtlWrapper node and under the Material ID section set the Multimatte ID to a value of 2.
The scene layout up to this point
6) Adding Render elements
Add a VRayRenderElements node and connect it to your Scene. Set its Render Element dropdown box to Multi Matte and change the value of Red object ID to 1, and Blue object ID to 2. Make sure that you have the Use material IDs checkbox enabled. This will populate the multimatte pass later.
VRayRenderElement Multi_Matte Properties
Let’s add some more VRayRenderElements nodes to the scene. Create another VRayRenderElements node and once again connect it to the Scene, but set the Render Element dropdown box to Reflection.
Create a third VRayRenderElements node and once again connect it to the Scene, but set the Render Element dropdown box to Diffuse.
Create a fourth VRayRenderElements node and yet again connect it to the Scene, but set the Render Element dropdown box to Specular.
Lastly, create a fifth VRayRenderElements node and again connect it to the Scene, but set the Render Element dropdown box to ZDepth. Set its Depth White value to 1 and make sure the Depth Clamp checkbox is disabled.
VRayRenderElement ZDepth properties
In Nuke, you can now see all the channels for V-ray render elements that you have just set up. To keep the Nuke script looking clean and tidy, put another Scene in between the main Scene (Scene1) and arrange the render elements as shown below.
The final Scene layout
Once you have a set of V-Ray render elements that you like, you can group these into a ToolSet for use in another Nuke script. Select the VRayRenderElements nodes and the Scene2 Scene, and on the toolbar at the side click the ToolSet icon and click Create. This will bring up a dialog where you can give this group a meaningful name. Type in VRayChannels as a descriptive name for the grouping.
If you now delete your VRayRenderElements and Scene2 node, you can test this ToolSet by pressing Tab and typing in the name of the grouping, then connecting it back to the main Scene. We can, of course, change the Multi_Matte values if we ever need to do so.E
The final render
In this tutorial we have taken a look at the VRay material preview node, built an entire scene from scratch, and learned how we can blend and control materials using textures and values on geometry we read in using a VRayProxy node. We’ve also taken a look at setting up VRayRenderElements and learned how we can create a ToolSet for later use in other Nuke scripts.