Skip to content
tezvyn:
Menu

Perspective Transformation: Making 3D Look Right on a 2D Screen

Source: Wikipedia: 3D projectionMediumHow cards are made

Perspective Transformation: Making 3D Look Right on a 2D Screen

Perspective transformation is like looking through a camera lens; it makes distant objects smaller to create the illusion of depth on a flat screen. It's essential for 3D games and computer vision.

Why it exists

Our screens are flat (2D), but the world we want to represent is not (3D). To create a realistic image, we need a mathematical way to translate 3D world coordinates into 2D screen coordinates, mimicking how our eyes or a camera perceive depth and foreshortening.

The mental model

Think of looking through a window pane at a 3D scene outside. If you were to trace the outlines of the objects onto the glass, you'd be performing a perspective transformation. The window pane is your 2D screen. Objects farther away from the window would be drawn smaller than objects close to it, and parallel lines like railroad tracks would appear to converge in the distance.

How it works

The transformation is typically applied using a 4x4 matrix multiplication on 3D coordinates (represented in homogeneous coordinates). The key operation that distinguishes it from other projections is a division by the depth value (the Z coordinate). As an object's Z value increases (it gets farther from the camera), its projected X and Y coordinates on the screen get smaller. This non-linear division is what creates the illusion of perspective.

When to use it

Use perspective transformation whenever you need to render a 3D scene with a sense of realism and depth. This is the standard for first-person video games, architectural visualizations, flight simulators, and augmented reality applications where virtual objects must appear naturally integrated into the real world.

When not to use it

Avoid it when you need to preserve parallelism and relative sizes regardless of depth. For engineering blueprints, 2D sprite-based games, or certain data visualizations, you want objects of the same size to appear the same size no matter their 'depth'. For this, you use an orthographic projection, which discards perspective information entirely.

One canonical example

Rendering a long, straight road in a racing game. In the 3D world model, the edges of the road are parallel lines. After a perspective transformation is applied, they appear to converge at a single "vanishing point" on the horizon. This single effect is what creates the powerful illusion of speed and distance for the player.

Interview question

What fundamental visual effect does perspective transformation uniquely achieve to create depth on a 2D screen?

  • a.It causes parallel lines to converge at a vanishing point and distant objects to appear smaller.Correct
  • b.It ensures all objects maintain their true proportions regardless of distance.
  • c.It allows for the accurate representation of object sizes for engineering and architectural plans.
  • d.It translates 3D coordinates into 2D screen coordinates using a matrix multiplication.
Why?

The correct answer B directly describes the unique visual cues of perspective transformation: foreshortening (distant objects appearing smaller) and the convergence of parallel lines. Options A and D describe characteristics or applications of orthographic projection, which specifically avoids these perspective effects.

Just read this? Test yourself on what you have been reading.

Read the original → en.wikipedia.org

Put your scrolling time to good use

Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on computer vision — each one lists the topics its interview covers.

See open roles