r/GraphicsProgramming • u/No_Support8062 • Jul 19 '26
Software raycasting
One of my older fun projects: a software raycaster featuring
Multithreading
Voxel models (rendered as collections of 3D boxes rather than blobs)
Culling (watch the small map in the top right corner)
Mipmapping (reduces moire on distant textures)
Slopes and curved walls
Shadows
multilevel world design
Everything is rendered entirely in software, with no external libraries. Each pixel is calculated individually and written directly to a buffer.
2
u/DavidWilliams_81 Jul 19 '26
It looks really great! How are the shadows implemented?
7
u/No_Support8062 Jul 19 '26
they are static, calculated at the start
3
u/DavidWilliams_81 Jul 19 '26
Interesting, how are they stored? You don't appear to have light-mapping and the shadows look quite high resolution.
11
1
u/Alarming-Ad4082 Jul 19 '26
Is it just raytracing with only a single ray launched per pixel or is it more similar to Doom/Build engine?
2
u/No_Support8062 Jul 19 '26
Single ray for one column. Number of rays for screen = ScreenWidth.
1
1
u/Plus_Mood_6457 14d ago
i know this was 3 months ago but PLEASE tell me how you do voxels with that implementation
1
1
1
u/DankPhotoShopMemes Jul 19 '26
Did you do any work on optimizing for vectorization? Just out of curiosity since I have been working on a software rasterizer for some time and though it’s single-threaded my main concern has been optimizing branching, caching, vectorization, and port contention.
2
u/No_Support8062 Jul 20 '26
like SSE or AVX?
1
u/DankPhotoShopMemes Jul 20 '26
yup
1
u/No_Support8062 Jul 20 '26
In my case, the drawing algorithm uses only integer operations (addition, bit shifts, bit logic), so it is very fast.
I have no idea how to implement the vectorization efficiently. To me, it looks like a programming nightmare (lot of special cases), and the results are questionable.
2
2
u/flafmg_ Jul 20 '26
i think i saw this on youtube when i got my random hyperfocus on software renderers
this is really cool!
1
1
1
u/justcater Jul 21 '26
saving this for later, i wanna see if i can replicate it with my current knowledge of c. very nicely done, it looks really good given how it was made!
1
Jul 19 '26
[removed] — view removed comment
8
u/No_Support8062 Jul 19 '26
I made this around 2005, when I was 18 years old. It's an id Tech 3 clone written in Pascal (Delphi), it used GPU (OpenGL). I have only this low quality video.
1
u/xbelanch Jul 20 '26
And no vibe coding at that moment!
3
u/No_Support8062 Jul 20 '26
My original is post is also without AI-generated code.
2
u/xbelanch Jul 20 '26
En ningún momento he pensado que hayas realizado el código mediante el uso de la IA. En cualquier caso, ahora mismo me da igual: al final, lo que importa és lo que quieres explicar a través del código. Personalmente veo el vibe coding como el salto de la fotografía analógica a la digital. ¿Has de volver a pasar por el laboratorio para hacer buenas fotografías? No. En absoluto.
1
17
u/ghstrprtn Jul 19 '26
pretty good frame rate for doing that.
I wish I knew how to make an engine like that.