How do 3D video games make faraway things look small?
A 3D game pretends your screen is a window in front of a camera. A line from the camera to a character crosses that window, and similar triangles say the character's height on screen is the focal length times its real height, divided by its distance. Twice as far away means half as tall on screen.
- Height on screen
- 139 px
- Share of the screen’s height
- 9.65%
- Distance where it’s 1 pixel
- 2780 m
Challenge: Make the player exactly 100 pixels tall on screen (within 2 pixels).
More settings
Play
Press "Run it: walk away" and watch the player shrink. Then widen the field of view.
Challenge: Make the player exactly 100 pixels tall on screen (within 2 pixels). The box under the picture turns green when you get it.
Stuck? Pick one of the examples from the “Try an example” menu, or press “New example.”
Understand
A 3D game treats your screen like a window a distance in front of the camera. A line from the camera to the top of a character crosses the window. The two triangles, camera to window and camera to character, are similar, so
The field of view sets : , which uses trigonometry. Press "Run it: walk away" to watch the player shrink. The screen on the right also shows copies two and four times as far, at half and a quarter the size.
Use
Every input has a unit menu, so you can type values in the units you already have. Results follow your units.
Show the work
- The field of view sets the focal length: the screen is half its height away, divided by tan(half the FOV)
f = \frac{1440/2}{\tan(25^\circ)} = 1544\ \text{px} - Similar triangles: size on screen ÷ f = real size ÷ distance
\frac{1544 \times 1.8}{20} = 139\ \text{px} - Distance is on the bottom, so doubling it halves the size
\frac{139}{2} = 69.48\ \text{px at } 40\ \text{m}
Export
Set the distance and the field of view. "More settings" changes the character's height and your screen's resolution.
- Real engines do this with a 4×4 matrix, which also handles turning the camera. The core ratio is the same.
For learning and estimation. Verify with applicable codes, standards, and a qualified professional before using in design, construction, or safety-critical work.
Cheat card
| Symbol | Meaning | Unit |
|---|---|---|
| real height | m | |
| distance from the camera | m | |
| screen height | px | |
| focal length | px |
- Size on screen goes as 1 ÷ distance. Twice as far is half as tall, and ten times as far is a tenth.
- A wider FOV shows more of the world, but everything in it looks smaller.
- Zooming a scope narrows the FOV, which raises the focal length and makes far things big again.
Where it’s used
- Computer Science
Every 3D game engine runs this projection for every corner of every shape, every frame. - Art & Design
Painters have used the same similar triangles to draw perspective since the Renaissance. - Hobbies & Crafts
Players adjust the FOV slider to see more around them, or less for a closer view.
Related exhibits
- Start here
Why fast bullets pass through walls: tunneling
Games move things in jumps, one per frame. If a bullet jumps farther than the wall is thick, it can skip right over it.
- Go further
World seeds: how one number builds a whole world
Games make “random” numbers with a formula: multiply, add, keep the remainder. Start from the same seed and you get the same world, block for block.
- Also try
How tall is that tree? Measure its shadow
One shadow and the sun’s angle give you the height, no climbing needed.
- Also try
Photo edits are matrices: rotate, flip, stretch, and slant
Every rotate, mirror, and stretch in a photo app is four numbers. Multiply each point by them and the picture moves.
Questions people ask
What does the FOV setting do?
It sets how wide a slice of the world fits on your screen. Raising it shows more at the edges but makes everything look smaller and farther away.
Why do faraway things look small?
Your eye, or the game's camera, catches light along lines that spread out from one point. Far things take up a narrower slice of those lines.
How does a scope zoom in?
It narrows the field of view. A smaller FOV means a longer focal length, so distant targets are drawn bigger.
Updated : First published.