Here is the code proposed by Anto Patriarca, works like a charm : import nuke
c = nuke.nodes.Cube() sr = nuke.nodes.ScanlineRender() cam = nuke.nodes.Camera() c.setInput(0, nuke.toNode('CheckerBoard1')) sr.setInput(1, c) sr.setInput(2, cam) cam.knob('useMatrix').setValue(True) cam.knob('matrix').setAnimated() for i in range(1, 101): # recreate cube transformation cube1Mat = nuke.toNode('Cube1').knob('matrix').getValue(time=i) cubeM = nuke.math.Matrix4() for j in range(16): cubeM[j] = cube1Mat[j] cubeM.transpose() camera1Mat = nuke.toNode('Camera1').knob('matrix').getValue(time=i) cameraM = nuke.math.Matrix4() for j in range(16): cameraM[j] = camera1Mat[j] cameraM.transpose() resMat = cubeM.inverse() * cameraM resMat.transpose() for j in range(16): cam.knob('matrix').setValueAt(resMat[j], index=j, time=i) On Thu, Sep 18, 2014 at 3:08 PM, Salvador <salva...@chez.com> wrote: > Hi, > > I'm doing the previs of a shot where the camera follows a flying object > that then lands. I'll then shoot the object on a gimbal with a camera on a > technocrane. I'm trying to transpose the object and camera animation into a > single camera animation but can't manage to do it. > > Here is a very basic script where the idea would be to create an animated > camera that gives the same result without animating the object. I thought I > could invert the Matrix but as soon as I try, I get 0 in the local Matrix. > Any clue ? > > --- > set cut_paste_input [stack 0] > version 8.0 v6I have > push $cut_paste_input > Camera2 { > translate {{curve x1 -2 s0 x100 -0 s0} {curve x1 -1 s0 x100 -0 s0} {curve > x1 6 s0 x100 8 s0}} > rotate {{curve x1 5 s0 x100 0 s0} {curve x1 -15 s0 x100 0 s0} {curve x1 0 > s0}} > name Camera1 > selected true > xpos -370 > ypos -102 > } > CheckerBoard2 { > inputs 0 > format "256 256 0 0 256 256 1 square_256" > boxsize 32 > name CheckerBoard1 > selected true > xpos -260 > ypos -321 > } > Cube { > rotate {{curve x1 30 s0 x100 60 s0} {curve x1 0 s0 x100 90 s0} 0} > name Cube1 > selected true > xpos -260 > ypos -190 > } > push 0 > ScanlineRender { > inputs 3 > motion_vectors_type distance > name ScanlineRender1 > label "\[value projection_mode]" > selected true > xpos -260 > ypos -88 > } > --- > > > Salvador >
_______________________________________________ Nuke-python mailing list Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python