Computer graphics is a process of mapping 3D scenes on a 2D screen. Graphics pipeline or rendering pipeline defines the primitive operations required for this mapping. These operations depend on hardware and software, so various graphics APIs like OpenGL and DirectX were created to unify the underlying rendering process. Such APIs free the application developer from writing the code to manipulate graphics hardware accelerator
As shown in the following figure, the graphics pipeline primarily works in three stages: Application, Geometry and Rasterization.
At the application level, the user interacts with the scene and alters it as per his requirements. These changes must be reflected on the screen. The new scene with its primitive shapes like a point, line, and triangles are passed to the next stage.
The application stage mostly performs collision detection, morphing, animation, quadtree or octree generation. Such preprocessing steps help to reduce the memory requirement later stage in the rendering process.
This pipeline can be seen from a different perspective. The majority work of operations with polygons and vertices are performed in the geometry stage.
Objects are first created in world coordinates with their actual dimensions. Required objects are placed in the world coordinate system. Camera position is determined in a world coordinate system, which determines the view of placed objects. Appropriate light sources are considered to illuminate the scene. Parallel or perspective projection transforms the 3D scene from the real world to 2D representation as per the camera viewing direction. The real-world scene which is outside the clipping window (camera viewfinder) will be rejected to reduce the further computation. The projected and the clipped scene is then mapped to the desired device display device. Window to viewport transformation does this mapping.
Each object is first converted into triangles via the process called tessellation. In the later stage, triangles are converted into the smallest fragments called pixels. The entire continuous scene is drawn in a discrete form on a monitor through the process of rasterization. Color of the pixel is determined by the light source, viewing direction, object material property, etc. Finally, the output is merged and displayed on the monitor screen.
The process is depicted in detail in the following figure
Additional Reading: Click to read