Compositing in Nuke

Hello everybody, my name is Narek Gabazyan. I want to present a tutorial on rendering layers of objects (in this case, a car) and compositing them in Nuke. The rendering will be done in 3ds Max with V-Ray and the compositing in Nuke.

Why Compositing?

Why not? It gives us the freedom to work on each layer separately (diffuse, reflection, refraction, highlights, global illumination, separate objects and materials etc). It is necessary to consider some aspects of how this differs from simple rendering:

• The render must be done in less contrast
• Avoid too much brightness
• Don't use pure white and black in the materials.

Modeling

I don't plan to focus on the modeling because there are a lot of tutorials on this topic. As you can see, I've chosen to model the Pontiac GTO65 (Fig.01 - 02).

Fig.01

Fig.01

Fig. 02

Fig. 02

Here's the finished model (Fig.03). Of course, I've made a few changes such as lowering the landing and changing the rims. The other parts are as close to the originals as possible, based on the information I've gathered from my references.

Fig. 03

Fig. 03

Setting the Stage and Illumination

We're going to make a studio render, so we need to start by searching the internet for references that will help us to understand how to set the lighting and get the desired photorealistic image of a car in a studio (Fig.04). Learning this kind of necessary and useful theory that concerns your project is something I'd recommend to all beginners.

Fig. 04

Fig. 04

Now we can move on to the creation of the studio and the studio lighting. The studio is a simple L-shaped model and the modeling is not going to be difficult. Make an L-shaped spline and apply Extrude to it (Fig.05).

Fig. 05

Fig. 05


As we are already acquainted with the theory behind creating a studio, we know we need a black room, light sources and reflectors. As each car is an individual on its geometry, accordingly there is no universal scheme of source. The main thing is to understand how the light, reflection and refraction work.

Set up Gamma by going to Customize > Preferences > Gamma and LUT (Fig.06).

Fig. 06

Fig. 06

As we can see, we're rendering with Gamma 1.0, because this is not an interior and we need to set the light according to the effect we desire. The next step is to set the light itself. I've used a VRayLight, a TargetDirectionalLight and a box with a VRayLightMtl. In Fig.07.1 - 07.2 you can see the location of the light sources and reflectors. Please note that the positions and degrees of rotation of each of the light sources need to be adjusted for each camera. This will take some experimentation and trial and error.

Fig.07.1

Fig.07.1

Fig.07.2

Fig.07.2

In Fig.08 - 10 you can see the settings for each light source.

Fig.08

Fig.08

Fig.09

Fig.09

Fig.10

Fig.10

We can see the number of the light source in the scheme and parameters. However, the illumination depends on the mood and what and how we imagine it.

Materials and Textures

The materials used in the scene are simple. Let's run through the main ones:

Body Material

The body material is, of course, shellac (Fig.11). The base material has the following settings, with any that I haven't mentioned set to the default:

• Diffuse: 5/5/5
• Reflect: 247/247/247
• Fresnel reflections: On
• Refl. Glossiness: 1.0

Fig.11

Fig.11

The shellac material has the following settings, with any that I haven't mentioned being set to whatever you wish:

• Diffuse: 0/0/0
• Reflect: 92/92/92
• Fresnal reflections: On
• Refl. Glossiness: 0.8
• Shellac color blend: 100

Tire Material

The tire material is a VRayMtl (Fig.12) and has the following settings, with any that I haven't mentioned being set to whatever you wish:

• Diffuse: 10/10/10
• Reflect: 25/25/25
• Fresnal reflections: Off
• Refl. Glossiness: 0.45
• Subdivs: 12

Fig.12

Fig.12

As I have only modeled only the protector, the labels on the side can be obtained by using a VrayDisplacementMod. Assign a UVM Mapping (Planar) modifier to the tire. Then assign a VrayDisplacementMod modifier and set the type to 2D mapping (Landscape). To the texture map, place textures with labels and pictures of the side of the tire (Fig.13).

Fig.13

Fig.13

Chrome Material

The chrome material is our standard VRayMtl with the following parameters (Fig.14):

• Diffuse: 59/59/59
• Reflect: Falloff (190/190/190 and 253/253/253)

Fig.14

Fig.14

Glass Material

We need to create the glass thickness. It is easy to do with the Shell modifier. Use the following settings for the glass material (Fig.15):

• Diffuse: 5/5/5
• Reflect: 255/255/255
• Fresnel reflections: On
• Refract: 250/250/250

Fig.15

Fig.15

Headlight Material

The headlight material is a bit diffcult. We will need to prepare the bump map in advanced to get the correct roughness (Fig.16).

Fig.16

Fig.16

Studio Material

The last material that we'll consider is the material of the studio. I have a blue studio, so the GI of it badly influences the car. I can solve this by using VRayOverrideMtl and putting in GI VRayMtl, which solves the problem (Fig.17).

Fig.17

Fig.17

Render and Render Elements Settings

Set out the resolution with which we want to render. It is 2000 to 1335 pixels. In the VRay tab, activate Frame Buffer, assign a saving location and file format. Here are the settings you should have (Fig.18):

