In computer graphics, converting 3D spaces to 2D images is achieved by various rendering techniques. These various techniques make the backbone of the computer graphics pipeline. One such technique is rasterization.
Rasterization is a process that converts vector graphics or 3D graphics to 2D images. These 2D images consist of a grid of pixels rather than primitives or models. Each pixel contains information regarding that part of the image. Such images are referred to as Raster graphics.
Let's look at how rasterization converts 3D graphics to 2D.
Rasterization goes through a series of steps to translate a 3D space of primitives and models to a 2D image comprised of pixels.
First, we have to transform our 3D primitives into their 2D counterparts. The 3D coordinates, called Object coordinates, are transformed into 2D coordinates, called Screen coordinates. We achieve this by performing various transformations on our 3D vertices to convert them into 2D space corresponding to the screen.
After this step, we would have a 2D projection of our 3D space.
The second step involves removing unnecessary details. The previous step would give us a 2D projection of all the primitives from our 3D space. However, some of these projections would need to be removed as they would be outside our viewing window (defined by the camera and its properties).
This step would optimize our process and make it faster.
Once the unnecessary primitives are removed, the primitives inside the viewing window must be rasterized into fragments or pixels. The rasterizer checks which pixels are covered or intersected by the projected primitive. Hence, the primitives are broken down into fragments or pixels to be projected onto the 2D screen.
After this step, we would have the building blocks for the final image.
Now that we have the fragment from our primitives, we must determine attributes like color, texture, depth, etc. Certain computations determine these attributes. These computations consider various factors, such as lighting, shading models, textures, and other visual effects.
After this step, we would have the relevant information for each pixel to define their properties.
Finally, we would render the computer fragments on the screen. Various pixel operations, such as anti-aliasing, blending, etc., would be performed. At this step, we would also consider whether a certain primitive is obfuscated from view by another. To accomplish this, we would perform depth testing, which compares the depth of all the primitives to determine which is closer to the screen.
After this step, we would have the final rendered image.
The process of the rasterization can be further optimized.
Bounding boxes is a technique used to optimize the process of rasterization. They are simple geometric shapes (mostly cuboids in 3D and rectangles in 2D) that encompass the models or primitives in the scene. These boxes are then used to reduce the space that is rasterized.
Bounding boxes encompass the model and try to reduce their size to reduce the space not occupied by the model or primitives. These boxes are then the ones on which rasterization operations are performed, effectively reducing the number of operations needed to rasterize an image.
There are various rasterization techniques with their specialized use cases. Some of the most commonly used rasterization techniques are as follows:
Scanline rendering: This basic technique works by projecting 3D primitives to 2D and then using intersection with lines to determine the final rendered image. It does not work well with complex scenes.
Z-buffering: This technique handles hidden surface removal. It employs a depth buffer to determine the depth of primitives and figures out which are closer to the screen and obfuscated by others.
Tile-based rendering: This technique divides the screen into small tiles (sections) and handles these sections independently. This optimizes memory bandwidth and computational resources.
Deferred rendering: This technique separates the lighting calculation from the rasterization phase. This aids in handling scenes with complex lighting.
Adaptive resolution rendering: This technique dynamically adjusts the resolution of parts of the image. This is useful in virtual reality applications.
Order-Independent Transparency (OIT): This technique addresses handling challenges related to transparency.
Rasterization has advantages due to its simplicity; it allows the creation of rendered images efficiently. Due to its simplicity, it is faster and easier to render images using this technique than other more technologically expensive techniques. As a result, rasterization is very useful where efficiency and speed are required.
However, rasterization finds it challenging to handle complex scenes with multiple light sources, transparency, translucency, etc. Hence, rasterization produces less realistic low-fidelity images compared to other techniques.
These factors inform the applications of rasterization. Some common applications of rasterization are:
Real-time rendering in video games
Computer-aided design (CAD)
Computer graphics and animation
Medical imaging
Geographic information system (GIS)
There are various techniques employed to convert 3D scenes to 2D images. We learned about one such technique, rasterization, that provides a fast and efficient method to render 2D images with noticeable trade-offs concerning image fidelity. Various rasterization techniques handle specialized use cases and allow rasterization to be used in diverse use cases and applications. These applications include real-time rendering in video games, computer-aided design (CAD), computer graphics and animation, etc.
Free Resources