Page Contents ×

This page provides a guide to setting up and rendering the World position and Normal passes in V-Ray for Nuke and then how to use them in a composite.

 

 

Overview


In this tutorial, we will set up a Nuke script to render out World Position and Normal passes in V-Ray and then show how to composite them to enable scene relighting without having to re-render the scene.

 

 


Part I: Setting up the Render Elements


In this first section we set up the Render Elements we need for the last section. Although the scene setup we are dealing with is actually rather complex, many sections have been grouped together into a single node for the sake of visual clarity.  If required, these can be un-grouped into their original form by going to the Edit menu's Node section, then to the Group section and clicking on Expand Group (or by simply using the Ctrl+Alt+G hotkey).

 



Set up the Scene

 1.  Create two VRayRenderElement nodes. When the Select Render Element Type window appears, set its Type to ExtraTex.


 

 

2.  Connect both of these ExtraTex nodes to the REs Scene node.

3.  Name one ExtraTex node Normal, and the other ExtraTex node World_Position.




4.  Create two VRaySamplerInfo textures.

5.  Name one Normals and connect it to the Normals Extra Tex node.

6.  Name the other VRaySamplerInfo texture World_Position and connect it to the World_Position ExtraTex node.

7.  In the Normal ExtraTex, set its Output to Normal.

 

 

 

 

8.  In the World_Position ExtraTex, set its Output to Point.

 


Node graph at this point in the process


9. Create a VRayRenderElement node and set its Channel to Reflection. This will allow reflections to be part of the relighting solution later.

10. Create a VRayRenderElement node and set its Channel to Refraction. This will allow refractions to be part of the relighting solution later.

 


At this point either the output of the VRayRenderer node can be then piped into a further compositing flow, or written out as files as need be.

 

Part II: Setting up the Composite to Relight the scene  


With the render elements now present, we will pipe the VRayRenderer node passes out as needed and then composite them together to relight the scene. Relighting allows the image data from a 2D image that contains both point position and normal passes to be re-lit in Nuke using 3D lights. This means that re-rendering the 3D scene is not needed, so re-lighting a scene is far faster.

 

Render elements can also be outputted as separate images or image sequences as well as a multi-channel EXR. In some pipelines, it can be advantageous to render out as separate files for each render element, although in most cases a multi-channel EXR sequence is far easier to handle. 


Set up the Scene

1.  Create a ReLight node and pipe in the color and material inputs from the VRayRenderer node. This gives us the channel outputs just the same as if a Multi-channel EXR were being read in, but allows for changes to be made to them as part of the flow.

 

 

 

2. The ReLight node needs a camera input. At this point you can make a new camera and connect it to the cam input, or for the sake of simplicity you can reuse the already existing camera that was used for rendering out Part I.

3. Create a Scene node and connect it to the lights input of the ReLight node. Rename this Scene node Lights.

4. Create two Shuffle nodes and attach each to the VRayRenderer node.

5. Name one Shuffle node Reflection and from the in 1 drop-down select VRayReflection.


 

 

6. Name the other Shuffle node Refraction and from the in 1 drop-down select VRayRefraction.


 

 

7. Create a Merge node below the Relight node with its operation set to plus. To add reflections to the scene, connect the Reflection Shuffle node to the new node as its A input and the ReLight node as its B input.

8. Create another Merge node below the Merge node from step 9 with its operation also set to plus. Connect the Refraction Shuffle node to this as its  A input and the Merge node as its B input (this will add any refractions to the scene if they are present).

 

If the original scene contains any subsurface materials then an SSS pass would also need to be added to the ReLight composite in a similar way to the Refraction and Reflection, as would self-illumination materials. However, if a scene does not contain any of these then those passes can be safely ignored when relighting a scene.

 

Relight the scene

1.  Create a Directional Light and connect it to the Lights Scene node.

2.  In the 3D view with the Directional Light selected, position it as a rim light behind the geometry pointing downwards.

3.  Set the color of the Directional Light to a light blue color.

4.  Create a Point Light and connect it to the Lights Scene node. Position it slightly in front of the geometry using the 3D view and set its color to a green color.

5.  Create another Directional Light and connect it to the lights' Scene node.

6.  Position this Directional Light above the geometry pointing towards the back of the scene horizontally and set its color to a yellow color.

7.  Connect your viewer node to the last Merge node in the scene and balance the intensity of each of the three lights.

 

 

 

Relighting a scene in this way will not give correct reflection or refraction as these are being composited over the top of the relight image and are in no way affected by any scene relighting.



 


Original beauty pass
  



Scene relit using World Position Pass & Normals Pass