r/GraphicsProgramming • • Oct 18 '26

Progress on Software Rendered game in C

Enable HLS to view with audio, or disable this notification

This is some progress of a free game i have been working. This is fully software rendered on the CPU and OpenGL is only used to render the image. I use multiple threads to render the game at full 1080p. Using SIMD instructions helps a lot to get a decent frame rate. But i am still kinda dissapointed by the performance, i think Michael Abrash's binning technique would improve it, but right now, it is decent. I am getting around 70-140 frames with I5-12400.

506 Upvotes

34 comments sorted by

View all comments

Show parent comment

2

u/Batteryofenergy1 Oct 22 '26

I tried the mip map method before, but i had problems with presicion. I just use the full resolution depth buffer to test against. I first check the edge points of the bbox first, if any of them return true, i can early out. Otherwise i check the entire bbox pixel by pixel.

1

u/deftware Oct 22 '26

check the edge points of the bbox first

Nice. It sounds like the most expensive part then is when a bbox doesn't early-out and you're checking it against all of the pixels. The larger the bbox the more depth pixels it checks against. At that point I would suggest taking another look at getting min/max miptree building cooking, you could build both of them simultaneously - walk the depth buffer once to build both.

I forgot to show this to you https://hacksoflife.blogspot.com/2016/05/simultaneous-mipmap-level-generation.html

Once you have your min depth miptree then each bbox is just a check against one mip pixel.

Anyway, just my two cents. Have you done any profiling yet to see where the slowest parts of your renderer are?

2

u/Batteryofenergy1 Oct 23 '26

I am actually planning to implement some basic precomputed visibility volumes to reduce the surface count i have to cull. I am looking at some methods that are used in Source2 https://developer.valvesoftware.com/wiki/Source_2_Docs/Level_Design/Visibility and Unreal engine https://dev.epicgames.com/documentation/unreal-engine/precomputed-visibility-volumes-in-unreal-engine. Even from thief https://nothings.org/gamedev/thief_rendering.html .

Not slowest, but pixel filling functions take most time(functions that actually output to the pixel buffer). Drawing the static geometry, takes the most time especially since i use Lightmaps.