Simple Software Graphics Engine (SSGE)

repository·master·Indexed 21 days ago

https://github.com/angelo1211/softwarerenderer

A pure software-based 3D graphics engine written in C++ that implements Physically Based Rendering (PBR) without hardware acceleration. SSGE features a parallelized forward renderer, programmable vertex/fragment shaders, Cook-Torrance specular BRDF, and optimizations including SIMD, multithreading, and frustum culling. It utilizes SDL2 for multiplatform support and includes a templated linear algebra library and .obj file parsing.

Tokens
938
Snippets
1
Records
6
Agent score
23%

What's inside SSGE

  1. Overview of Simple Software Graphics Engine (SSGE)

    master

    SSGE is a real-time, interactive 3D renderer built entirely in C++ from scratch. Unlike traditional engines, it is a pure software renderer that does not use hardware acceleration (no OpenGL, DirectX, or Vulkan). It implements modern Physically Based Rendering (PBR) and is optimized for performance using multithreading, SIMD directives, early backface culling, frustum culling, and texture tiling.

    Key Capabilities:

    • Rendering: Parallelized forward renderer, programmable vertex/fragment shaders (via C++ virtual functions), Cook-Torrance specular BRDF, Tangent Space Normal Mapping, and Ambient Occlusion mapping.
    • Engine: SDL2 backend for multiplatform support (Windows/Linux), .obj file parsing, and scene management via .txt files.
    • Performance: Capable of ~50k triangles and 4 light sources at ~30fps using PBR shaders.
  2. Known Issues and Limitations

    master

    Users should be aware of the following current limitations in the SSGE renderer:

    • Aliasing: Moire patterns and specular aliasing occur due to a lack of texture minification. Jaggies are present due to a lack of antialiasing.
    • Lighting: Dark metallic objects appear due to the lack of Image Based Lighting (IBL). There is no shadow implementation, which may cause undesired illumination.
    • Precision: Stuttering may occur during slow rotations due to a lack of sub-pixel precision.
  3. Core Rendering Features

    master

    The SSGE rendering pipeline includes the following technical features:

    • Shading: Physically Based Shading (PBR) with Metallic workflow, Cook-Torrance specular BRDF (with Lambert diffuse), and support for Directional Lighting.
    • Shaders: Programmable vertex and fragment shaders implemented using C++ virtual functions. (Note: Flat, Gouraud, Phong, and Blinn-Phong shaders are deprecated in favor of PBR).
    • Mapping & Filtering: Tangent Space Normal Mapping, Ambient Occlusion mapping, Bilinear Texture Filtering, and Seamless texture repeat.
    • Optimization & Precision: Perspective Correct Interpolation, Reverse (logarithmic) Z-Buffering, Pre-vertex shader back-face Culling, View Frustum culling, and a Gapless triangle rasterizer.
    • Color: Fast Gamma correction.
  4. Core Engine Features

    master

    The engine architecture provides the following utilities and systems:

    • Backend: SDL2 for OS and hardware-level abstraction, enabling multiplatform executables.
    • Camera Systems: Free moving camera, Orbiting Camera mode, and Camera FOV controls.
    • Math & Data: Templated Vector Math / Linear algebra library and Axis aligned Bounding Box (AABB) generation/reconstruction.
    • Assets: .Obj file parser for meshes and stb-image for image loading.
    • Scene Management: Scene switching and scene content defined via .txt files.
    • Optimizations: Multithreading per object, vectorization within lighting shaders, and texture tiling to reduce cache misses.
  5. Initialize and run the SSGE engine

    master

    To use the Simple Software Graphics Engine (SSGE), instantiate the Engine class and follow the lifecycle: startUp() to initialize the system, run() to enter the main rendering loop, and shutDown() to clean up resources. The startUp() method returns a boolean indicating whether initialization was successful.

    Engine SSGE;
    if(SSGE.startUp()){
        SSGE.run();
    }
    else{
        printf("SSGE could not initialize successfully. Shutting down.\n");
    }
    SSGE.shutDown();