Rasterization is used in video games, films, and computing graphics.
This rendering technique is very popular for rendering graphics because it has been around for a very long time and because of this it is also very well optimized.
After reading this article, you should be able to understand what rasterization is, how it works, and why it is so popular amongst game developers and directors.
Definition of Rasterization
Rasterization is a rendering technique that converts vector-based graphics, which consist of shapes, points, and curves; into pixels which create the graphics on your screen.
Rasterization uses algorithmic conversions that turn shapes into pixels by putting the shapes in a grid-like format.
This means that each individual pixel will have its own set of information, which allows for a smoother gaming and viewing experience.
Steps Involved in Rasterization
There are a few steps involved in order for rasterization to work, which is exactly what we are going to talk about here!
The steps involved with rasterization are:
- Object Representation
- Transformation and Projection
- Scan Conversion
- Shading and Texturing
- Clipping and Culling
- Depth Testing and Z-Buffering
- Blending and Transparency
- Output to Framebuffer
1. Object Representation
When images are 2D, vector graphics are rasterized through a mathematical equation.
In a scenario where the images are 3D, they usually consist of meshes, lines, and polygons. These objects are often represented as a mesh of polygons, that typically come in the form of triangles.
2. Transformation and Projection
Next, these objects will be transformed into the proper positions, scaled to size, and orientation. The objects will be transformed into the camera’s viewpoint.
If the scene is 3D the objects will be shown on a 2D plane, (your screen). But will be projected to display a 3D-like image.
3. Scan Conversion
- Pixel Mapping: This step involves determining which pixels on the screen correspond to parts of the object.
- Scanline Algorithm: One common method is the scanline algorithm, which fills in the object’s shape line-by-line.
- Anti-Aliasing: Techniques like anti-aliasing may be used to smooth out jagged edges.
4. Shading and Texturing
- Flat Shading: The simplest form of shading, where each polygon is filled with a single color.
- Gouraud Shading: A more advanced technique that interpolates colors across the surface.
- Phong Shading: An even more advanced technique that provides realistic lighting effects.
- Texturing: Bitmap images (textures) can be mapped onto the object’s surface for more detail.
5. Clipping and Culling
- Clipping: Any part of the object that falls outside the viewing volume is removed.
- Backface Culling: In 3D graphics, the faces of the objects that are pointing away from the camera can be ignored to save computational resources.
6. Depth Testing and Z-Buffering
- Depth Test: For each pixel, the renderer checks if it is the closest to the camera.
- Z-Buffer: A data structure known as a Z-buffer is often used to keep track of the depth information for each pixel.
7. Blending and Transparency
- Alpha Values: Transparency levels are determined using alpha values.
- Blending Equations: Mathematical equations are used to blend colors when multiple objects occupy the same pixel.
8. Output to Framebuffer
- Framebuffer: The final rasterized image is stored in a framebuffer, which is then sent to the display.
- Double Buffering: Often, one frame buffer is displayed while another is being drawn to, in a technique known as double buffering.
Advantages of Rasterization
There are a few different benefits that come with the use of rasterization for computer graphics.
- Speed and Efficiency
- Hardware Compatibility
- Real-Time Rendering
- Low Computational Resources
- Well Supported
Rasterization is very fast, efficient, and compatible with pretty much any modern GPU. Games that take advantage of higher frame rates, such as Esports games like CS:GO, Valorant, etc.
Will benefit well from the compatibility and speed that rasterization provides when rendering your game. When the task you are doing requires higher frame rates, rasterization does a good job of providing that speed and efficiency because of how simplistic it is.
When looking at rasterization from a developer’s point of view the simplicity of the algorithms it uses to run and render graphics is fairly straightforward making it easier to incorporate over other rendering techniques, such as ray tracing or path tracing.
You should also note that rasterization is very scalable. The process can be parallelized effectively, allowing it to take full advantage of multi-core GPUs. This scalability ensures that rasterization remains a high-performance option as hardware continues to evolve.
Rasterization is a very versatile rendering technique, that is able to support many different types of effects and graphics. This ranges from texturing, shading, transparency, etc.
Although, not always the best it can render these effects very efficiently, which is exactly what you are looking for in rasterization.
Limitations of Rasterization
Although there are a lot of positives to using rasterizations, it has its downsides as well.
Let’s start with its image quality. Rasterization works by turning images into pixels, which can hurt the image quality especially when the image is moving or being scaled up and down. When you scale an image that uses vector graphics you can see that the edges are smooth and made out of shapes (most notably polygons).
If you were to compare an image side-by-side, one rasterized and the other one is a vector image; You will notice that the rasterized image has jagged edges due to the image being drawn out in pixels, and the vector image is completely smooth.
You might think that anti-aliasing will fix the problem of the jagged edges, but it can really only do so much, especially when you have a really complex and detailed setting.
Another limitation of rasterization is its implementation of lighting effects. While ray tracing has the ability to track and trace where and how the light moves on your screen; rasterization is lower quality, and the shadows, lighting, and reflections have to be implemented manually.
This means you will get a less natural and simplified output. This isn’t that big of a deal unless you are looking for a more realistic and immersive experience.
Additionally, rasterization can be limited in its ability to represent complex shapes and patterns. For example, it may not handle transparency or overlapping objects as accurately as other rendering techniques. This is because rasterization is primarily concerned with determining the visibility of surfaces based on their orientation to the viewer, rather than calculating the intricate interactions of light with those surfaces.
Even though rasterization is very efficient and easy to implement it still has a lot of drawbacks and weaknesses. That’s why it is now often combined with other rendering techniques. When multiple techniques are combined, it can create a very nice visual experience while being very efficient and compatible with your hardware.
Rasterization Vs. Other Rendering Techniques
When comparing rasterization to other rendering techniques, you will instantly notice that on the visual side of things, rasterization is falling behind, but when you look into the performance output you will also notice that rasterization is one of the fastest high-performing rendering techniques.
The 3 main rendering techniques used in video games are rasterization, ray tracing, and path tracing.
When we compare rasterization to ray tracing you will instantly notice how close to realism ray tracing is.
Ray tracing provides a very immersive experience, especially in the world of gaming. Games like Battlefield V and Cyberpunk demonstrate this very well.
Here is a list of games that support ray tracing.
However, you will notice that not all computers and hardware can run ray tracing to its full extent because of how demanding it is. That’s why most games still make the majority of their graphics using rasterization in order to make their games accessible to all.
This is also a similar case when we compare rasterization to path tracing.