How do we generate a 4x4 matrix from a card and a camera to use in 2d nodes 
like cornerPin/roto/etc that can all be driven by 4x4 matrices. ?
-the resulting matrix from my code below can kernal an input 3d point to 2d 
i.e. like rendering, but that's not what i want.. 
-p.s. i don't want to do this by calculating the vectors of the x4 x/y points 
and then subsequently generating the matrix from those x4 x/y points. Can't 
this projection mapping be done directly, matrices to matrix?


def getMatrixFromNode(node):
  nodeMatrix = nuke.math.Matrix4()
  knobname = 'matrix'
  for x in range(node[knobname].width()):
   for y in range(node[knobname].height()):
    nodeMatrix[x*4+y] = node[knobname].value(y,x)
 return nodeMatrix

card=nuke.toNode('Card1')
camera=nuke.toNode("Camera1")
cardMatrix = getMatrixFromNode(card)
cameraMatrix = getMatrixFromNode(camera)
projectionMatrix=nukescripts.snap3d.cameraProjectionMatrix(camera)

result=cameraMatrix*cardMatrix*projectionMatrix #this is the bit that is wrong
cornerPin=nuke.toNode('CornerPin2D1')
cornerPin['transform_matrix'].setValue(result)



_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to