4 ms·
If you don't need 4K PBR rendering, a software renderer is a lot of fun to write.
by user____name 11mo ago
If you don't need 4K PBR rendering, a software renderer is a lot of fun to write.
- tombert 11mo agoInteresting. I wouldn't actually mind learning how to do that; any tips on how/where to get started?
- junon 11mo agoGetting a triangle on the screen is the hello world of 3D applications. Many such guides for your backend of choice. From there it becomes learning how the shaders work, internalizing projection matrices (if you're doing 3D) which takes a bit of thinking, then slowly as you build up enough abstractions turns back into a more "normal" data structures problem surrounding whatever it is you're actually building. But it's broad, be prepared for that. Definitely recommend starting with a more "batteries included" framework, then trying your hand at opengl, then Vulkan will at least make a bit more sense. SDL is a decent place to start. A lot of the friction is due to the tooling and debugging, so learning how to do that earlier rather than later will be quite beneficial.
- rabf 11mo agoTsoding has been live streaming the development of a software renderer as of late: https://www.youtube.com/watch?v=maSIQg8IFRI https://www.youtube.com/watch?v=maSIQg8IFRI
- dmpk2k 11mo agoPikuma.com has a good one.
- RamtinJ95 11mo agoPikuma.com writes a software renderer pretty much from scratch with all the necessary math and explanations in a very pedagogical way. Highly recommend it
- dragonelite 11mo agoI can highly recommend this course, i finished it. It's one of those code katas to learn a new language with a bit like Raytracing in one weekend.
- user____name 11mo agoIf you want to render 2d vs 3d there are different tradeofs, a 3d renderer has to do interpolation of attributes over triangles, a 2d renderer doesn't and as a result can render ngons without having to triangulate them. I'm just going to dump some links really quick, which should get anyone started. Getting a framebuffer on screen: https://github.com/zserge/fenster https://github.com/zserge/fenster I would recommend something like SDL if you want a more complete platform abstraction, it even supports software rendering as a context mode. Filling solid rectangles is the obvious first step. Loading images and copying pixels onto parts of the screen is another. I recommend just not drawing things that intersect the screen boundaries to get started. Clipping complicates things a bunch but is essential. Next up: ghetto text blitting https://github.com/dhepper/font8x8 https://github.com/dhepper/font8x8 I dislike how basically every rendering tutorial just skips over drawing text on screen, which is super useful for debugging. For drawing single pixel lines, this page has everything on Bresenham: http://members.chello.at/easyfilter/bresenham.html http://members.chello.at/easyfilter/bresenham.html For 2d rasterization, here's an example of 3 common approaches: https://www.mathematik.uni-marburg.de/~thormae/lectures/graphics1/code_v2/RasterPoly/index.html https://www.mathematik.uni-marburg.de/~thormae/lectures/grap... Scanline rasterization tought me a lot about traversing polygons, I recommend trying it even if you end up preferi g a different method. Sean Barrett has a good overview: https://nothings.org/gamedev/rasterize/ https://nothings.org/gamedev/rasterize/ Side note: analytical antialising is fast, but you should be carefull with treating alpha as coverage, the analytic approaches tell you how much of a pixel is covered, not which parts are. For 3d rasterization Scratchapixel is good: https://www.scratchapixel.com/lessons/3d-basic-rendering/rasterization-practical-implementation/overview-rasterization-algorithm.html https://www.scratchapixel.com/lessons/3d-basic-rendering/ras... Someone mentioned the Pikuma course which is also great, though it skips over some of the finer details such as fixed point rasterizing. For good measure here's some classic demoscene effects for fun: https://seancode.com/demofx/ https://seancode.com/demofx/ Anyway, this is just scratching the surface, being progressively able to draw more and more types of primitives is a lot of fun.
- throwaway2046 11mo agoThis is a gold mine, thank you.
- jesse__ 11mo agohttps://raytracing.github.io/books/RayTracingInOneWeekend.html https://raytracing.github.io/books/RayTracingInOneWeekend.ht...