Sub topic 2
Setting the Active Camera and Looking Through It
This chapter assumes that you can navigate the 3D Viewport, select objects, and use the Properties editor. You should also know that the viewport is an interactive work area, while a render is the image produced by Blender.
Camera objects and camera data
A camera is an object that has a camera data block attached to it. The object stores the camera's position and rotation. The data block stores settings such as lens length, projection type, and clipping distances.
A scene can contain several camera objects, but it has only one active camera at a time. Blender uses the active camera when you render the scene.
| Task | Blender action |
|---|---|
| Select a camera | Select it in the Outliner or viewport |
| Look through the active camera | Press `Numpad 0` |
| Make the selected camera active | Use `Ctrl + Numpad 0` |
| Render from the active camera | Press `F12` |
The active camera is shown in the Scene Properties under the camera field. You can also set it by selecting a camera and pressing Ctrl + Numpad 0.
Set and inspect the active camera
- Add a camera with
Shift + A, then choose Camera. - Select the camera in the viewport or Outliner.
- Press
Ctrl + Numpad 0.
The viewport switches to the selected camera's view. A solid camera frame shows the part of the scene that will be rendered. Objects outside the frame may still be visible in the viewport, but they will not appear in the render.
Press Numpad 0 to enter or leave the active camera view. Selecting a different camera does not automatically make it active. This distinction is a common source of confusion: the selected object and the scene's active camera can be different objects.
Adjust the camera view
While looking through the camera, you can adjust the view in two main ways:
- Move or rotate the camera object directly.
- Enable Lock Camera to View in the N sidebar's View tab, then orbit, pan, or zoom the viewport.
Locking the camera to the view is useful for rough framing. Disable it before normal viewport navigation, or the camera will continue to move when you orbit the scene.
To align a camera to your current viewport angle, first position the viewport as desired, then press Ctrl + Alt + Numpad 0. Blender moves the active camera to match that view. This is often faster than manually rotating the camera.
The render frame depends on the scene's render resolution and aspect ratio. Check the camera border at the intended output size rather than judging only from a free viewport view.
Set the active camera with Python
The scene.camera property stores the active camera object. The object must already be linked to a collection in the scene.
import bpy
scene = bpy.context.scene
cam_data = bpy.data.cameras.new("ShotCamera")
cam_obj = bpy.data.objects.new("ShotCamera", cam_data)
scene.collection.objects.link(cam_obj)
cam_obj.location = (7.0, -7.0, 5.0)
scene.camera = cam_objThis code creates a camera, links it to the scene, places it, and assigns it as the active camera. It does not aim the camera at a subject. You can rotate it manually or use a constraint in a later setup.
Exercise
You have selected CameraB, but pressing Numpad 0 still shows CameraA. What should you do?
Show answer
Press Ctrl + Numpad 0 while CameraB is selected. This assigns CameraB as the scene's active camera.