Perspective Division

Once it has been determined how much of the viewing space will be rendered, the frustum is mapped into the near plane in order to produce a 2D image. The near plane is what is going to be rendered on your computer screen.

Different operative systems and displaying devices can have mechanisms to represent 2D information on screen. To provide robustness for all possible cases, WebGL and OpenGL ES provide an intermediate coordinate system that is independent from any specific hardware. This space is known as the Normalized Device Coordinates (NDC).

Normalized device coordinates are obtained by dividing the clipping coordinates by the w component. This is why this step is known as perspective division. Also, please remember that when we divide by the Homogeneous coordinate, we go from projective space (4 components) to Euclidean space (3 components), so NDC only has three components. In the NDC space, the x and y coordinates represent the location of your vertices on a normalized 2D screen, while the z-coordinate encodes depth information, which is the relative location of the objects with respect to the near and far planes. Although at this point we are working on a 2D screen, we still keep the depth information. This will allow WebGL to later determine how to display overlapping objects based on their distance from the nearest plane. When using normalized device coordinates, the depth is encoded in the z-component.

The perspective division transforms the viewing frustum into a cube centered in the origin with the minimum coordinates of [-1, -1, -1] and the maximum coordinates of [1, 1, 1]. Also, the direction of the z-axis is inverted, as shown in the following diagram:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.122.4