Earlier quoted context omitted.
[flagged]
It is a fashion thing, it is more relevant to discuss about a game engine does ECS, than what the game is all about. Meanwhile, games like Minecraft, Balatro, Stardew Valley, Celeste, Geometry Wars,... blow up in adoption.
Software rendering in 500 lines of bare C++
71–80 of 83 posts
Re: Software rendering in 500 lines of bare C++
#72Re: Software rendering in 500 lines of bare C++
#73Is the Foley/Van Dam book still a go to resource for this? It seems it was updated in 2013, but, honestly, I’m more familiar with the ‘82 edition that was dedicated to 2D. Back in the day, it was The Book for computer graphics.
I found the course note from this github to be a good refresher on the subject. While the repo source code style is distasteful to me and their old-school rasteriser in the course is too naive and unoptimal, it's still a better read than Foley I'd assume :)
Re: Software rendering in 500 lines of bare C++
#74Earlier quoted context omitted.
I have done this on a number of platforms over the years. Going back to before createDIBSection existed (In fact I had something break when Windows provided an easy path and took away the method I had been using). Linux has always been a weird kettle of fish, the thing that worked best for me was imlib2 which was originally part of enlightenment. It did what it was supposed to do, hid pixel format conversion without…
https://zserge.com/posts/fenster/ is what I used when I wanted "basic graphics" in a cross-platform way. But of course that's X11 and much simpler.
Great overview of the whole approach you took there.
Re: Software rendering in 500 lines of bare C++
#75Earlier quoted context omitted.
I have a whole chapter on that! https://gabrielgambetta.com/computer-graphics-from-scratch/1...
I bought and I am reading through your book as I build a sw rasterizer. On the chapter of clipping, it was not entirely clear to me how many planes you clip against and how many triangles result. Presumably if you clip against all 6 planes, you get 3+6-2 = 7 triangles in the worst case, which is kind of annoying. However, if you're going to use the AAAB triangle raster method as described in this HN post, then it see…
I would not recommend anyone to write a production rasterizer using the algorithms in my book. This website seems more performance-focused (Bresenham is the obvious choice to draw lines, for example).
Specifically about clipping, you can ignore all the planes except the near plane, and everything will be fine. You'll try to draw more pixels outside the canvas but that's just slow, not problematic. The near plane does protect you from divisions by zero and from points with negative Z, which project upside down and mess things up.
Re: Software rendering in 500 lines of bare C++
#76This resource, along with Mathematics for Computer Graphics by John Vince [1], was truly indispensable when I wrote my own software renderer [2]. This was long before LLMs, so the whole process took me at least a couple months - most of it trying to wrap my head around math behind computer graphics and tracking down C segmentation faults. Fun times. [1]: https://www.amazon.co.uk/Mathematics-Computer-Graphics-John-...…
Re: Software rendering in 500 lines of bare C++
#77Re: Software rendering in 500 lines of bare C++
#78Earlier quoted context omitted.
I bought and I am reading through your book as I build a sw rasterizer. On the chapter of clipping, it was not entirely clear to me how many planes you clip against and how many triangles result. Presumably if you clip against all 6 planes, you get 3+6-2 = 7 triangles in the worst case, which is kind of annoying. However, if you're going to use the AAAB triangle raster method as described in this HN post, then it see…
My book tries to be as accessible as possible; a high schooler with little to no knowledge of linear algebra should be able to understand all of it. So in every case I've chosen simplicity (code and/or conceptually) over performance, but without sacrificing correctness. Not always an easy balancing act! I would not recommend anyone to write a production rasterizer using the algorithms in my book. This website seems m…
Re: Software rendering in 500 lines of bare C++
#79on the topic of software rendering, im surprised how little gustavo pezzi's lectures get mentioned here on hacker news.
Re: Software rendering in 500 lines of bare C++
#80on the topic of software rendering, im surprised how little gustavo pezzi's lectures get mentioned here on hacker news.
For anyone wondering, Gustavo runs https://pikuma.com/ which has a host of lectures on a variety of topics from PlayStation 1 programming to maths to triangle rasterisation.