Portfolio/RaskGL

Overview

RaskGL is a modular 3D graphics rendering sandbox built in C++ using the OpenGL 4.x core profile. Developed as a focused technical exploration, the engine was built to gain deep practical command of modern GPU programmable pipelines, linear algebra for computer graphics, and foundational rendering algorithms before venturing into explicit APIs like Vulkan.

The project incorporates custom shader abstractions, lighting models, camera navigation controls, and asset importing pipelines.


Graphics Pipeline & Features

1. Illumination & Shading Models

  • Blinn-Phong Lighting: Per-fragment specular calculation using the half-way vector to achieve smoother, more physically accurate specular highlights.
  • Multi-Light System: Dynamic support for combined directional sunlight, point lights with distance-based attenuation, and focused cone spotlights.
  • Material Properties: Decoupled diffuse, specular, and ambient coefficients with shininess control per mesh.
// Fragment shader: Specular reflection via halfway vector
vec3 calculateBlinnPhong(vec3 normal, vec3 viewDir, vec3 lightDir, vec3 lightColor) {
    vec3 halfwayDir = normalize(lightDir + viewDir);
    float specFactor = pow(max(dot(normal, halfwayDir), 0.0), material.shininess);
    return lightColor * material.specular * specFactor;
}

2. Environment & Texturing

  • Cubemap Skyboxes: Seamless celestial and environmental skyboxes rendered with cubemap texture samplers and depth testing optimization.
  • Texture Maps: Support for diffuse, specular, and emissive texture maps with anisotropic filtering and mipmap generation.

3. Camera & Input System

  • Smooth Fly-Through Camera: Euler angle camera controller supporting pitch, yaw, roll, and zoom (field of view adjustments) with frame-rate independent interpolation.

Technical Architecture

RaskGL/
├── Core/
│   ├── Window.cpp (GLFW windowing & events)
│   └── Camera.cpp (View matrix calculations)
├── Renderer/
│   ├── Shader.cpp (Compilation, linking, uniform cache)
│   ├── VertexArray.cpp (VAO abstraction)
│   ├── VertexBuffer.cpp (VBO & Layout descriptions)
│   └── Texture.cpp (stb_image integration)
├── Scene/
│   ├── Model.cpp (Assimp mesh hierarchy)
│   └── Mesh.cpp (Sub-mesh drawing)
└── Shaders/
    ├── default.vert
    └── lighting.frag

Architectural Decisions

  • Resource Encapsulation (RAII): OpenGL buffer objects (VAO, VBO, EBO, FBO) and texture handles are strictly managed through C++ RAII wrappers to prevent GPU memory leaks.
  • Uniform Caching: Shader class maintains an internal hash map of uniform names to OpenGL locations, eliminating redundant GPU driver queries on draw calls.
  • Model Importing: Integration with Assimp to parse multi-mesh hierarchies, materials, textures, and vertex attributes from modern formats (OBJ, FBX, glTF).

Technical Specifications

ComponentLibrary / StandardRole
LanguageC++17Core engine implementation with RAII memory safety.
Graphics APIOpenGL 4.5 CoreModern programmable pipeline (GLSL 450).
Window & InputGLFWCross-platform window creation, OpenGL context, input handling.
Extension LoaderGLADDynamic OpenGL function pointer loading.
Math LibraryGLMMatrix transformations, vectors, projection calculations.
Asset LoaderAssimp3D model parsing and mesh normalization.

Key Takeaways

  • Developed strong foundational mastery of GPU pipelines, coordinate spaces (Model, World, View, Clip, Screen), and projection mathematics.
  • Built intuitive appreciation for CPU-to-GPU memory transfer bottlenecks and draw call overhead, forming the direct stepping stone to developing MaikEngine (Vulkan 1.3).