3D Rendering Pipeline: The Geometry Stage
3D Model Coordinates (Local Coordinate System)
- Each object is modeled individually in its own coordinate system.
- Generally objects are represented using triangles or polygons.
- Polygons are composed of vertices.
- Each vertex has associated with it a set of attributes, e.g.
position, color, normal, texture coordinate, user defined, etc
3D World Coordinates
- Compose Scene
- All objects/vertices are transformed into the same coordinate system.
- These
transformations modify the vertex position and normal. Color and
texture coordinates do not change.
3D Eye Coordinate System
- A view point (camera location) in the scene is set.
- Vertices are transformed into the camera/eye coordinate system. Usually this is a right-handed coordinate
system with the camera at the origin looking down the negative z-axis. The
x-axis is to the right and the y-axis up.
This coordinate simplies the projection from 3D to 2D.
- Depth information is determined from the z value at this stage.
- Light position and direction are calcuated.
- Some lighting calculations can be performed. For example, if Gouraud shading is used, the
shading at each vertex is computed using the light parameters, light position, normal
vectors and object's material properties.
- Culling can be performed at this point to remove surfaces
facing away from viewer.
- A view frustum can be defined
(sides, front and back planes)
3D Clip Coordinate System
- This stage prepares for clipping in next stage.
- The projection transformation
on the eye coordinates is performed.
- The view frustum can now easily be defined by a cubic region whose
x,y,z values are within the range of (-w,w).
- Transformations depends on the type projection (e.g.
parallel vs perspective). Note, this is a nonlinear
transformation when perspective projection is used
that forces the frustum into a cubic volume.
which was originally not rectangular, now is rectangular.
3D Normalized Device Coordinates
- If w coordinate is not 1, projection back to normal 3D
coordinates must be done.
- The frustum now is a cube whose x,y,z values are between -1 and 1.
- Objects outside the view frustum can now be easily clipped.
- Note: this coordinate system depends on neither the original application
units nor the particulars of the display.
3D Window Coordinates
- Vertices are converted to units of the display (pixels). Note,
they are still stored as floating point numbers (not integers).
- The xy origin is assumed to be in the lower left hand corner.
2D Screen Coordinate System
- Rasterization has been performed to produce the pixel values which can be
displayed on the screen.
- Attributes e.g. texture coordinates, color, normals, etc might be interpolated across the
polygon.
- Depth information can be used to perform actions such as
hidden surface removal.
- The final color of the pixel is determined by combining the color with such things as depth
testing, blending, stencils, etc.
- The output of this stage is the final color that is placed in the frame buffer.
Ray Tracing
Ray tracing differs from the above sequence of transformations in that the act of tracing rays through space implicitly accomplishes the
perspective transformation, the clipping, and hidden line elimination. If the rays are constructed in world space based on pixel coordinates (the usual approach) then the progression
through spaces for ray tracing reduces to pipeline shown below. Don't be fooled
by the simplicity of this pipeline. Ray tracing can be much more computationally expensive than the above pipeline.