Change Language:
Export camera from Houdini to Nuke using EXR - Datsyk Mykhailo
View Sidebar
Export camera from Houdini to Nuke using EXR

Export camera from Houdini to Nuke using EXR

January 29, 2014 12:13 am0 comments

It has always been a big problem to move the camera from Houdini to Nuke. All attempts to use the fbx, for some reason, always lead to failure, flipping axes coordinate directions and the wrong animation.

I've seen a lot of scripts export camera from Maya, Blender etc., but I work in Houdini and decide to make a handy tool for this.

The main impetus for me was the opening of opportunities for data storage in exr files. Exr is major image format I'm working with. I thought, when rendering the picture for the composite immediately with information about the camera, and read it in Nuke. This eliminates problems with mismatched versions of the camera and render, as. each frame will be up-to-date information on, which camera was calculated from.

After reading a bit about transformation math in Houdini, and often we have difficult animation of camera, using Aim or additional nodes, I realized that to solve the problem of transferring the camera I need to use the matrix transformation. In any 3D software, which is relevant to the calculation of the 3D position and rotation in space is described as a matrix transformation(they are the world's(worldMatrix) and local). Euler coordinate system gives us a clear understanding of the visual process of working with 3D object, but when you export data from one package to another, much easier to use matrix, which enable us to to obtain the object's position and rotation(squeeze and scale(for solid objects important data but not for the camera)) not dependent on, how we've been working on it for the movement or position. We can always convert the matrix and obtain any component of the transformation(transform, rotate, scale…)

I will not dive into the mathematical aspect, if you are interested to explore more, below I have brought materials that I have used:

Process

Houdini:

For, record the camera in exr we need to create expression in Mantra Node, in field “exr / comments” write the matrix position in world coordinates, Focal Length and Aperture selected camera in mantra node. It looks like this:

cam_exp_mantra

`pythonexprs("hou.node(hou.parm('camera').eval()).worldTransform().asTuple()")``pythonexprs("hou.parm(hou.parm('camera').eval()+'/focal').eval()")``")"``pythonexprs("hou.parm(hou.parm('camera').eval()+'/aperture').eval()")`

For ease way, I made a shelf, which, if necessary, fill in this field for me:

cam_exp_mantra_shell1 cam_exp_mantra_shell2

Nuke:

To create a camera in Nuke based on the recorded data we, execute script, which reads each frame, during the interval of all sequence, set animation key into camera.

In practice, it looks like this:

1. Execute script:

nuke_res

2. Obtain a camera with animation:

nuke_res2nuke_res3

Link on Github:

Leave a reply


Trackbacks