Tuesday, February 17, 2009

A Typical Rendering Pipeline

Three conceptual stages of the rendering pipeline are application, geometry and rasterization.



The Application Stage

The input at this stage is a scene description which is a set of meshes, materials, textures, lights etc. The lesser the number of polygons the lesser the burden on geometry stage. Occlusion culling, View Frustum Culling, Hidden Surface Removal, and LOD selection are the main techniques that helps the geometry stage from overloading. Culling means to select a portion of the geometry from the current scene for rendering. If an object is outside the viewing volume, the object is culled. Occlusion culling methods eliminate a bunch of objects hidden by groups of other objects. Tessellation, game objects movement, camera movement, AI and physics calculations are some other tasks done at this stage.


The Geometry Stage


The triangles will contain vertices at object space with information such as position, color, normals and texture coordinates. In addition to this a 3D scene may contain other information such as light sources and materials. The Geometry stage takes this input. The first task is to convert object coordinates into world coordinates by rotations, scaling and translations chosen by the designers. Next the world space coordinates are to be translated and rotated around the camera's view. The viewing coordinate axes which are used for moving and orienting virtual camera of the scene can be calculated easily from three entities: eye point, target point, and up vector. Lighting calculations are also done at view space. Orthographic or perspective transformation is applied next.The perspective projection gives the illusion of distant objects to look small and near objects to look big. Clipping is performed next. This clipping can also result in re-tessellation of some of the triangles. Perspective division is applied next. The result is a 2D image residing on the projection window. Now it is to be mapped to the monitor. This is the final transform called window-to-viewport transform. This result contains (x,y,depth) for each vertex and are send to the rasterization stage.

The Rasterization Stage


For each primitive(line, point or triangle) the renderer calculates the interpolated depth, interpolated vertex positions, interpolated light intensities and interpolated texture coordinates for each pixel applying a shading model. These pixels are copied to framebuffer after a series of operations like depth test, blending etc. The final output is a sent to the frame buffer for display.

Creative Commons License
A Typical Rendering Pipeline by Manoj MJ is licensed under a Creative Commons Attribution-Share Alike 2.5 India License.
Based on a work at gamedev1001.blogspot.com.