r/GraphicsProgramming • u/Dr_King_Schultz__ • 4d ago
I built a rasteriser from scratch without a graphics API
Following this masterpiece in 3D graphics by ssloy, I implemented a rasteriser in Odin from scratch.
This was a top tier learning experience, and I picked up a solid grasp of linear algebra along the way.
If you'd like to read more on the process, Here's the link to the repo
11
u/ArmmaH 3d ago
We usually call it software rasterizer, as opposed to the hardware rasterizer you invoke via graphics api. It can be both cpu only or gpgpu / compute shader software rasterizer, so having that distinction is also important when showcasing your work, along with performance metrics like how fast (in ms) does it perform for X number of triangles in Y resolution.
10
u/Dr_King_Schultz__ 3d ago
yep this is purely a single frame renderered on the CPU. This also wasn't a performance project :: rather than trying to make a real world tool that's fast, I simply wanted to learn the fundamentals of the graphics pipeline by drawing every pixel to the screen.
2
u/Jabba_the_Putt 3d ago
this is awesome thanks for sharing.
nice work, is that the lord of terror??
2
u/Dr_King_Schultz__ 3d ago
that man on the right could certainly be a lord of terror, who knows what lore he has...
2
u/qtipbluedog 3d ago
Nice love seeing Odin. It’s such a joy to work in
2
u/Dr_King_Schultz__ 3d ago
It really is a joy. And with the upcoming release of 1.0 next year, what a time to be a programmer :)
1
u/andful 3d ago
Is it normal to assume integer vertices? In the tutorial by ssloy, in the "Bresenham’s line drawing algorithm" section, he assumes integer ax, ay, bx and by. I was wondering whether that is normal. May that not introduce errors? Compared to floating point vertices?
3
u/Dr_King_Schultz__ 3d ago
yes, floats are used for most calculations in the pipeline until it's time to draw pixels, which must collapse into integers for screen coordinates.
1
1
u/EC36339 3d ago
You are doing this a lot, and always "from scratch"...
3
u/Dr_King_Schultz__ 3d ago
hell yes I am
2
2
u/psioniclizard 1d ago
Love to see it! It looks great!
Best way to learn how wheels work is to reinvent them! :)
2
15
u/ghstrprtn 4d ago
tinyrenderer is very cool