23

Rasterization in One Weekend

 5 years ago
source link: https://www.tuicool.com/articles/hit/Fz6Zva
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Welcome to mini-series of Rasterization in One Weekend !

Having lately gotten tired of (well, not really ) chasing instructions and signals inside GPUs, I set out to do a small project. As I recently got myself into making another SW-based rasterizer that utilizes modern techniques in an efficient manner and not one that pretends it’s ’65, I wanted to add some basic and beginner-friendly code/information/documents here that one can use to make their own very first rasterizer and maybe realize along the way that fundamentals of the math behind very powerful machines can be understood without too much difficulty after all.

Here, we’ll be closely following a method called “ Triangle Scan Conversion using 2D Homogeneous Coordinates ” (from one of my all-times favorite papers). Note that we strictly restrict ourselves to the rasterization of triangles; different algorithms can be used for different primitive types such as points, lines, etc.

Remember also that, although what lies below can provide good hints on the way GPUs actually work, it’s all immensely simplified. The path from ‘ 1 static object with 12 triangles ‘ to  ‘ 100,000 animated objects with 10 million triangles ‘ on-screen is a long and tedious one. And unlike its rival , rasterization is not kind of algorithm whose parallelism would embarrass you. That’s why actual implementations will employ many, many smart, difficult and expensive to implement algorithms that have taken very smart people many years of R&D, sweat and tear to develop, in order to provide the required rendering capabilities. With that said, here I hope that at least I’ll have helped you scratch the surface a little bit by the end! So dive in:

  • Part I:Hello, Triangle!
  • Part II: Go 3D!
  • Part III: Go Wild!

All code can be found here .


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK