# Can I constrain an object size to Camera angle of view?

After I import "Images As Planes" (using addon) I would like to place the images in front of the camera like a rostrum, making the corners match the camera frame. Or perform the best fit of the height or sides if the images are a different shape (vertical aspect).

I know that I can set the camera to orthographic and this fixes the relative dimensions on z axis, but I want to make a objects initial scale or position fill the camera view.

This way I can always return to a 1:1 relationship without borders or overshoot.

USAGE: This is helpful when creating layers of images or movies that you may want to animate in 3D view (relative to each other) but allocate to layers for actual compositing.

• Are you sure you are not looking for the Background Image feature, which is in the Property panel? Like this. – Leon Cheung Jan 30 '14 at 2:03
• Thanks but no, that would be a guide image, I want to layer photos or cell animation but keep the image frames registered at the edges of the camera view. – 3pointedit Jan 30 '14 at 3:31

Actually, it can be done with both perspective and orthographic cameras. I would like to suggest the universal way, which needn't any reset on the current camera transformation:

## For Perspective camera:

1. Enable Import Image as Planes and Simple Align in Addon list.

2. Import the target image as plane. When importing, Choose Dots/BU as Plane dimensions, and set the longest side of the image as Definition value. For example, if the image resolution is 1920 px x 1080 px, then you should type in 1920.

3. Set the render resolution the same as image, to set the correct perspective for camera.

4. With the plane selected, hold Shift to further select the camera, then find Simple Align tool in the Tool Shelf, click XYZ button to align both rotation and location of the plane to the camera.

5. Select the plane only, then input like this: GZZ=-focal_length/sensor_size. For example, if the focal length of camera is 35, and sensor size is 32, then press GZZ=-35/32. Then you'll get what you want.

## For Orthographic camera:

1. As above.
2. As above.
3. As above.
4. As above.

5. Select the plane only, then input like this: GZZ=-ortho_scale/2. For example, if ortho_scale=8, you should input GZZ=-8/2. Then Tab into Edit Mode, S8.

P.S.: Doing math while transforming is only available in Blender 2.70+. However, you can do the math elsewhere out of Blender, and paste the result in.

• When I try to do this: the plane I want to align to the camera edges is moved to the camera's origin and not it's projected view port; any ideas why? – ThorSummoner May 27 '14 at 8:51
• Also, Can you elaborate what 'gzz' is supposed to do? It appears to want to move the plane along the z axis, the second press of the 'g' key appears to do nothing, though pressing 'g' a third time unlocks the transformation from the z axis. – ThorSummoner May 27 '14 at 8:53
• @ThorSummoner I see your point. I've updated my answer. That's because the operation method for the new numberal input feature. So now you have to type = or * before doing division. The GZZ means to translate along its local Z axis. – Leon Cheung May 27 '14 at 13:48
• @3pointedit I wonder if this helps? – Leon Cheung May 27 '14 at 13:51

There is an great addon to do exactly what you need!

"create camera image plane"

the "script should be run with a camera selected and then creates an imageplane, sets up drivers to automatically scale it by the render aspect ratio and focal length of camera and distance (that would be the neg z of the imageplanes location) so it will cover the entire screen. It sets up a cycles material so it's ready to load an image sequence"

The material is created with an emission shader that takes into account the alpha channel (if there is one), all you need to do is select the image you want to use:

If you move the camera, the plane will follow. Also if you change the focal lenght, the plane will resize accordingly. And if you move the plane on its local Z axis it will resize as well, filling the frame at all times.