Switching between active camera every frame?

I have a short video clip of a bridge that I recorded that is 155 frames long and dollies from right to left. I exported each frame as a PNG file, then loaded these files into Agisoft Photoscan to process the environment into a rough 3D model. As a part of this process, it creates a virtual camera position for each still, which means that I have 155 cameras in the scene, each holding the exact real world location of the real camera in 3D space.

I’m able to export my model into Blender as a COLLADA.dae file, which imports the mesh of the bridge, but also all 155 camera positions. I want to add a 3D character walking across the bridge, so since I already have all of the camera positions, rather than track the footage to match movement, I’d like to see if there’s a way to use these camera positions.

Basically, since each camera position corresponds to a frame, I just need the Active Camera to switch everytime the frame advances (Camera001 is active for Frame001, Camera002 is active for Frame002, etc.)

Is there a way I can achieve this? I tried adding a driver to the Object box in Scene–>Active Camera, but it would let that value be driven…

LINK to my setup: https://imgur.com/a/NLxuIzY

If you have the exact locations of the camera for each frame, presumably as a vector, why not use this information to keyframe one camera to move to each location as the frame changes? This must be preferable to switching cameras every frame, since I don’t know how you are going to render the animation if you do this, other than one frame at a time.

You could also easily do this with Animation Nodes, have a list of the camera position vectors and simply move the camera to each position based upon the frame number of the animation. I can mock something up for you if you like, just let me know.

Cheers, Clock.

Thanks Clock! I think you’re right that keyframing a single camera to achieve this would be the best way. I would love to learn more about the method you describe. Currently, the blend file contains 155 cameras within the scene. How would I extrapolate each one’s position and rotation info into a list of the positions?

From Agisoft, I was able to export an XML file with all of the coordinates for each camera (which look very complicated, but I believe I’ve deduced are in a 4X4 Matrix format).

I’ve never worked with Animation Nodes before, but what you’re describing sounds exactly like what I’m trying to achieve. Do you have a simple setup you could share, or point me to a tutorial that might explain the apporach?

Thanks for your help!

I’ll knock something up this evening, it’s dinner time here and Mrs. Clockmender is not a patient person once she has sounded the dinner gong…

Cheers, Clock. :beers:


You will need to load Animation Nodes, just Internet search it while I have my dinner…

1 Like

Thank you for your help, and enjoy your meal!

You could also use the bind camera to marker workflow, outlined below from the blender manual:

Bind Camera to Marker


Editor: Timeline Editor
Menu: View ‣ Bind Camera to Marker
Hotkey: Ctrl-B

Switching cameras can be done with the Timeline operator Bind Camera to Markers by having both the camera and marker selected.

The triangle above the camera will become shaded when active.



First in the Timeline, add a set of markers used to switch cameras. Press M to add marker, then Ctrl-M to rename, duplicated markers should retain the same name.

  1. In the 3D View, select the Camera the Markers will switch to.
  2. In the Timeline, select the Marker(s) to switch to the Camera.
  3. In the Timeline, press Ctrl-B to Bind Cameras to Markers.
1 Like

This was where I first started, but became quite tedious to create a marker at every single frame and then individually select the next camera to bind at that frame. With 155 frames (and several more shots like this) I was hoping to find a bit more of an automated approach, which sounds promising with the Animation Nodes method clockmender mentioned above.

Thanks for your help!

I downloaded Animation Nodes and started playing around, and I think I found a setup that works! This add-on is amazing!

LINK: https://imgur.com/fjPflX4

Let me know if you see any areas which would help make it more robust…

Thanks for the suggestion, this is exactly what I was looking for!

Sure is! One small point, can you post the images here rather than Imgur, which uses tracking and advert targeting cookies, which I block, so I cannot see anything there.

Here is a quick throw together to bounce the camera up and down : camera.blend (591.3 KB)

Just press play and try not to get motion sickness. :rofl:

I am now thinking that you could make a group of all the cameras, then cycle through the group driven by the frame number to get the cameras location and rotation then push this onto the real camera. That would work, I’ll try that next and get back to you.

Cheers, Clock. :beers:

So I created a load of empties, as I don’t have your cameras, and used them to move the real camera with a simple node tree:

Here is the altered blend file with the new bits on the next level: camera.blend (827.3 KB)

Cheers, Clock. :beers:

1 Like

This is great, thank you so much! I didn’t know about that Sort List Node. That will be a huge help in wrangling all these cameras.