Re:Ask HN: What HN post made you money?
by drivers99 on Saturday August 06, 2022 @07:31PM
(#32372546)
By the way the vertices of the cube on page 109 ("Projecting our first 3D Object") appear to be wrong. I checked your example code online and got the correct vertices. Didn't see that listed as an errata so thought I'd let you know, if you see this.
Basically the cube just needed to be manually moved back and to the left to look like the example screenshot. As it is in the book, it's too close to the viewport and so it's not visible.
(BTW, for fun, I also animated it flying left and right and forward and back on a sine/cosine wave. Pretty fun!)
Thanks for bringing this up. I had fixed this on the website version [0] as well as the code, as you mention. I thought I had reported this to NSP, but can't find an email, so I'll let them know so they can add it to the errata.
[0] https://gabrielgambetta.com/computer-graphics-from-scratch/0...
So I picked up the book Thursday and finished the basic ray tracer Friday :) Not counting chapter 5 of course so there’s a lot more that I can add from here but it’s made me interested in multi-processing to make it faster, (mine is in unoptimized Python currently, using pygame to have a canvas/window and calling it for each pixel), maybe using GPU shaders to do it (never used those before), and learning about techniques other people are using[1][2] (from YouTube etc), and going down the rabbit hole of old CGI animations from the last 50 years[3].
Looking forward to the second half of the book this weekend. I have written a basic renderer before. I did an independent study class in college and I wrote a stereoscopic one for the iGlasses VR headset[4] in the 90s (you just have to draw using two cameras and interlace the images).
[1] https://youtu.be/A61S_2swwAc “NamePointer - I made a better ray-tracing engine”
[2] https://excamera.com/sphinx/article-ray.html “A reasonably speedy Python ray-tracer”
[3] https://youtu.be/WV4qXzM641o “The Compleat Angler (1978)” Ray tracing animation with refraction, rippling water, etc. from 1978!
[4] https://youtu.be/NoVMIVY5tPA “Virtual I/O iGlasses”