OpenGL Graphics Framework
As part of the Advanced Computer Graphics class at the DigiPen Institute of Technology, we were tasked with creating a graphics framework utilizing the OpenGL API.
My framework was built with C++, Glad, and GLFW. GLM, STB, and Tiny OBJ Loader were also included for quality of life additions.
Additionally, ImGui was included to provide a user interface with which to change certain parameters of the graphics framework in real-time.
Phong Shading
One of the first big tasks in getting this framework up and running was implementing the Phong shading model. OBJ files are loaded into memory and drawn to the screen with shaders written in GLSL. Features include:
- support for 16 lights
- Phong-Blinn shading
- real-time parameter changes to the model’s ambient, diffuse, and specular terms
- real-time parameter changes to light properties
The Stanford Bunny surrounded by orbiting light spheres. The orbs light the scene as a point light, a spot light, or a directional light. The bunny is rendered using the Phong shading model.
Textures
Textures are loaded in with the stb-image library. UVs can be generated for the model on the CPU or on the GPU. The texture coordinates can be mapped with cylindrical, spherical, and planar mapping.
Debugging and changing properties in real-time.
The ImGui interface allows for changing and viewing various parameters in real-time. Different models can be loaded in dynamically, material properties can be modified, and certain rendering features can be turned on and off.
This was cruicial in the development of the framework to ensure that work-in-progress features were rendering properly.
Reflections and Refractions
A skybox is rendered with depth testing turned off in order to appear in the background.
Cube mapping is implemented by rendering the scene 6 times to an FBO from the perspective of the object.
Reflection and Refraction sample from the generated cube map after appropriate reflection and refraction calculations for each fragment.
Deferred Rendering
Previously much of the project had been rendered using forward rendering. Now the scene could be rendered with a combination of deferred rendering and forward rendering.
Objects such as these high poly power plant models are marked for deferred rendering. Various elements of the model are rendered to render targets part of a g-buffer. These targets are then combined for a final lighting pass.
More light-weight debug objects such as the light orbs and vertex normals are rendered after the deferred rendering pass using forward rendering.
Rendering of the Power Plant model which consists of 12,748,510 triangles. 4 different render targets as part of deferred rendering are visualized at the bottom of the screen.
More Projects⮕