To assist me with my Master’s degree in Computer Graphics, I made a basic OpenGL renderer in C++. Over the course of two years, I implemented some of what I had learned in class, the basics of this exciting field.

Code available on GitHub or download ZIP.

Here is what I implemented.

Blinn-Phong reflections#

Blinn-Phong shading is a basic model that nevertheless produces surprisingly satisfying results. Here are some examples of light reflections using this model.

Omnidirectional shadow mapping#

When it comes to having point lights in a scene, simple shadow maps are not enough, as shadows are omnidirectional. Generating a depth map from the perspective of the light in a cubemap solves this problem. However, this involves rendering the scene 6 times per point light.

B-Splines surfaces#

By discretizing B-Splines into a set of vertices at a desired frequency, I can generate meshes of parameterized smooth surfaces. Like this terrain, for example.

Wireframe views#

Meshes subdivision#

For subdividing meshes geometry, I used the Uniform Loop subdivision algorithm from the OpenMesh library. The vertices normal debug visualization is using a geometry shader.

Implicit surfaces#

Implicit surfaces are rendered using the Marching Cubes algorithm to generate the mesh on the CPU at run-time. Although looking nice, performance quickly becomes poor as the grid size is increased.

Skeletal animation#

Meshes can be rigged with hierarchical bones for animation. To do this, I use the linear blending skinning algorithm, which unfortunately can easily produce candy-wrapper artifacts (not visible on the example images, as I wanted to hide it on my project report..).

glTF loading#

Using the glTF 2.0 Quick Reference Guide, I’ve started to implement a .glTF scene loader. Unfortunately, it’s incomplete, as it doesn’t cover the whole specification.

References#

  1. Blinn Phong reflection model - en.wikipedia.org/wiki/Blinn%E2%80%93Phong_reflection_model

  2. Point Shadows - learnopengl.com/Advanced-Lighting/Shadows/Point-Shadows

  3. B-Splines Surfaces - pages.mtu.edu/~shene/COURSES/cs3621/NOTES/surface/bspline-construct.html

  4. OpenMesh - graphics.rwth-aachen.de/software/openmesh

  5. Implicit Surfaces - paulbourke.net/geometry/implicitsurf

  6. Skeletal Animation - homepages.inf.ed.ac.uk/tkomura/cav/presentation4_2020.pdf

  7. glTF 2.0 Quick Reference Guide - khronos.org/files/gltf20-reference-guide.pdf