Computer Graphics from Scratch (No Starch Press)

Author: Gabriel Gambetta
Publisher: No Starch Press
Pages: 248
ISBN: 978-1718500761
Print: 1718500769
Kindle: B085BVJG5B
Audience: People interested in creating 3D graphics
Rating: 5
Reviewer: Kay Ewbank

This is a well written book that explains the topic of 3D rendering, and tries its hardest to minimize math and complexity.

The book, subtitled "A Programmer's Introduction to 3D Rendering" is a development of lecture notes from a university course taught by the author. Some of the techniques and tutorials became popular on Hacker News, and the author then developed them further for this book. I'd originally assumed, but only for a moment, when I saw the title that the language used in the book would be Scratch and that didn't seem very likely! In fact the examples are written in pseudocode with an accompanying website with full code in JavaScript.

 

Banner

Staying true to this aim, Gambetta starts with an explanation of the graphics canvas, coordinate systems, and color models. He then moves on to Part I of the main book, Raytracing.

This begins with a chapter on basic raytracing in which readers work through the techniques used to represent rays of light and objects in a scene. Gambetta then shows how to add in light, before adding shadows and reflections. This part of the book ends with a chapter on extending the raytracer. By the end of this section, Gambetta has shown how to create a raytracer that could render a landscape scene with accurate lighting, material properties, shadows and reflections using relatively simple algorithms.

 

Part II of the book occupies more space, and covers Rasterization. As Gambetta explains, raytracing is simple but slow, whereas rasterization is more complicated but a lot faster. There are detailed chapters for ever more complex elements, starting with lines, and building up through filled triangles and shaded triangles. Gambetta then moves on to perspective projection, explaining how to turn 3D coordinates into 2D canvas coordinates, and how you can use this to draw 3D triangles on the 2D canvas. 

The next chapter moves on to rendering a whole scene, followed by a chapter on clipping that looks at how to deal with points and objects that are behind the camera.

By chapter 12, the book has moved on from wireframe objects to solid objects, and Gambetta shows how to carry out hidden surface removal to overcome the problems that arise when you begin filling shapes. Chapters on shading and textures follow, before a final chapter on extending the rasterizer you've created.

This is a good book. Gambetta writes really well, and the explanations are clear, understandable, and fun to follow. Highly recommended.

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Functional Programming in C#, 2nd Ed (Manning)

Author: Enrico Buonanno
Publisher: Manning
Date: February 2022
Pages: 448
ISBN: 978-1617299827
Print: 1617299820
Kindle: B09P1Z2PPB
Audience: C# developers
Rating: 5
Reviewer: Mike James
Is C# a good language for functional programming?



Object-Oriented Python

Author: Irv Kalb
Publisher: No Starch Press
Date: January 2022
Pages: 416
ISBN: 978-1718502062
Print: 1718502060
Kindle: ‎ B0957SHYQL
Audience: Python developers
Rating: 3
Reviewer: Mike James
Python, Object-Oriented? Not a lot of programmers know that!


More Reviews

 

Last Updated ( Thursday, 04 November 2021 )