Time remap keyframed cameras

Moderators: Disciple, zlovatt

Post Reply
stweed
Posts: 12
Joined: February 18th, 2016, 2:35 pm

So I came up with a cool expression technique today that I thought I should share! I had an interesting situation where I've got a 3D render and a 3D camera that I imported from 3DS Max. I needed to time-remap the 3D render but wanted my camera to continue to line up despite the time remapping, and in the past I would have done this by manually shuffling/stretching keyframes around. However that is extremely limited and once you start using curves in your time-remap it no longer works. So using the simple yet powerful valueAtTime() function I was able to very easily solve this problem! I'll walk through how i did it with the camera, but I was also able to apply this to Null objects (which referenced 3D objects in the Max scene). You could obviously apply this to any layer which needs to "follow" the time remapping of another layer.

For simplicity create a new composition which has the "baked" 3D camera and the render:
Time-remap the video layer to whatever you need.
Duplicate the camera and delete all keyframes, turn off the original camera but leave it in the comp.
Add the following expression to the new camera's position, and of course replace the layer names to match your own:

Code: Select all

cam = thisComp.layer("Imported Camera");
timing = thisComp.layer("render").timeRemap;

cam.position.valueAtTime(timing)
The same goes for each rotation value (and anything else animated, like zoom):

Code: Select all

cam = thisComp.layer("Camera");
timing = thisComp.layer("render").timeRemap;

cam.transform.xRotation.valueAtTime(timing)

Code: Select all

cam = thisComp.layer("Camera");
timing = thisComp.layer("render").timeRemap;

cam.transform.yRotation.valueAtTime(timing)

Code: Select all

cam = thisComp.layer("Camera");
timing = thisComp.layer("render").timeRemap;

cam.transform.zRotation.valueAtTime(timing)
And that's it! You only have to time-remap one layer and your camera will automatically follow along.
Hope that's useful to someone, I'll be using it a lot.

- Spencer
_Bunamour
Posts: 1
Joined: February 24th, 2022, 1:27 pm

Thanks Spencer, you just saved me a headache! :D am saving this one.

Michael65
Posts: 1
Joined: January 14th, 2024, 2:44 am

Thanks for this. I realize the post is from years ago, but trying my luck anyways:
Would it be possible to tweak this and use it with timewarp?

Kind regards,
Micael

Post Reply