EnvRelight v1.5
This location is for Registered Users Only.
Perhaps you need to login or register.
6.1 or later
Linux, Mac, Windows
This gizmo allows an input latlong or angular (lightprobe) environment map to be remapped to create image based diffuse and specular relighting. To do this requires renders of point positions and normal vectors of a 3D scene, and a Nuke camera or RenderMan OpenEXR metadata to derive the camera position. Note that Nuke's own ScanlineRender shader outputs are suitable for relighting using this gizmo.
To use, select a surface type (diffuse or specular). This will determine whether to remap the image using the normal (diffuse) or the reflection vector (specular). Try it out with the EnvConvolve gizmo to pre-convolve a latlong environment (as shown in the images) prior to input. This will allow fully diffuse as well as glossy and specular effects. For a more naturalistic result, the diffuse lighting works well with a bent normal render.
IMPORTANT: please add the following python function to your plugin path (for example init.py). This code is used by the Relight, EnvRelight and ReProject3D gizmos to read metadata from OpenEXR files.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
def exrCam(): def getMetadataMatrix(meta_list): m = nuke.math.Matrix4() try: for i in range(0,16): m[i] = meta_list[i] except: m.makeIdentity() return m n=nuke.thisNode() hold=int(n['frameHold'].value()) camMatrix = getMetadataMatrix(n.metadata('exr/worldToCamera',hold)) flipZ=nuke.math.Matrix4() flipZ.makeIdentity() flipZ.scale(1,1,-1) transposedMatrix = nuke.math.Matrix4(camMatrix) transposedMatrix.transpose() transposedMatrix=transposedMatrix*flipZ invMatrix=transposedMatrix.inverse() n['matrix'].setValue(invMatrix[0],0) n['matrix'].setValue(invMatrix[1],1) n['matrix'].setValue(invMatrix[2],2) n['matrix'].setValue(invMatrix[3],3) n['matrix'].setValue(invMatrix[4],4) n['matrix'].setValue(invMatrix[5],5) n['matrix'].setValue(invMatrix[6],6) n['matrix'].setValue(invMatrix[7],7) n['matrix'].setValue(invMatrix[8],8) n['matrix'].setValue(invMatrix[9],9) n['matrix'].setValue(invMatrix[10],10) n['matrix'].setValue(invMatrix[11],11) n['matrix'].setValue(invMatrix[12],12) n['matrix'].setValue(invMatrix[13],13) n['matrix'].setValue(invMatrix[14],14) n['matrix'].setValue(invMatrix[15],15) return |
v1.2 - Added a fix for proxy mode.
v1.3 - Added the option to grab the camera position from metadata if the input image is an OpenEXR rendered from a RenderMan renderer such as PRMan or 3Delight. Big thanks to Ivan Busquets for sharing the knowledge about nuke.math!!
v1.4 - Fixed a bug which caused anything being executed (like a render or a CurveTool) to be interrupted. As a result, the EXR metadata Python function has been moved to the init.py. The default orientation of a lightprobe (angular map) environment has also been changed to match the latlong orientation.
v1.5 - Fixed the issue where the Python matrix calculation was still occurring if the metadata option was not selected. Also, knobs are now enabled/disabled depending on the usage context although this isn't working all of the time for some reason.
Comments
cheers,
Jason
Thank for the share !
cheers,
Luc
Looks great, would you be able to post the source material that you are using? The teapot normals + point and the latlong?
Be very useful, cheers!
Scott.
Frank has uploaded the teapot AOV render (with camera metadata) in the footage download area, and the environment map can be downloaded from the ICT graphics lab webpage http://gl.ict.usc.edu/Data/HighResProbes/
Michael
Scott.
There are a few things that could do with fixing/updating , which I hope to do soon. At which point, I can look at uploading example files.
Thanks,
Michael
RSS feed for comments to this post