Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Projection and Orientation  ›  Lesson

Perspective Projection

Perspective 15 minPerspective projection divides x and y by depth, so objects twice as far away look half as big and slide toward the centre of the view.

Perspective Projection

In chase-camera mode, a boat sailing away from the drone should dwindle toward the horizon, and one heading toward it should swell until it fills the view. An orthographic camera can't do that; it keeps every size fixed. Perspective projection does it with one division.

The rule

Perspective: divide by depth, so twice as far looks half as big.

Picture the camera as a single point, with a flat screen at distance ff in front of it. The straight line from the camera to a point (x,y,z)(x, y, z) crosses the screen somewhere, and similar triangles tell you where:

sx=f xz,sy=f yzs_x = \dfrac{f\,x}{z}, \qquad s_y = \dfrac{f\,y}{z}

With f=1f = 1, a crate corner at (2,1,4)(2, 1, 4) lands at (0.5,0.25)(0.5, 0.25). Move it back to z=8z = 8 and it lands at (0.25,0.125)(0.25, 0.125): twice as far, half the size, and slid toward the centre of the view. That is exactly how an eye or a lens sees.

The field of view sets ff. If the screen runs from −1 to 1 across, then f=1/tan⁡(fov/2)f = 1 / \tan(\text{fov}/2), so a 90° view gives f=1f = 1. Widening the view makes ff smaller: more of the world fits on the screen, and everything in it looks smaller.

In a real renderer the GPU does the division. A 4×4 projection matrix copies each point's depth into its ww coordinate, and after the multiplication the hardware divides by ww, a step called the perspective divide. The same ww that told points from vectors now carries depth.

The shortcut

On-screen size = f × real size ÷ depth. You rarely need the full coordinates: halve the distance and the size doubles; triple it and the size drops to a third.

How big is the boat on screen?Step 1 of 4
  1. The rule

    Screen size = f × real size ÷ depth. The boat is 6 m long and f = 1.

The trap is points behind the camera. With z = −5 the division flips the signs, and something behind the drone is drawn, mirrored, in front of it; at z = 0 the division blows up. Renderers therefore clip geometry against a near plane just in front of the camera before they divide.

Drills

Answer fast — trust the rule.

quick drill

With f = 1, where does the point (6, 3, 12) land on screen?

quick drill

A gull looks 0.2 screen units wide at 30 m. It flies in to 10 m. How wide does it look now?

quick drill

Widening the chase camera's field of view from 60° to 90° does what to a boat on screen?

quick drill

Why must the renderer clip a point at z = −5 before the divide?

Remember

  • Perspective: screen position = f × (x, y) ÷ depth; twice as far looks half as big.
  • On-screen size ∝ 1 ÷ distance; a wider field of view means a smaller f and smaller objects.
  • Clip at a near plane before dividing, or things behind the camera appear mirrored in front.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainHow big is the boat?

A boat 6 m long sits 20 m in front of Harbour Hopper's chase camera, with f = 1. Explain how big it looks on screen, how that changes as the camera closes to 10 m, and why the renderer must discard points behind the camera before dividing.