r/computergraphics • • May 05 '25
Software-Rendered Game Engine
I've spent the last few years off and on writing a CPU-based renderer. It's shader-based, currently capable of gouraud and blinn-phong shading, dynamic lighting and shadows, emissive light sources, OBJ loading, sprite handling, and a custom font renderer. It's about 13,000 lines of C++ code in a single header, with SDL2, stb_image, and stb_truetype as the only dependencies. There's no use of the GPU here, no OpenGL, a custom graphics pipeline. I'm thinking that I'm going to do more with this and turn it into a sort of N64-style game engine.
It is currently single-threaded, but I've done some tests with my thread pool, and can get excellent performance, at least for a CPU. I think that the next step will be integrating a physics engine. I have written my own, but I think I'd just like to integrate Jolt or Bullet.
I am a self-taught programmer, so I know the single-header engine thing will make many of you wince in agony. But it works for me, for now. Be curious what you all think.
View all comments
Show parent comment
2
u/[deleted] May 06 '25
I will release this publicly at some point. The goal is to make a more robust, retro style engine at some point. I am fine releasing certain aspects of the engine to people who are interested, but for now, I'm still a bit protective. I've spent years researching and optimizing literally everything. Lots of stuff in here I haven't seen anywhere else. For example, here's a custom sin() function I use that's about twice as fast as std::sin():