Features
- Geometric shape rendering
- Model loading using Assimp
- Directional and point light sources
- Blinn-Phong lighting model with linear gamma correction
- Directional shadow mapping
- Omnidirectional shadow maps
- Normal mapping
- Parallax mapping
- HDR and Bloom
The renderer uses OpenGL version 3.3, which is very widely supported. GLAD is used to handle the locating of driver-specific functions, enabling interoperability between different systems. GLFW provides easy functionality for creating an OpenGL instance, handling user input, and displaying the buffer to a window.
The engine handles the inputs from the keyboard and mouse, and therefore also handles the control of the camera. The camera and inputs are passed to the scene, which is rendered every frame. The scene contains a mixture of objects, models, and lights. In addition, there are various shaders attached to the scene that are used for different rendering conditions, like the generation of shadows.
There are four types of shaders used in the main rendering loop:
- The
directionalShadowShader performs the rendering for the depth map used in generating directional shadows.
- The
pointShadowShader performs the rendering for the depth cube map used in generating point shadows.
- The
skyboxShader is used to render the optional skybox, to add some more life to the scene.
- And finally, the
lightingShader does most of the heavy lifting, implementing the Blinn-Phong lighting model.
To generate both directional and point shadows, a shadow map is used: the scene is rendered from the point of view of the light source, and only the depth buffer is kept. This allows each fragment to determine whether or not it is blocked from the light source.
For directional light sources, an orthographic projection matrix is used to render the depth buffer of a scene. For point sources, a cube map is used instead.
Model loading is performed with Assimp, which allows for the importing of models in a multitude of formats.