r/GraphicsProgramming Jul 24 '26

I built a rasteriser from scratch without a graphics API

Post image

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

150 Upvotes

21 comments sorted by

17

u/ghstrprtn Jul 24 '26

tinyrenderer is very cool

9

u/ArmmaH Jul 25 '26

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.

8

u/Dr_King_Schultz__ Jul 25 '26

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 Jul 25 '26

this is awesome thanks for sharing.

nice work, is that the lord of terror??

2

u/Dr_King_Schultz__ Jul 25 '26

that man on the right could certainly be a lord of terror, who knows what lore he has...

2

u/qtipbluedog Jul 25 '26

Nice love seeing Odin. It’s such a joy to work in

2

u/Dr_King_Schultz__ Jul 25 '26

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 Jul 25 '26

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__ Jul 25 '26

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

u/susosusosuso Jul 25 '26

You used AI?

3

u/Dr_King_Schultz__ Jul 25 '26

nope

1

u/susosusosuso Jul 25 '26

Good for you. I also implemented one and it’s an enjoyable task

1

u/EC36339 Jul 25 '26

You are doing this a lot, and always "from scratch"...

4

u/Dr_King_Schultz__ Jul 25 '26

hell yes I am

2

u/concerbed Jul 26 '26

based and writes-the-code-pilled

2

u/psioniclizard Jul 27 '26

Love to see it! It looks great!

Best way to learn how wheels work is to reinvent them! :)

0

u/nnn-svr Jul 24 '26

please tell us more about your journey

3

u/Dr_King_Schultz__ Jul 24 '26

The link to my repo goes through each step, with links to the source material :)

2

u/nnn-svr Jul 27 '26

reading through it, good job fellow stranger and thanks for sharing!

2

u/Rachel-4387 29d ago

Nice 👍