Perspective
Table of contents
Perspective projection
Objects that are farther away appear smaller.
Foreshortening is the visual effect that causes an object or distance to appear shorter than it actually is because it is angled toward the viewer.
A straight line in 3D space is projected as a straight line in 2D space. This is why 3D-models are made up of triangles, since this simplifies some of the math. Circles do change when projected.
Parallel lines which are parallel to the projection plan remain parallel. While parallel lines which are not parallel to the projection plane converge to a vanishing point. This often forms the basis for manual construction of perspective drawings.
Pinhole Camera
A pinhole camera is a box with a tiny hole in one side. Light from a scene passes through the hole and strikes a surface inside, where the scene is reproduced. This is done trough geometric optics. The image is upside down and reversed left to right. The smaller the hole, the sharper the image.
We will put the image plane in front of the pinhole. The image plane is the plane where the image is projected on. The image plane is perpendicular to the optical axis. This is also called the Eye-image pyramid. The distance or size of the image plane can be chosen arbitrarily. The larger the image plane, the larger the field of view.
Computing Perspective
There are two approaches:
- Project the objects on the screen
- Object-driven
- Projection needs to be transformed (discretized) into pixels
- Ray Tracing
- Pixel-driven
- “look trough” pixel, figure out what is visible trough pixel
Project objects on screen
We project the object on the screen. The problem we can face here is if there are multiple objects projected to the same pixel. We can solve this by using a z-buffer. A z-buffer also keeps track of the depth of the camera trough it’s z-axis. So here not only the color is stored, but also the depth of the camera.
Ray Tracing
We shoot a ray trough each pixel. We then check which object is closest to the camera. We then color the pixel with the color of the closest object.