### after effect camera to Houdini

11415   17   4
Member
101 posts
Joined: Feb. 2015
Offline
Hi,
I have done a 3d camera tracking in After effects and exported it using AE3D export script. Once in houdini, I have all the position and rotation keyframes, that's fine. Unfortunately AE3D export doesn't take care of the angle of view. I used to use it with 3dsmax a long time ago, and then all I had to do is match the angle of view in degrees. But I have trouble doing the same with houdini because there is no angle of view parameter.

In houdini's help, it says that “focal length” corresponds to the “zoom” of the camera. But in AE, “zoom” and “focal length” are two different parameters ( see attach image ).
I am a little lost there. ( and pretty bad at math ….)

Could someone help me ?

Attachments:
Capture_ae_camera_params.JPG (42.9 KB)

Member
7981 posts
Joined: Sept. 2011
Offline
https://en.wikipedia.org/wiki/Angle_of_view [en.wikipedia.org]

for Angle of view, see the formula 2atan(d/2f)

In the case of houdini camera, d is the horizontal aperture, which is the width of the film back. To go from angle of view, invert the formula to d/2f = tan(theta/2). If you have a particular aperture to use, you can use the ratio to determine the effective focal length.

for instance, assume theta is 80 degrees, aperture is 36mm

d = 36
theta = 80
d/2f = tan(theta/2)

36/2f = tan(80/2)
18/f = tan(40)
18 = 0.84 f
f = 21.45mm
Edited by jsmack - Jan. 22, 2018 20:07:19
Member
101 posts
Joined: Feb. 2015
Offline
Thank you so much
Member
146 posts
Joined: Sept. 2011
Offline
Note that in AE, zoom and focal length and film size are all interlinked. You can ignore the zoom parameter - adjust the other two values and “zoom” will adjust automatically.

I created a couple of kludgy scripts to import AE data into Houdini, and export Houdini data out for AE (see https://gist.github.com/howiemnet [gist.github.com] )

The nice thing about AE is that you when you copy a bunch of keyframes to the clipboard, they're just text - you can open a text editor and paste them in to see. And likewise, as long as you keep the format the same, you can create a text file with AE keyframe data, and just paste it onto a layer… tada, keyframes.

Drop me a pm if you need further help.
Member
5 posts
Joined: Nov. 2017
Offline
Sorry Howiem, Can you explain me how to paste the coordinates of the txt in the houidini tool? thank you
Member
221 posts
Joined: July 2005
Offline
TeiBrito,

Did you read the link to the scripts howiem posted above? You need to use his script to import the data so that it creates the keyframes for you.

One simple change I would make to his script, where he has:

filename = “cameraKeyframeData.txt”

change it to:

filename = hou.ui.selectFile()

It will give you an item selector box to choose your file, rather than hard coding it.

Dave
Member
1 posts
Joined: Jan. 2019
Offline
davedjohnson
TeiBrito,

Did you read the link to the scripts howiem posted above? You need to use his script to import the data so that it creates the keyframes for you.

One simple change I would make to his script, where he has:

filename = “cameraKeyframeData.txt”

change it to:

filename = hou.ui.selectFile()

It will give you an item selector box to choose your file, rather than hard coding it.

Dave
THX for the little useful fix, but I get this error:
```Traceback (most recent call last): File "ae_camera_import", line 13, in IOError: (2, 'No such file or directory', '\$HIP/camera_04.txt')```How to fix it?
Member
221 posts
Joined: July 2005
Offline
Hey IdeaPartizan,

Do you have a file in your hip directory called camera_04.txt? If not, that is the problem. If you can't get the item selector box to work, you can hack it by hard coding your filename like howiem did.

Dave
Member
5 posts
Joined: April 2015
Offline
Hello Howiem, super script!
I imported the camera data in Houdini but now the question is: how can I align objects to the ground or other markers that where solved in After Effects if I don't have those markers in Houdini but only the camera position?
In your example you placed the elephant on the table, but how did you that without markers or table position in Houduni?

Thank you very much!
Member
833 posts
Joined: Jan. 2018
Offline
There are many things that AE is awesome at, but IMHO camera tracking ain't one of them. I also don't understand why ADOBE still refuses to have a proper FBX or Alembic import/export function like just about any other compositing software out there.

For my main purposes, I am opting to use something more robust (and free) like Blender to do the camera tracking which I can then export along with any geometry or point-cloud needed.

Also, if you ever need to track both a camera and an object moving within it (say for instance a handheld shot where a character is holding and moving a CG gun), then AfterEffects provides no way to deal with that.
>>Kays
For my Houdini tutorials and more visit:
Member
5 posts
Joined: April 2015
Offline
Yes I know, indeed I would like to move to Fusion for compositing.
However, I was wondering how Howiem did the compositing above with the elephant using his script as, after you export tha camera tracking data to Houdini, you only have camera movement and not any reference to the ground plane, where he placed the elephant.
If I understand this I would be able to use the script to add 3D elements to the scene.
Member
833 posts
Joined: Jan. 2018
Offline
For compositing you're fine in AfterEffects. However for tracking a camera and then bringing it into Houdini along with some geometry reference so that you can actually add stuff to your scene, Blender is the way to go. I'm doing this exact thing myself at the moment and I can tell you that it's just more sane to do this type of thing in Blender, and then export an Alembic file which imports into Houdini really easily and with everything in place.

Here, watch this easy tutorial on how Camera Tracking works in Blender and you'll be able to get yourself up to speed in no time:

>>Kays
For my Houdini tutorials and more visit:
Member
5 posts
Joined: April 2015
Offline
Thank you very much!!!
Member
833 posts
Joined: Jan. 2018
Offline
Also, if after doing your camera track in Blender and exporting it to Houdini, you need to bring everything back into AfterEffects (nulls and all), I created 3 tutorials which show you three different ways on how to do so fairly painlessly:

>>Kays
For my Houdini tutorials and more visit:
Member
6 posts
Joined: April 2011
Offline
ideapartizan
davedjohnson
TeiBrito,

Did you read the link to the scripts howiem posted above? You need to use his script to import the data so that it creates the keyframes for you.

One simple change I would make to his script, where he has:

filename = "cameraKeyframeData.txt"

change it to:

filename = hou.ui.selectFile()

It will give you an item selector box to choose your file, rather than hard coding it.

Dave
THX for the little useful fix, but I get this error:
```Traceback (most recent call last): File "ae_camera_import", line 13, in IOError: (2, 'No such file or directory', '\$HIP/camera_04.txt')```How to fix it?
Can you tell me how you solved this problem?
I'm getting same error:

Traceback (most recent call last): File "camera_tracker", line 13, in IOError: (2, 'No such file or directory', '\$HIP/camera.txt')
Member
3 posts
Joined: April 2015
Offline
Is anyone able to export a tracked camera from blender to houdini that actually works? I've created boxes etc and they're locked in well with the footage, but when I export the scene as an alembic into houdini the tracking is off. I put the same jpeg sequence as a backing plate and the boxes etc bounce around... Does anyone know what's going on?

Attachments:
Animation1.gif (2.8 MB)

Member
8724 posts
Joined: July 2007
Offline
make sure your fps matches and that the start frames are aligned
Tomas Slancik
FX Supervisor
Method Studios, NY
Member
3 posts
Joined: April 2015
Offline
thanks so much, for some reason offsetting the jpeg sequence in houdini by +5 frames locks it in place... no idea why that is, some setting not right in blender I guess... I'll try to find out. Thanks!