Perspective or orthographic, and a window that changes shape
Set ORTHOGRAPHIC to true to compare. The last three lines show why updateProjectionMatrix() matters.
A camera sees a shape in space, its frustum. A perspective camera sees a pyramid, so far things look small; an orthographic camera sees a box, so size never changes with distance. Field of view acts as the zoom, and the aspect must follow the window.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 3 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Write visibleHeight(fov, distance) and use it to find the fov that shows exactly 2 m of height at 4 m.
A camera is new THREE.PerspectiveCamera(50, 1.5, 0.1, 100). The window becomes 800 × 800. Write the two lines that fix the camera.
Explain it without notes
At 4 m, how much height does a camera with fov = 40 see, and what changes if the window gets twice as wide?
When would you choose an orthographic camera in the showroom?
Console
Nothing logged yet.Expected console output
box at 3 m: height in the picture 0.916
box at 6 m: height in the picture 0.458
box at 12 m: height in the picture 0.229
window 1:1, a point 1 m to the right is at x = 0.549
aspect set, projection not updated: x = 0.549 (stale, picture stretched)
after updateProjectionMatrix(): x = 0.275