• OpenEXR 32-bit/Channel
• Image Sampler: Adaptive DMC
• Antialiasing: VRaySincFilter
• Color Mapping > Type: Reinhard

Fig.18

Fig.18

Let's turn to the Indirect Illumination tab. Turn on GI, put the Irradiance map on the Primary bounce and the Light Cache on Secondary bounce. You can see the details in Fig.19.

Fig.19

Fig.19

In the Settings tab set Adaptive amount to 0.75 and Noise Threshold 0.005. The other options stay on their default setting (Fig.20).

Fig.20

Fig.20

And finally let's look at the Render Elements tab. Click on Add and add the following elements:

• VRay lighting -lighting pass
• VRay_GlobalIllumination - Global Illumination pass
• VRay_Reflection - reflection pass
• VRay_Refraction - refraction pass
• VRay_Specular - specular pass
• VRay_Self-Illumination - self-illuminated materials pass
• VRay_RawTotalLighting - a pass from where we are going to take shadows
• VRay_RawReflection - this will be used to strength the reflections
• MultiMateElement - a pass for the correction of "ID material". To assign an ID to the material, we need to select any other number than 0, in the drop-down button Material ID Channel of the Material Editor.
• VRay_ZDepth - DOF effect pass. We should indicate the primary and final distance for calculation.

The number of passes may be more; everything depends on the project. It is also necessary to have an Ambient Occlusion pass. Create a VRay2SidedMtl. Put VRayLightMtl in both slots. In the top slot set VRayDirt, with a radius of about 30, subdivs of 16 and ticking "ignore" for the GI. Leave Translucency black and turn off GI and all the light sources. Put our material on Override mtl in Global Switches. This will result in us having an Ambient Occlusion pass.

Compositing

Next it's time for the compositing, and we'll be using Nuke for this. There are certainly other programs that you can use, all with their own benefits, but I prefer Nuke. We'll also be working with nine layers for this piece (Fig.21).

Fig.21

Fig.21

Open Nuke and start working. First, assign the project settings (Project Settings >Edit > Project Settings, or a hot key (S)). On the right side of the screen we can open a tab where we can change or set parameters. From the menu full size format option you can select the format of a project if you have it, but for now we're going to create a new one. Choose New and a new format window will appear where we can specify the size (2000 to 1333 pixels in the File Size line) and set the project name (Pontiak_GTO65) to avoid misunderstandings (Fig.22).

Fig.22

Fig.22

Nuke works with image and video files through links. Let's load our passes. We do this through a Read node. From the Tool bar, which is on the left side, select Image > Read, or use the hot key (R), or press the Tab key and type Read. A Read File(s) window will appear, which is where we can specify the file path (Fig.23).

Fig.23

Fig.23

First, load VRay_Global Illumination and VRay_Lighting. We need to use the Merge node to connect these two passes. In the Tool bar go to Merge > Merge, or hit hot key (M). These three options can be applied to all nodes, so we don't need to repeat it each time. I will use the option from the Tool bar. The Merge node has channels A and B. The basic picture should be loaded into channel B, and the picture to be added should be loaded in channel A. By holding the arrows and moving them to our passes we get the image shown in Fig.24, but in the Viewer window the image is black.

Fig.24

Fig.24

In order to see what we've got, we need to go into the Viewer node, which you can do by going to Image > Viewer node or selecting the Merge node by pressing 1. The Viewer 1 node can be connected to several other nodes and can be switched via the keyboard by pressing the required number. Whatever number we press, that node will be displayed in the viewer (Fig.25).

Fig.25

Fig.25

But there are problems with the picture; they are bright and Viewer 1 and 2 have the same image. Let's try to understand. We need to change all the Read color space nodes from Linear to sRGB. And in the Merge node, change the operation from over to plus, which is default, because, according to the formula, these two passes should be added (Fig.26).

Fig.26

Fig.26

Now everything is arranged, and we can continue. In order to have access to the settings of any node, we must double-click on it and then on the Node Graph. Then, on the right-hand side, on the Properties tab a window for editing the parameters will appear. By default, we can simultaneously have 10 open windows. However, we can change the number by changing the number from 10 to the desired number, or close them all by clicking the cross next to the figure (Fig.26).

Here are a couple of more tips. According to the standard setting, Ctrl + Z brings you back one step, in the order that the steps have been taken. In each node, as you can see in Fig.27, there are icons that take you back a step, forward a step, or return to the settings the file had when it was originally opened.

Fig.27

Fig.27

Nuke with OpenEXR files, obtained via V-Ray, works slowly. We can resave them through Nuke in OpenEXR, which will speed up the rendering process in Nuke. Scrolling on the mouse zooms in and out, and if the mouse is pressed it can be moved in all directions.

Another useful shortcut (D) makes the selected node inactive. For example, we have applied a color correction, and we want to see our image with and without effect. Select a node and press D to make the effect inactive, then press D again to make the effect active again. Add Refraction and Specular passes, like the previous ones (Fig.28).

Fig.28

Fig.28

