Parallel Projections

One way to convert a 3D coordinate into a 2D coordinate is to simply discard the z component, which is known a parallel projection. Listing 8-5 shows a very simple function that we can use to convert a 3D coordinate into 2D with a parallel projection.

Listing 8-5. Function That Performs a Parallel Projection def parallel_project(vector3):

return (vector3.x, vector3.y)

Although parallel projections are quick and easy to do, they are not often used in games because by ignoring the z component there is no impression of depth. A 3D scene rendered with a parallel projection is kind of like looking through a zoom lens with a high level of magnification; the world appears flat, and objects at varying distances seem as though they are next to each other. Figure 8-4 shows a cube rendered with a parallel projection.

Figure 8-4. A cube rendered with a parallel projection

Was this article helpful?

0 0

Post a comment