in graphics, webgl-threejs

NeHe Lesson 21 – Orthographic Projection

Orthographic Projection

Orthographic Projection

Orthographic Projection

This post is part of ongoing series on implementing the legacy NeHe lessons (originally done in C++ with OpenGL 1.x) using the three.js library. This post covers  Lesson 21 – Orthographic Projection. This is a relatively complex topic though three.js does most of the heavy lifting. Still, we’ll only hit the high points here.  Please see the article linked above on the Geo-F/X website for all the details.

Projections

Orthographic projection is a means of representing a three-dimensional object in two dimensions. It is a form of parallel projection, where all the projection lines are orthogonal to the projection plane. This results in every plane of the scene appearing in an affine transformation on the viewing surface.

There are many types of projections.  Two of the most common are perspective projections and orthographic projections.  In addition, there are many more.  You are probably familiar with many of the geographic projections.  These map the surface of sphere (such as the earth) onto a flat surface. Mercator is the most common, but many others exist.  A projections section on the Geo-F/X site covers many of these.

Orthographic Projection and GfxScene

As the lesson outlines, the GfxScene object has been expanded for this lesson to support orthographic projections.  The lesson shows how to use the new functionality.  It allows one to switch back and forth between orthographic and perspective projections for the same scene, like this:

An orthographic projections

A perspective projection

In a later lesson (Lesson 42) we’ll demonstrate how to use both projections in a single scene. This isn’t very commonly used, but it’s a cool technique.

The Lessons and Source

More information and a live demo of this lesson can be found at Geo-F/X here. As always, the sources are on github here. Feel free to contact me at rkwright@geofx.com or comment on this article directly below.

Write a Comment

Comment