News for hackers. Stuff that matters.
Re:Computer Graphics from Scratch by enriquto on Wednesday February 03, 2021 @05:06PM (#26019794)
I love this resource, thank you!

My favorite chapters are those about drawing raster lines and triangles. One of my first programs was writing (in 386 16-bit asm) the routine to draw a triangle, and I love these algorithms dearly.

An important and beautiful thing that is missing in the book is the drawing of anti-aliased lines (easy) and triangles (not trivial!). I find that rendering carefully shaded smooth objects with a pixelized boundary loses a big part of the magic.

Re:Computer Graphics from Scratch by ggambetta on Wednesday February 03, 2021 @05:53PM (#26020311)
Yep, good point. The reason is that the objective of the book is to cover as much material as possible, in the shortest time possible, and in the simplest way possible; so I had to build the shortest path between putPixel() and filtered textures, and that leaves things like antialiasing behind.

I explain a bit of this in the introduction, most of the time I present not the best/fastest algorithm, but the one that it's the simplest to understand. For example, I don't even mention Bresenham's algorithm; instead I present a super simple but inefficient one, which achieves two critical things: (1) you're drawing lines in no time, (2) it motivates the linear interpolation method that is then used for shading, z-buffering and texturing.