---
title: "Relighting Using World Position and Normal Passes"
canonical: "https://documentation.chaos.com/space/VRAYNUKE/110625549/Relighting%20Using%20World%20Position%20and%20Normal%20Passes"
format: markdown
---
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**

---


** **> Macro (anchor)

** **

## **Part I: Setting up the Render Elements**

---

In this first section we set up the Render Elements we need for the [last section](https://docs-chaos.atlassian.net/wiki/spaces/VRAYNUKE/pages/110625549/Relighting+Using+World+Position+and+Normal+Passes#RelightingUsingWorldPositionandNormalPasses-compositeREs). 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).


![image](media://3990bc30-4d54-4c17-aa8a-3d8456a08818)



### **Set up the Scene**

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

![image](media://8e042b51-87e6-4381-a0f4-c86b693ff674)



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.*

![image](media://ef44468f-44d3-4117-a4d7-3497e227bcda)



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*.


![image](media://a66c8888-7e41-488d-98f4-1e9878fd7f73)



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


> Macro (inline-media-image)

  
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.


![image](media://45199f01-ab19-4cf5-8400-8cab1ea92829)

  
 

> ℹ️ 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.


> Macro (anchor)



## **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.


![image](media://fda988bd-55fa-4702-bc1c-1a45ecf4a8f1)



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](https://docs-chaos.atlassian.net/wiki/spaces/VRAYNUKE/pages/110625549/Relighting+Using+World+Position+and+Normal+Passes#RelightingUsingWorldPositionandNormalPasses-renderREs).

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*.

![image](media://abb15c2a-18dc-4767-8659-366be95dfbeb)



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

![image](media://03f1c794-8db4-449c-ba8e-c7a3d8639a83)



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.


![image](media://8bb3c734-f155-4a7b-aa33-1c4cd64ef72b)



> ⚠️ 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.