Sub topic 2
Setting the active camera and looking through it
This chapter covers how Blender decides which camera produces the image and how to see that camera's view in the 3D viewport. It assumes you can orbit, pan, zoom and select objects. It also assumes you know where the Properties editor and the N sidebar are. The Python sections are optional, but they show the same settings through bpy.
One scene, one active camera
A scene can hold any number of camera objects, but a render uses only one of them. That one is the active camera, stored in the scene's camera property. You can see it in the Properties editor under Scene > Camera.
The camera object and the active camera are separate ideas:
- A camera object exists in the scene. It has a position, a rotation and linked camera data.
- The active camera is a reference held by the scene. It points at one of those objects.
Making a camera active does not move or change it. It only changes which object the render, and the camera view, use.
The setting belongs to the scene, not to the viewport. If a file has two scenes, each one has its own scene.camera. Rendering a scene whose camera field is empty fails with a "no camera found" error.
When you add a camera with Shift+A > Camera to a scene that has no active camera, Blender makes the new camera active. Later cameras are not activated automatically, which is a common source of confusion.
Ways to set the active camera
| Method | How | Notes |
|---|---|---|
| Properties editor | Scene tab, **Camera** field, pick from the list | Works without selecting anything. The list shows only camera objects. |
| Viewport shortcut | Select the camera, press **Ctrl+Numpad 0** | Sets the selected object as the active camera and enters camera view. |
| Viewport menu | **View > Cameras > Set Active Object as Camera** | Same operator as the shortcut. |
| Python | `scene.camera = cam_obj` | Takes effect immediately. |
In the outliner, the active camera's data icon is highlighted. In the viewport, the active camera is drawn with a filled triangle above its frame, and other cameras get an outline triangle.
A timeline marker bound to a camera can override the scene's camera during playback or rendering. A later chapter covers that. If the active camera keeps changing on its own, look for bound markers first.
Looking through the camera
Press Numpad 0 with the mouse over the 3D viewport to enter camera view. The menu equivalent is View > Cameras > Active Camera. The viewport now shows the scene as the active camera sees it. Inside the view you will see:
- A solid line around the camera frame, which marks the edge of the rendered image.
- A darker area outside the frame, called the passepartout, which dims everything that will not be rendered.
- Overlays such as composition guides, which you can turn on from the camera's data properties.
Camera view is a property of one viewport, not of the scene. You can split the screen into two 3D viewports, keep one in camera view and use the other to orbit freely and watch the camera from outside. This layout is the easiest way to place a camera, because you see the result and the camera's position at the same time.
Two things to know about camera view:
- The frame's shape comes from the render resolution, not from the viewport's shape. A 1920 by 1080 render gives a 16:9 frame, whatever size your viewport is.
- Zooming with the scroll wheel in camera view changes how much of the frame fits in the viewport. It does not change the camera's focal length.
Moving the camera by navigating
By default, orbiting in camera view leaves camera view and does not move the camera. This is safe, but it is awkward when you want to frame a shot by flying around.
There are two ways to move the camera from the viewport:
- Align Active Camera to View: press Ctrl+Alt+Numpad 0 or use View > Align View > Align Active Camera to View. This copies your current viewport position and direction onto the active camera in a single step. Navigate freely, find the angle you want, then align.
- Lock Camera to View: open the N sidebar, go to the View tab, and under View Lock enable Camera to View. While you are in camera view, orbit, pan and zoom now move the camera object itself. Zoom becomes a dolly move.
Scripting the active camera and the view
The first script creates a camera, links it into the scene and makes it active. It then puts every 3D viewport on the current screen into camera view. Run it from the Text Editor.
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)
cam_obj.rotation_euler = (1.1093, 0.0, 0.8148) # roughly facing the origin
scene.camera = cam_obj # make it the active camera
for area in bpy.context.screen.areas:
if area.type == 'VIEW_3D':
area.spaces.active.region_3d.view_perspective = 'CAMERA'Three details in this script matter:
bpy.data.objects.newcreates an object that exists in the file but not in any scene. Without thelinkcall, the camera would not appear in the viewport or outliner.scene.cameraaccepts the object, not the camera data.- The viewport's mode lives on the 3D view's region data.
view_perspectivetakes'PERSP','ORTHO'or'CAMERA'.
You can also change the lock setting from a script. The loop below turns on Camera to View for every 3D viewport on the screen.
import bpy
for area in bpy.context.screen.areas:
if area.type == 'VIEW_3D':
area.spaces.active.lock_camera = TrueTo check which camera is active, print its name:
import bpy
cam = bpy.context.scene.camera
print(cam.name if cam else "No active camera")Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| Numpad 0 shows nothing or a warning | The scene has no active camera | Set **Scene > Camera**, or press Ctrl+Numpad 0 with a camera selected |
| Render fails with "no camera found" | `scene.camera` is empty | Assign a camera object in the Scene tab |
| The render uses a different camera than you expect | A timeline marker is bound to another camera | Delete or rebind the marker |
| Ctrl+Numpad 0 seems to do nothing | The selected object is not a camera | Select a camera object, not its data or a light |
| The camera drifts while you navigate | Lock Camera to View is on | Turn it off in the N sidebar View tab |
| Numpad 0 view is empty after script setup | The camera was created but never linked to a collection | Call `scene.collection.objects.link(cam_obj)` |
| Numpad keys do nothing on a laptop | There is no numeric keypad | Enable **Emulate Numpad** in Preferences > Input, or use the View menu |
Working habit
A reliable setup for placing a camera is a two-viewport layout. The left viewport stays in normal perspective view and shows the camera as an object you can select and grab. The right viewport stays in camera view and shows the result. Move the camera in the left viewport, or use Align Active Camera to View, and judge the shot in the right one. Later chapters build on this when they cover aiming, constraints and composition.
Exercise
You select a camera named "Wide" and press Ctrl+Numpad 0. You then orbit with the middle mouse button, and the viewport leaves camera view. The camera "Wide" has not moved. Which setting would make orbiting move the camera instead, and where do you find it?
Show answer
Lock Camera to View. It is in the N sidebar, View tab, under View Lock, as the "Camera to View" checkbox. With it on, navigating in camera view moves the active camera. You can also frame the shot freely and then use View > Align View > Align Active Camera to View (Ctrl+Alt+Numpad 0).
Exercise
A script creates a camera with bpy.data.objects.new("Cam", cam_data) and sets scene.camera = cam_obj. Pressing Numpad 0 shows a frame, but the camera object is missing from the outliner. What step was left out, and what does the scene do about the active camera in the meantime?
Show answer
The script never linked the object to a collection, for example with scene.collection.objects.link(cam_obj). Setting scene.camera still works as a reference, so the view and render use that camera, but the object is not part of the scene's collections, so it is not listed or visible in the outliner or viewport.