10 ms·
Computer Graphics from Scratch (2017)
- rafaelvasco 6y agoAs an eternal student and enthusiast of computer graphics, this is golden;
- chompychop 6y agoAnother 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 6y agoThe Ray Tracer Challenge is an awesome book. It was really fun to code the ray tracer!
- news_to_me 6y agoThis 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.
- chompychop 6y agoCould you tell what resources you found the most helpful for optimising memory in the context of raytracing/rasterisation?
- echelon 6y agoThat 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.
- Jasper_ 6y agoYou 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#L108-L188 https://github.com/magcius/sw3dv/blob/gh-pages/sw_rast.js#L1...
- news_to_me 6y agoI 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 https://git.sr.ht/~zjm/Moon3D. There's also some screenshots/progress updates on my Twitter: https://twitter.com/zackmichener https://twitter.com/zackmichener [0]: https://www.pearson.com/us/higher-education/product/Foley-Computer-Graphics-Principles-and-Practice-in-C-2nd-Edition/9780201848403.html https://www.pearson.com/us/higher-education/product/Foley-Co... [1]: https://www.youtube.com/watch?v=01YSK5gIEYQ&list=PL_w_qWAQZtAZhtzPI5pkAtcUVgmzdAP8g https://www.youtube.com/watch?v=01YSK5gIEYQ&list=PL_w_qWAQZt...
- gwittel 6y agoWhen I wrote one it was part of an intro to computer graphics class at university (sample syllabus https://web.cs.ucdavis.edu/~ma/ECS175/ 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.
- reggieband 6y agoA 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.
- alejohausner 6y agoVery 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.
- Threeve303 6y ago> "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.
- FartyMcFarter 6y agoMany versions of SQL are Turing complete, so one can probably do both at the same time!
- imhoguy 6y agoHere it goes - MySQL raytracer https://www.pouet.net/prod.php?which=83222 https://www.pouet.net/prod.php?which=83222
- User23 6y agoEveryone 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.
- enriquto 6y ago> 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.
- 6y ago
- suyash 6y agoYes another computer graphics tutorial, there are tons of these out there. Would have loved to see southing unique about it.
- kevinskii 6y agoI 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.
- dang 6y agoIf curious see also 2019 https://news.ycombinator.com/item?id=19584921 https://news.ycombinator.com/item?id=19584921
- trilinearnz 6y agoAn 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 6y agoHi! 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!
- rustybolt 6y agoCongrats on finishing the book. I hope it will turn out to be a good investment of your time :)
- agytvfr 6y agoThanks 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 6y agoI 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 https://en.wikipedia.org/wiki/Mystery_Studio [1] http://https://legacygames.com http://https://legacygames.com
- agytvfr 6y agoThank you for taking the time to respond!
- blondin 6y agooh wow! thanks a lot for writing the book. definitely looking forward to it. this tutorial is definitely top 3 for me.
- jholman 6y agoBecause I am a big jerk, I am going to take this opportunity to complain about a pet peeve, and ask for brainstorming help. This (generally-pretty-great) book, like many educational materials about computer graphics, makes a terminological choice that I believe to be plainly a mistake. It uses the word "rasterizer" to mean "renderer that works by applying transforms to polygons", as contrastive with a "raytracer" (more generally, a physically-based light transport model). (e.g. "Raytracing and Rasterization, which focus on the two main ways to make pretty pictures out of data"). Properly (from a descriptivist standpoint), a "rasterizer" is any algorithm that transforms vector data into raster data, where rasters are arrays of horizontal lines, each horizontal line composed of pixels. RAYTRACERS ARE RASTERIZERS. (I mean, not if you're using the raytracer to detect collisions or for some other purpose; only if you're using it to generate 2d images of any kind.) Surely there must be some better terminology for the non-physically-based option? I tend to say "polygon-pusher", but this is my own neologism. Does anyone have any suggestions for a more accurate name for this type of renderer? Saying "rasterizer" in the sense the book does is as common as saying "literally" to mean "figuratively", as common as writing "there" to mean "they're". So I know that probably there's no fixing it. But I'm still hoping.
- dTal 6y agoIf you want more technically accurate terms, you might call raytracers and polygon-pushers "image space" and "geometric space" renderers, respectively. Worth noting that neither method is particularly physically based, and really just boils down to whether you approach the rasterization task "forwards" or "backwards". Which method ends up faster is essentially a function of how much geometry and how many pixels you have.
- identity0 6y agoOh come on, don't be pedantic. There is a term for non-physically-based rendered, it's called "rasterization". Just because it's technically incorrect doesn't mean it's any less of a colloquial term. To ignore this is to ignore how language actually works. Even the wikipedia page for Rasterization compares it with ray tracing.
- dahart 6y ago
- cmason 6y agoDoes anyone have suggestions of a similar tutorial or intro to 2D graphic implementation?