[HN Gopher] Computer Graphics from Scratch (2017)
       ___________________________________________________________________
        
       Computer Graphics from Scratch (2017)
        
       Author : fanf2
       Score  : 162 points
       Date   : 2020-12-01 16:43 UTC (6 hours ago)
        
 (HTM) web link (www.gabrielgambetta.com)
 (TXT) w3m dump (www.gabrielgambetta.com)
        
       | trilinearnz wrote:
       | An excellent contribution. Education at this "full stack" level
       | is something we should see more of.
       | 
       | I particularly enjoyed the concise explanation and code example
       | in the Perspective Projection section. Often web based
       | explanations are lacking. Not the case here!
        
       | ggambetta wrote:
       | Hi! Author here. Happy to answer any questions :)
       | 
       | A bit of shameless self-promotion, if I may: I've been working
       | with No Starch Press to turn this into an actual book, and it's
       | coming out within a couple of months! I'm going to update the
       | website version soon, to reflect (heh) the much-improved quality
       | of the text after months of editing. Stay tuned!
        
         | agytvfr wrote:
         | Thanks so much for making the book available on the site.
         | 
         | Have you ever written about your game development company and
         | how you managed to get the contracts to produce the Ghost
         | Whisperer and other games?
        
           | ggambetta wrote:
           | I haven't written much about Mystery Studio [0]. It's not
           | that interesting :)
           | 
           | Ghost Whisperer, CSI:NY, and Murder She Wrote were done in
           | partnership with Legacy [1], who are in Los Angeles and have
           | the contacts. For CSI:NY it was really exciting that the
           | actors of the show recorded the voiceovers, but we were
           | nowhere near them :(
           | 
           | [0] https://en.wikipedia.org/wiki/Mystery_Studio
           | 
           | [1] http://https://legacygames.com
        
         | blondin wrote:
         | oh wow! thanks a lot for writing the book. definitely looking
         | forward to it. this tutorial is definitely top 3 for me.
        
           | RaoulP wrote:
           | Share the other two with us!
        
         | rustybolt wrote:
         | Congrats on finishing the book. I hope it will turn out to be a
         | good investment of your time :)
        
       | Threeve303 wrote:
       | > "The sense of accomplishment you get when your SQL query runs
       | just right is nothing compared to what you feel the first time
       | you get ray traced reflections right."
       | 
       | This line is very motivating to someone who works with data
       | frequently.
        
         | User23 wrote:
         | Everyone in my age group that started programming did so
         | because they wanted to do computer graphics. Every single one.
         | It's definitely a great hook to inspire learning.
        
           | jacobush wrote:
           | I did a raytracer in BASIC on an 8-bit machine. Took two
           | weeks and a nondescript lump of pixels was the result. But I
           | knew it was a torus.
        
           | kevinskii wrote:
           | Same here. And yet I spent...21 years programming before I
           | finally got around to learning it.
        
         | enriquto wrote:
         | > the first time you get ray traced reflections right.
         | 
         | This guy graphics! I remember my highest pleasure in
         | programming was attained when I first drew a rasterized
         | triangle. Of uniform color.
        
         | FartyMcFarter wrote:
         | Many versions of SQL are Turing complete, so one can probably
         | do both at the same time!
        
           | imhoguy wrote:
           | Here it goes - MySQL raytracer
           | https://www.pouet.net/prod.php?which=83222
        
       | dang wrote:
       | If curious see also
       | 
       | 2019 https://news.ycombinator.com/item?id=19584921
        
       | rafaelvasco wrote:
       | As an eternal student and enthusiast of computer graphics, this
       | is golden;
        
       | chompychop wrote:
       | Another splendid resource which I've found to be in the same
       | spirit is Jamis Buck's The Ray Tracer Challenge. It follows a
       | language-agnostic test-driven approach to making a raytracer from
       | scratch.
        
         | optymizer wrote:
         | The Ray Tracer Challenge is an awesome book. It was really fun
         | to code the ray tracer!
        
       | news_to_me wrote:
       | This looks really cool! Earlier this year I built a software
       | rasterizer from scratch, and it was one of the most
       | fun/challenging projects I've done. I learned a ton about
       | efficient memory layout, and the linear-algebra concepts behind
       | projection are very fun.
        
         | echelon wrote:
         | That sounds amazing.
         | 
         | What did you read prior to undertaking the project? How did you
         | know what you needed to build? Have you been working in
         | graphics awhile?
         | 
         | I would totally read any blog post or postmortem writeup you
         | have if you decide to publish your results.
        
           | news_to_me wrote:
           | I didn't know any computer graphics or linear algebra
           | beforehand. I bought a copy of this book[0], which is a bit
           | dated, but goes through the basics really well. I also got a
           | lot out of this lecture series[1].
           | 
           | I ended up doing a lot more math than I expected to
           | understand the fundamentals of projection, basically teaching
           | myself linear algebra, but that was pretty fun in itself.
           | 
           | My goal was to build a minimum-viable software rasterizer for
           | embedded situations (STM32-F7). I still haven't gotten around
           | to getting lighting to work efficiently, or to leverage SIMD,
           | but I intend to whenever I get back to the project.
           | 
           | The source is here if you're curious:
           | https://git.sr.ht/~zjm/Moon3D. There's also some
           | screenshots/progress updates on my Twitter:
           | https://twitter.com/zackmichener
           | 
           | [0]: https://www.pearson.com/us/higher-
           | education/product/Foley-Co...
           | 
           | [1]: https://www.youtube.com/watch?v=01YSK5gIEYQ&list=PL_w_qW
           | AQZt...
        
           | gwittel wrote:
           | When I wrote one it was part of an intro to computer graphics
           | class at university (sample syllabus
           | https://web.cs.ucdavis.edu/~ma/ECS175/). There's probably a
           | lot out there at the university level.
           | 
           | I took it well over a decade ago, but the current material is
           | largely similar. Going in you were required to know C and
           | C++, and math pre-reqs (Calculus, linear algebra). Other
           | university classes might skip the rasterizer building, but I
           | think its a useful foundation.
           | 
           | We started with basic OpenGL to render models. Then we
           | replaced the OpenGL with our own rasterizer, adding features
           | as you went. It was a tough class (10 week schedule), but
           | very rewarding. Probably the worst part was debugging
           | rendering issues. You could see the problem, but it was hard
           | to locate where your math went wrong.
        
           | Jasper_ wrote:
           | You can write a basic (read: slow) rasterizer in 100 lines or
           | so. It's mostly math.
           | 
           | https://github.com/magcius/sw3dv/blob/gh-
           | pages/sw_rast.js#L1...
        
         | reggieband wrote:
         | A long while ago I did a lot of 2d graphics work. I read a blog
         | post on 2d rasterization of lines with anti-aliasing. The post
         | was very long and detailed. I felt awe at how much complexity
         | the most simple operation could take. Drawing many lines pixel
         | by pixel in a performant way while also making it look good is
         | a challenging task. Just another one of those things we take
         | for granted once it is encapsulated in a library/module.
        
         | chompychop wrote:
         | Could you tell what resources you found the most helpful for
         | optimising memory in the context of raytracing/rasterisation?
        
       | suyash wrote:
       | Yes another computer graphics tutorial, there are tons of these
       | out there. Would have loved to see southing unique about it.
        
         | kevinskii wrote:
         | I think I've done about three of them. All were good, but this
         | one is my favorite. It covers both ray tracing and
         | rasterization, and it doesn't require any sort of development
         | setup to jump in. Most important, the explanations are the best
         | that I have found.
        
       | alejohausner wrote:
       | Very nice. I like it that ray tracing comes first: all the
       | problems of lighting, shadows are resolved in a more natural way.
       | Rasterization is a bit less intuitive, so it's good to present it
       | later.
        
       ___________________________________________________________________
       (page generated 2020-12-01 23:00 UTC)