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
23 Oct 2010
2127
reproject3D_UI
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   

 
0 # Abhishek Chaturvedi 2010-10-14 11:29
hattsss offfffffffffff
awesome tool michael
 
 
0 # Michael Garrett 2010-10-21 17:41
Thanks! Glad you like it.
 
 
0 # Michael Garrett 2012-03-27 16:10
Note: this seems a bit broken right now but the guts of it are still sound if you can go in there and fix a few things. I will update it at some point.
 
 
0 # Andrew Rea 2016-06-24 10:23
Michael, did you ever get a chance to fix this? Looks very promising
 
 
0 # Frank Rueter 2016-06-25 00:48
What exactly is broken? I have been using this for the last few weeks with great results (I'm not using the exr cam feature though)
 
 
0 # Andrew Rea 2016-06-27 11:36
Working in Nuke 9 here, the dropdowns for surface point and surface normal under projection occlusion are missing for me
 
 
0 # Rene Jensen 2017-02-14 10:52
For some reason inserting a dot between the camera and the node causes a problem.
... 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.
 
 
0 # Michael Garrett 2017-09-01 22:26
Glad to hear it still more or less works. I have an updated Pworld project gizmo that uses a proper 4x4 matrix and has stripped out some of the features people probably don't use (exr cam and projection occlusion). It uses the nukescripts snap3d projection python module to generate a 4x4 matrix based on an input cam.
 
 
0 # Jonathan Biggins 2018-06-19 16:35
Hi Michael. Do you have this new gizmo available to download anywhere?
Thanks!
 
 
0 # Michael Garrett 2018-06-19 18:46
Hi Jonathan, unfortunately no. I haven't looked at it for a while. Hopefully I'll get around to it at some point!
 
 
+1 # Abdullah Mamun 2017-10-11 15:28
Give some tutorial how its use.......
 

You have no rights to post comments

We have 3302 guests and 95 members online