ReProject3D v1.1
This location is for Registered Users Only.
Perhaps you need to login or register.
Contributor: Michael Garrett
Camera projection like Project3D, but as a "post process" using a render of point P data.
Requirements:
6.1 or later
Linux, Mac, Windows
6.1 or later
Linux, Mac, Windows
23 Oct 2010
2181
This gizmo enables arbitrary camera projection (similar to Project3D) on to a render of point P data in world coordinate space. That is the same format as output by the ScanlineRender node (named "surface positions" in the shader tab). What the gizmo does is generate UV coordinates using the point P data and the camera projection, then internally uses STMap to remap the input image that you want to project. To derive the camera transform and projection used to make the UV coordinates, it can use a Nuke camera or embedded OpenEXR metadata from a RenderMan renderer such as PRMan or 3Delight.
It also allows for the projection to be shadowed ("occluded") from the point of view of the projecting camera. That means that only surfaces visible to the camera will receive the projection. As you go further off axis with the viewing camera, the effect is more evident. A feature like this can be used to see what needs to be painted in when doing a stereo conversion, or what gaps need to be touched up when projecting a matte painting. Generally the P shadow input will be a static image.
Note: the default RenderMan OpenEXR camera data does not embed the filmback dimensions or the focal length. However, the projection only requires the image aspect ratio and the ratio of the filmback width to the focal length, which is embedded in the metadata - so the derived focal length is proportionally correct to the aspect ratio. There is also the option to generate a Nuke camera from the metadata so any settings can be overwritten if necessary.
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.1 - 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.
Please login in order to download these files.
Comments
awesome tool michael
... Because inside the gizmo there is a Shuffle1 node that contains an expression in the User tab referencing the third input which I guess is the dot, not the camera:
[input [node this.parent] 3].focal
But otherwise a great little gem.
Thanks!
RSS feed for comments to this post