We do not have Self Illumination from the formula, so let's move to Ambient Occlusion, also connecting this to pass, but with the Multiply operation. I lowered the impact of Ambient Occlusion a bit with the Mix slider by putting in a value of 0.9. The slider is at the bottom of the Merge node. We must only add Reflection with operation set to plus. And with this the Pontiac is almost ready. It only remains to add RawTotalLigthing with the operation set to overlay and a Mix value of 0.6 (Fig.29).

Fig.29

Fig.29

I like the image, but the lights are dark. It is necessary to lighten it. We have previously saved a mask for the headlights, which we will use. After the Merge node (overlay) we are going to add a ColorCorrect node (hotkey C or Color> ColorCorrect). If we select Merge, and we add a ColorCorrect node, it immediately connects in after it; if not, then just drag the arrow from Merge to the Viewer or from the Viewer to Merge. Set the following setting for the ColorCorrect node (Fig.30).

Fig.30

Fig.30

This had made the whole scene change in gamma, but we only need lights. Connect our headlight mask with the ColorCorrect node. Drag the triangle on the right to our mask pass; it is considered for mask channels. The effect is 0. We must set the ColorCorrect node from where it will take the mask. In the settings window of the ColorCorrect node, go to the Ranges tab and in the mask line choose rgba.red. This will mean that the mask will be taken from the red channel (Fig.31).

Fig.31

Fig.31

I want to add a bit of a glow effect to the lights. Everything is done as with the ColorCorrect node and the settings can be seen in Fig.32.

Fig.32

Fig.32

All that remains is to add a DOF effect, aberration, noise, vignetting, and do some final color correcting. We could do this in Photoshop via plugins, but we're going to do it in Nuke instead. For the DOF effect, we have a ZDepth pass. We need to add the ZDepth pass as an additional channel. Do this with a ShuffleCopy node. Connect input 2 with Glow, and input 1 with our ZDepth pass. In the parameters dialog box of the ShuffleCopy node, from the list, choose "new" (Fig.33).

Fig.33

Fig.33

In the New Layer window, set a unique name for the new channel (ZDepth). The channel names are very important in Nuke. It is necessary to avoid duplication, so give them meaningful names so that you can find them easily. Click on the rgba below Auto. In the Channels lines will appear: red, green, blue, alpha etc. Erase all except the red one. In the settings tab of the ShuffleCopy node, put crosses in according to the scheme shown in Fig.34.

Fig.34

Fig.34

The logic is that we have rgb (Pontiac) in the second channel, and in the first channel we have a black and white map of the depth of the scene (ZDepth). The depth channel is transferred into the red channel and is added to the basic rgb channels.

And now in the Viewer tab from the drop-down menu besides rgb we also have a ZDepth channel (Fig.35).

Fig.35

Fig.35

Now we can add a ZBlur node, by going to Filter > ZBlur, and get the effect of blur depth (Fig.36).

Fig.36

Fig.36

We can see that the whole scene is now blurry. We need to set the channel, which will be a basis for blurring, by selecting from the drop-down list. We use ZDepth.red. Activate the focal-plane setup; it will help us to understand where the image will become sharp and where blurry. The viewer will turned blue (Fig.37).

Fig.37

Fig.37

By changing the value of the focus plane (C) and depth of field, the screen color will change and red and green areas will appear. Green areas correspond to areas of the image where it will be sharp, red to the transition area, and blue to the blurry areas of the image (Fig.38).

Fig.38

Fig.38

Turn off the focal plane setup and you'll see that the background is blurry and the rest is sharp. This is what we wanted (Fig.39). By increasing the value of the size parameter we can increase the effect.

Fig.39

Fig.39

Add aberration. To get two channel flows, in one stream remove green, and in the other remove red and blue, then apply transformation. Add a Remove node to a scene (Channels > Remove node). From the drop-down menu, select rgb and select green. In this flow, only green is left. Copy the Remove node and connect it with the ZBlure node. Turn on green, and turn off red and blue. In this flow we have removed the green. Now we need to connect our flows using Merge (operation set to plus) (Fig.40).

Fig.40

Fig.40

We need to apply a Transform node (T). Move and resize this a little bit (Fig.41).

Fig.41

Fig.41

Add noise by going to Draw > Grain. From the preset, I've chosen Kodak GT5274. I like it, but I've reduced the grain and the effect noise (Fig.42).

Fig.42

Fig.42

Also we need the effect of vignetting. Add Draw > Radial and set the size to 2000 x 1333. Through Merge, set the operation to overlay and mix to 0.70 (Fig.43).

Fig.43

Fig.43

As well, add ColorCorrection with the following settings (Fig.44).

Fig.44

Fig.44

We need to save everything in one file with the help of Image > Write. We must specify the path and format, and set the frame rate to 1-1 for the render, then everything is ready (Fig.45).

Fig.45

Fig.45

The whole scheme can be used for other angles (Fig.46).

Fig.46

Fig.46

And that's the end of the project. I hope you found this tutorial useful. Nuke is a good option for rendering and compositing - it's all just matter of taste and preference. Good look and thanks for your attention (Fig.47).

Fig.47

Fig.47

Fetching comments...

Post a comment