3D Rendering Pipeline: The Geometry Stage - no Shaders
3D Model Coordinates (Local Coordinate System)
- Each object is modeled individually in its own coordinate system.
- Objects are represented using triangles, line strips, or points.
- A triangle is composed of vertices and edges. Polygons are composed of multiple triangles.
- Each vertex has associated with it a set of attributes, e.g.
position, color, normal, texture coordinate, user defined, etc
3D World Coordinates
- This is where a scene is "composed".
- All objects (i.e. their vertices and attributes) are transformed from their local coordinate system into a single shared
world coordinate system.
- The camera and light locations & directions are often specified with respect to the world coordinates system although this is
not always the case.
- These
transformations modify the vertex position and normal. Color and
texture coordinates generally do not change.
3D Eye Coordinate System
- In the camera coordinate system, the camera sits at the origin looking down the negative z-axis. The
x-axis is to the right and the y-axis up (i.e. this is a right-handed coordinate system).
- Vertices and lights are transformed from the world coordinate system into the camera/eye coordinate system.
This coordinate system greatly simplies the projection from 3D to 2D.
- Depth information is determined from the z value in the camera coordinate system.
- 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, clipping needs to be done on a primitive-by-primitive basis rather than on a vertex-by-vertex basis since clipping involves
modifying not only the vertices but also the edges.
- Note: this coordinate system is "normalized" in that it 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.