• Donate
  • Log In
Home
  • About
    • About
      • About Us
      • Our Board of Directors
      • Board Meeting Minutes
      • Board Elections
      • Updates & Announcements
      • Our Staff
      • Governance & Financials
      • Lifetime Achievement Award
  • Events
    • Events
      • Upcoming
      • Past
      • Conference FAQ
      • Conference Policies
      • Code of Conduct
      • Calls for Papers
      • Author Resources
      • Grant Opportunities
      • Best Papers
      • Test of Time Awards
  • Join & Support
    • Join & Support
      • Become a Member
      • Ways to Give
      • Our Supporters
      • Student Opportunities
      • Sponsorship Opportunities
  • Archive
    • Archive
      • Proceedings
      • Multimedia
      • ;login: Archive
      • Short Topics in System Administration Series
      • Journal of Education in System Administration (JESA)
      • Journal of Election Technology and Systems (JETS)
      • Computing Systems Journal
  • Search
Join the conversation
Back to ;login: Online

Computer Graphics from Scratch

A Programmer's Introduction to 3D Rendering
July 12, 2021
Bookreview
Authors: 
Rik Farrow
Article shepherded by: 
Rik Farrow

When someone at No Starch Press asked me if I wanted to review a book about graphics programming, I thought, "Sure. I worked with a company that built a graphics library in 1990. I know about this." My real clue as to how the book would go was when Gambetta wrote that he'd be using just one graphics primitive: PutPixel. This really was going to be "from scratch".

Gambetta was both a game designer and an instructor who taught a third-year programming classes for five years in rendering graphics. His writing is clear, and his explanations follow logically as he builds, step-by-step, two different systems for rendering 3D objects. He starts out by explaining the coordinate system for the Canvas, where the pixels are drawn. Then he mentions you can review linear algebra by reading a short appendix.

I read the appendix, and you do need to understand some linear algebra principles, because to understand Gambetta's math, you need to understand vector manipulation. That's really easier than it sounds, and I had learned what I needed during two weeks in high school. But his refresher was nice, and I did have to be reminded of things like a dot product.

The rest of the book is divided into two big sections, one for raytracing and the other for rasterization. With raytracing, a camera looks through a viewport, represented by the canvas, at 3D objects. A pixel written to the canvas represents the color of each pixel as if a ray, or better, vector, had been drawn from the camera through each pixel in the canvas to the objects to be rendered. Gambetta uses short chapters, each building equations and pseudo-code for accomplishing a particular task, such as determing the amount of light falling on an object, and how that light gets reflected back to the camera.

In rasterization, you work from the other direction, figuring out how a point on an object appears on the canvas. More specifically, Gambetta explains how to draw lines, draw rectangles, fill those rectangles, shade them, add textures and so on, until you have drawn pixels representing all the 3D objects that can be displayed on the canvas through the viewport.
Most people will not be creating their own renderers, or shaders as they are also called. But if you want to understand how shaders are programmed, something important not just to game developers or animators but to anyone who needs to understand what's happening with the graphics library that they are using that isn't working right, this book is for you. The math is just algebra with linear algebra included, and Gambetta builds up his renderers from scratch in a manner that appears logical and easy to follow. I found the full color images an important feature of the book.
A Programmer's Introduction to 3D Rendering
by Gabriel Gambetta
No Starch Press, April 2021, 248 pp.
ISBN-13: 9781718500761
Article Categories: 
Programming
Last updated February 8, 2023
Authors: 

Rik Farrow has been a consultant for 40 years. He has written two books, as well as working as the technical editor for a popular operating system book. He also taught UNIX system administration and Internet security during the 90s, and worked as a volunteer for USENIX program and steering committees. Rik has been the editor of ;login: since 2005.

[email protected]
  • Log in to post comments
USENIX logo
  • Contact USENIX
  • Privacy Policy

© USENIX 2025
EIN 13-3055038

Website designed and built by Giant Rabbit LLC
Powered by Backdrop CMS

We need contributions from individuals like you.

USENIX conferences directly influence the development of computing systems and products used worldwide. Contribute today to support this vital work for the next 50 years.

Secure the Future of USENIX

Donate
Close