Harold Serrano

View Original

From Model Space to Screen Space- OpenGL Space Transformations

Transformations are not only used to rotate, scale or skew a coordinate system. They are also used to completely transform a coordinate system into a totally different coordinate system. For example, transforming a 3D coordinate system into a 2D coordinate system.

The coordinate system of a character gets transformed multiple times as it passes through the OpenGL pipeline. The character starts off in what is know as the Model coordinate system. It then gets transformed into the World coordinate system, then to a Camera coordinate system and finally into a Projection coordinate system.

Model Coordinate System

The Model Coordinate System is simply the coordinate system where the character was created.

World Coordinate System

A Model Coordinate System is the unique coordinate space of the model. Two distinct models, each with their own coordinate systems can’t interact with each other. There needs to be a universal coordinate system that allows each model to interact with each other. This universal system is called World Coordinate System. For interaction to occur, the coordinate system of each model is transformed into the World Coordinate System.

Camera Coordinate System

What is seen on a screen, is relative to a viewer. More specifically to a camera. A change in a camera’s orientation and position changes what a viewer sees. A World Coordinate System is transformed into a coordinate system called Camera Coordinate System. This coordinate space defines what it is seen on a screen.

Projective Coordinate System

What is perceived in a screen as three dimensional is just an illusion. It is just a two dimensional image. The final transformation in the OpenGL pipeline occurs in what is called the Projective Coordinate System. This transformation converts a three dimensional scenery into a two dimensional image. The Projective coordinate system can be configured in two ways: - Perspective View - Orthogonal View

Perspective View

When the projective's coordinate system is set as a Perspective View, it gives the illusion of producing a three dimensional scenery. This is an illusion created by producing a vanishing point and making objects farther from the camera smaller, thus producing the illusion of depth.

Orthogonal View

In Orthogonal View, every object in the scene is seen as a two-dimensional objects. There is no illusion of depth.