Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


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.


Could you tell what resources you found the most helpful for optimising memory in the context of raytracing/rasterisation?


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.


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_qWAQZt...


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.


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...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: