Exporting Pathed Cameras

   4718   5   0
User Avatar
Member
31 posts
Joined: Jan. 2007
Offline
Hi there,

We use Houdini's .clip file format as our standard for exported cameras, and have a number of minor plugins to handle this format for importing and exporting into other 3d packages. For the most part, our cameras only ever come from matchmoving software or from the animation package (in this case XSI) but I'm trying to create a simple OTL in the rare event that a camera has been animated in Houdini, and needs to be exported as a .clip.

Fetching the data channels (tx,ty,tz,rx,ry,rz,aspect,aperture,focal,resx,resy) and calling opsave to write out the .clip is simplicity itself, but fails in the case of a camera which is animated along a path, or has a Look At specified, due to the transformation information not being present in the data channels.

What is the simplest method for extracting the actual internal transformation of a camera, in the case that this information is not present in the t,r channels? I've tried searching the HOM documentation, to no avail, but I'm not discounting that I might just not be seeing what is in fact there.

Thanks in advance.
Facebook [facebook.com] | Twitter [twitter.com] | Google+ [plus.google.com]
User Avatar
Member
136 posts
Joined: July 2005
Offline
Try this:

obj = hou.node(“/obj/cam1”)
wtm = obj.worldTransform()
objt = wtm.extractTranslates(“srt”)
tx = objt.__getitem__(0)
ty = objt.__getitem__(1)
tz = objt.__getitem__(2)
objr = wtm.extractRotates(“srt”,“xyz”)
rx = objr.__getitem__(0)
ry = objr.__getitem__(1)
rz = objr.__getitem__(2)
User Avatar
Member
1908 posts
Joined: Nov. 2006
Offline
As well as extracting the raw transforms using HOM, you could use an Object chop set to calculate Position and Rotation of your camera. Take a look at the attached file.

When using HOM to get the actual values, you can actually do the following since the results of the extracted transforms are just hou.Vectors3 and can be accessed like standard list type objects without having to explicitly call the __getitem__ function.

obj = hou.node(“/obj/cam1”)
wtm = obj.worldTransform()
tx, ty, tz = wtm.extractTranslates()
rx, ry, rz = wtm.extractRotates()

However, as Edward pointed our below and I neglected to mention, using HOM really isn't going to get you much in the case of outputting your information to a clip file so using CHOPs is the best way to go.
Edited by - Jan. 16, 2009 10:43:31

Attachments:
obj_chop_camera.hip (70.8 KB)

Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
7722 posts
Joined: July 2005
Offline
Using python doesn't help you if you want to export .clip files. I'd just use a Merge CHOP to merge together the results from an Object and Fetch CHOP. Now just save the .clip from the Merge.
User Avatar
Member
31 posts
Joined: Jan. 2007
Offline
Thanks guys for the responses, apologies for the late follow-up. I've been doing other projects meanwhile, and just remembered that I posted this thread! ><

As soon as I get a chance to get back to it, I'll let you know how it works out.
Facebook [facebook.com] | Twitter [twitter.com] | Google+ [plus.google.com]
User Avatar
Member
31 posts
Joined: Jan. 2007
Offline
First time I've had to look at it since I asked, but yeah, the Object node was exactly the magic trick I was looking for.

Thanks, all.
Facebook [facebook.com] | Twitter [twitter.com] | Google+ [plus.google.com]
  • Quick Links