9.5 KiB
Little Vulkan Engine
A video tutorial series introducing computer graphics for Vulkan®, the new generation graphics and compute API from Khronos.
Currently this repository is more for use as a reference and for my own use to track the progress of this series, rather than something that can be cloned and used as a starting point, at least until I make a more robust build system.
Table of Contents
Building
This repository is still in the early stages and doesn't contain everything you may need to compile and build the code on your machine. If you wish to use this as a starting point for your project my recommendation is to follow the tutorial series. Any contributions to making a more robust, multi-platform build system are appreciated :)
Tutorials
Basics
00 - Starting Point
This is the staring point to the tutorial series. It is equivalent to where you'd be at if you completed the linux section of setting up your development environment as described by Vulkan Tutorial with just a few small changes.
01 - Opening a window
In the very first tutorial of this series we will be creating a class to encapsulate a glfw window, and a class to run our application.
02 - Shaders & the graphics pipeline
In this tutorial we create the most basic of vertex and fragment shaders files, go over how to compile them to SPIR-V, and read the compiled files into our c++ program, to later be used to create shader modules in the next tutorial.
03 & 04 - Pipeline Creation & Vulkan Device
In this tutorial we configure our graphics pipeline create info to prepare our pipeline for drawing. We read in the compiled shader files created in the previous tutorial and use them to create shader modules. We also have added the lve_device helper file which encapsulates a vulkan device and functionality for creating a vulkan instance, setting up validation layers, picking a physical device and creating a logical device and queues. Additionally, there is a bit of helper functionality.
05 - Command Buffers & the Swap Chain
We finally draw a triangle!! In this tutorial we cover command buffers and give a brief overview of the swap chain, and the initial functionality we will be using to draw to a window.
06 - Vertex Buffers
In this tutorial, we will cover how vertex buffers store data, and can be bound to graphics pipelines. A vertex buffer is really just a chunk of memory that we pass into our vertex shader. We can put whatever data we would like into this memory as long as we tell our graphics pipeline how it is structured.
07 - Fragment Interpolation
We update the vertex struct and buffer to include an additional color attribute. We then use the color attribute to demonstrate fragment interpolation for values output from the vertex shader to the fragment shader.
08 - Swap Chain Recreation & Dynamic Viewports
We set up a callback function that listens to changes on the glfw window and updates the dimensions of the window wrapper class. When the window is resized we must create a new compatible swap chain.
09 - Push Constants
Vulkan Push constants are an easy and performant way to pass data to a shader, via a vulkan command buffer rather than writes to memory or copy commands. They’re a great option for data that updates frequently, however have a main drawback of being limited in size.
10 - 2D Transformations
Matrices are an incredibly useful tool for representing linear transformations on geometry. In this tutorial we cover 2d transformation matrices and use them in our shaders to stretch, shrink and rotate our vertex position.
11 - Renderer & Systems
This is a coding focused tutorial with not much theory. We restructure our application class by creating a Renderer class and a SimpleRenderSystem class. This modular and flexible design should make implementing many future topics possible and easy to integrate into the engine.
12 - Homogeneous Coordinates & Euler Angles
We finally moved to 3D! In this tutorial we update the engine to use 3D positions and homogeneous coordinates, opening the possibility to more complicated transformation matrices.
13 - Projection Matrices
We implement functions to create the orthographic projection and the perspective projection matrices. Projection matrices change the shape and location of vulkan’s canonical view volume.
14 - The Camera Transform
We implement the camera/view transform. This allows us to place a virtual camera anywhere within the game world, which makes it possible to control what is captured by the viewing frustum and displayed to the screen.
15 - Game Loops and User Input
Getting user input and time loops are both integral parts to any game engine and are complex topics. In this tutorial I briefly introduce the concepts and we add the ability to dynamically move the camera in a frame rate independent way.
16 - Index and Staging Buffers
Index buffers are a way to reduce the amount of gpu memory required to store a model’s attribute data by allowing duplicate vertex data to be removed from the Vertex Buffer.
17 - Loading 3D Models
In this tutorial we make use of tinyobjloader, a tiny but powerful single file wavefront obj loader, to load 3D models into the engine.
18 - Diffuse Shading
we implement a diffuse lighting model with a constant ambient light term in the vertex shader. This colors the vase object by calculating the intensity of light for each vertex based on how directly the surface at the point faces the incoming light.
Official Khronos Vulkan Samples
Khronos made an official Vulkan Samples repository available to the public (press release).
You can find this repository at https://github.com/KhronosGroup/Vulkan-Samples
Credits
Thanks to the authors of these libraries :
Thanks to LunarG
Thanks to the wonderful opensource examples by Sascha Willems
Thanks to ThinMatrix and his wonderful OpenGL game tutorial series which was a huge inspiration for this series and how I first started learning computer graphics
Thanks to Sean Plott and the #DK30 challenge, for providing the motivating kick to give this a shot
Attributions / Licenses
- Vulkan and the Vulkan logo are trademarks of the Khronos Group Inc.