banner.png

Vulkan Playground

A scene renderer that I use for learning graphics programming

 

Graphics API: Vulkan
Language: C++
Year: 2018 - now

Source repository
Windows build

This is an experimental project that I am working on to learn different graphics programming techniques. It is so far a fairly simple renderer, but I am still working on it to improve it and add more features. The program reads a file in the glTF format and renders the scene described in the file, while the user can freely move around the camera with standard first-person controls.

 
 

Features

As the project is a work in progress, it will change much over time. At the time of writing, the main features are:

A render of a test scene exported from Blender

A render of a test scene exported from Blender

  • Rendering textured objects with the Blinn-Phong lighting model

  • Alpha blending of semi-transparent objects

  • Various post-process effects in a separate render pass

  • Anti-aliasing with MSAA

  • Cubemapped skybox rendering

  • Reading scenes from glTF files

Key things on my to do-list are:

  • Implementing shadow mapping

  • Implementing normal mapping

  • Changing to the deferred rendering model

  • Implementing physically based rendering

  • Experimenting with ray tracing

  • Adding animation support

  • Using reflection on shader code for pipeline building

  • Optimizing the pipeline to run as quickly as possible

My long-term goal with this project is to have a fast renderer with all the features that you would normally expect a standard renderer to have. Ideally, I would like to have full compliance with the glTF specification to be able to correctly load and render any scene in that format, but I will focus on the parts that I think are most important. As of now, I have mostly tested the program with my own programmer art scene that I have created in Blender, but when I start implementing a PBR pipeline, I will test it with many other different scenes.

Challenges and Takeaways

I didn’t have any earlier graphics programming experience before starting on this, so learning graphics programming techniques, how to use the Vulkan API and GLSL has been a lot of work. Along the way I have also strengthened my knowledge of linear algebra, which was limited before I started on this project. When I decided that I wanted to try out graphics programming, I realized that I needed to have a good understanding of matrices and advanced vector mathematics, so I read up on the subject both in book form and on the Internet. I could still improve in this area and will make sure to do so, but luckily mathematical understanding has always been one of my big strengths.

Another challenge has been to get a good architecture for the code. It is easy to fall into the trap of having most of the functionality in a very large renderer class, which can easily become too messy or hard to maintain. This was made more difficult by the fact that I had no prior graphics programming experience and it was thus hard to determine which parts were suitable to abstract away into new classes, especially when it comes to storage of the various buffers that Vulkan requires. While my main focus has been on learning the underlying concepts, I have now also spent some effort on designing an architecture that I think works fairly well for maintainability. I think software architecture design is one of the most interesting and important aspects of software engineering and even though it can require a great deal of effort to get right, it is usually worth it in the end.