Relighting a 2D Image Using 3D Lights

The Relight node takes a 2D image containing normal and point position passes and lets you relight it using 3D lights. Essentially bypassing the need to return to a 3D application and re-render the lighting, Relight provides a quick and interactive way to relight a 3D scene in a 2D environment.

Relight works by applying a 3D shader to a 2D image using the normal and point position passes stored in separate image channels, and lets you attach and manipulate a 3D light (or multiple lights via a Scene node).

To Relight a 2D Image Using Relight

1.   From the 3D > Lights menu, select Relight to add the node to your script.
2.   Read in a 2D image containing normal and point position passes and connect it to the color input of the node.

TIP:  If the position pass and normal vectors are contained in separate images, they can be combined using a ShuffleCopy node, which connects to Relight through the color input.

You can create normal and point position passes using the DepthGenerator node in NukeX, for example. See Generating Depth Maps.

3.   In the Relight properties panel, select the channel containing the normal data from the normal vectors dropdown menu.
4.   Select the channel containing the point position information from the point positions dropdown menu.

5.   Connect a light to the lights input, or multiple lights via a Scene node.
6.   Connect the camera that was used to render the original scene to the cam input.
7.   Attach a shader (a Phong node, for example) to the material input. Depending on the type of shader you attach, ensure that you've defined the necessary properties for it. For information on defining material properties, refer to Object Material Properties.

NOTE:  The camera input does not appear until the light inputs have been connected to a light or scene node, and the material inputs do not appear until the camera input has been connected.

8.   Switch to the 3D Viewer and position your lights.
9.   If the image in the color input contains an alpha channel and you'd like to use this as a mask to limit the effects of Relight, check use alpha.
10.   If required, adjust the ambient slider to set the global ambient light level for the scene.
11.   To combine the lighting information from the Relight node with the original 2D image, use a Merge node with operation set to multiply. Connect the Relight node to the Merge node’s A input and your 2D image to its B input.