Game engine video tutorial series using Vulkan (C++)
blurrypiano Education and Career DK30 Fall 2020 1 4
Description
I’m going to create a video tutorial series introducing computer graphics and the Vulkan API geared towards individuals with C++ programming experience but little to no experience working with computer graphics. The Vulkan API unfortunately has developed a bit of a reputation for having a very steep learning curve, and I think this is partly due to a lack of educational resources that are aimed at taking someone from getting started to the more advanced concepts and I hope to remedy this with my video series. This isn’t going to be a series for someone who would want to make a video game in the next 6 months or even a year, for something like that I’d recommend learning an existing game engine like unity.
Recent Updates
I’ve finally completed my original goal!! (and I was only off by about 2 months hahaha). Here’s all the videos so far: https://www.youtube.com/channel/UC9pXmjxsQHeFH9vgCeRsHcw/videos
So what I originally thought I could cover in 4 videos, I ended up covering over 7 videos. This is definitely the biggest milestone I’ve ever completed for a personal project. I have a pretty extensive history of starting projects and leaving them half finished.
Of course, I do really enjoy making the videos! But I’ve enjoyed most of the projects I’ve worked on, and that hasn’t prevented me from putting things off in the past. I’m not really sure what made this time different. I think starting out with the DK30 provided a big enough push to get the first video out. And then following that, I’ve felt obligated to keep things going, so as to not let down the guys following the tutorial series, which is just enough of a push to not put things off.
Anyway, thank you to anyone whose followed along, as well as to Sean and all the other people who have worked to create DK30 and the community. I’m looking forward to DK30 Winter 2021!!
This will be my final post for this project. I’ve uploaded Tutorial 1 which can be found here: https://youtu.be/lr93-_cC8v4
I’m very much excited to keep making these and improving at it, but I’m not yet satisfied with the quality of the tutorials. Even after completely redoing this tutorial, it doesn’t meet the standard I’d feel good about putting out.
I considered not releasing this, or keeping it unlisted. But I’ve settled on releasing it so I can keep moving forward, and maybe after a few more videos I’ll have improved enough that if I consider this first video significantly worse, I’ll redo it for a third time.
I think the educational content is solid, more so that my delivery needs to be improved and I should elaborate more on what I am doing, and why. There are too many periods of silence where I’m typing and not teaching, and I’d like the tone to be a bit more conversational and feel less scripted or forced.
Anyway, this is a decent start. Thank you to everyone who has watched the first video, and to my first subscriber!!! That really made my day :)
Cheers.
Finished
It took me a few extra days to finish because I was being lazy, but the introduction video has been uploaded and can be found here https://youtu.be/Y9U9IE0gVHA
The video for tutorial 1 is also finished and will be uploaded tomorrow.
Overall I’m really happy with how this thirty day challenge went. I may not have quite hit my target but I learned a lot this past month and really started to develop a good process for making these tutorial style videos which is the most important thing since I want to keep making these.
I’m really grateful towards this community. The past month has been difficult for myself and my entire family after the passing of my grandmother from a 3 year battle with cancer. I’m glad I got back to work on this when I did, and didn’t let myself give up or put it off to who knows when.
I’m already looking forward to the next DK30, and for anyone who has followed along with these posts, thank you!
Day 27
Spent some time today working on input attachments and doing multiple renderpasses which revealed some problems with some of the current abstractions I’m using for vulakn objects. So I changed how the engine handles swap chains, frame buffers and render passes. While most of this stuff won’t be touched till much later on in the tutorial series, the changes related to the swap chain will impact tutorial 2 and onwards, so it’s a good thing I figured it out now.
Other than that just did a bit of work on tutorial 1. Tomorrow might be a bit of a crunch as I’ll need to do recording and editing if I’m to get tutorial 1 finished for the end of DK30.
Day 26
I pretty much completely finished editing for the first video and it’s almost ready to go. All that remains are some final touch ups, video description, thumbnail, etc.
Day 23
I’ve completed the last demo I’ll be showcasing in the first video introducing the tutorial series. I think I can cover all of the topics in the content showed in the first 20 - 25 ish videos.
Going into the final week of the #DK30 I’m pretty excited. This is the final stretch and my adjusted goals are to finish the introduction tutorial 0 video and the tutorial 1 video, and upload them to youtube. My stretch goal will be to complete the tutorial 2 video. At the start of this I thought I might be able to complete 4 videos, but I’ll be very happy with getting 2/4 finished!
Steering behaviours based on the paper by Craig Reynolds (https://www.red3d.com/cwr/boids/)
Getting the cones to follow the gradient of the terrain properly was a !@#$% :P
Day 22
Today was a really long day of coding, so going to just give a short update.
Completed steering behaviours and integrated them into the generated terrain scene. Getting the objs to follow the surface of the terrain was a bit tricky, and I got a bit stuck spending time of the math for sampling theory, gradients, and normals. But eventually got things working :)
So I pretty much completed everything on my list of features for the tutorial preview content. Now I need to start making the tutorial videos.
Day 21
Generated a terrain using a very simple solid noise algorithm, and added a atmospheric fog effect. I didn’t want to spend time today making it look pretty, so I just went for a sand dune like coloring and left it at that.
Possible future extensions: I think I should be able to make a terrain using this method that dynamically adjust its level of detail based on distance from the camera. The method is kind of hard to explain but I’ll try giving the gist.
Currently I use my noise alg to generate a height map, and apply those heights directly to each models’ vertex position. The terrains model consists of a grid of equally spaced vertices.
However, instead I could have a completely flat terrain model with more triangles near the scenes camera, and a sparser representation far away. This model is fixed in position and doesn’t actually move when the camera moves in the x or z directions, or pans. Instead of applying the heights to the model directly, we store them in a 2D texture which the vertex shader samples and dynamically adjusts the terrains height (a displacement map) based on where the camera is looking.
That’s the basic idea. There’s a couple edge cases to account for but I think it should work.
Day 20
I’ve finished implementing loading in more complicated models and applying textures to them. I’m not a 3D artist so I did not make this amazing model, but here’s a demo scene rendered in the engine.
This viking room model was made by nigelgoh (CC BY 4.0).
model link: https://sketchfab.com/3d-models/viking-room-a49f1b8e4f5c4ecf9e1fe7d81915ad38
Day 19
Took a bit longer than I thought it would, but completed the sphere being shaded using 3 different lighting models. From left to right is toon shaded, specular and diffuse
Day 18
I spent some time doing a bit of project planning and now I have a pretty good idea of what I want to get done for this week.
Based on feedback from a friend, I’m going to break the first tutorial video into 2 separate videos, with the first video being more of an introduction to the series and setting up your development environment, and the second video being tutorial 1 showing how to create a window.
For the intro video I need to complete the content showing a preview of what I plan to cover at the start of the series. I’ve decided I want to create 4 demo scenes showcasing these features.
- A sphere being shaded using 3 different lighting models (diffuse, phong and toon)
- A more complicated 3D model with an applied texture in a skybox
- Procedural terrain generation with an atmospheric fog affect
- moving game objects, steering behaviours and a controllable camera
I want to complete and record one of these scenes every day, and then use the final day to put it all together and create the video introducing the series.
Day 17
In the process of building out the engine. The engine now is capable of drawing a triangle and contains the code that will be implemented over the first 7ish tutorials. There are still quite a few fundamental aspects that are missing that I’ll need to figure out how I want to structure over the next few days.
Day 16?
Unfortunately I had some life things come up, so I haven’t been working on this the past week or so. But I’ve finally gotten back to work on it as of today.
I’m trying to figure out what the general structure of the engine will eventually be by about tutorial 25. This way I’ll be able to avoid unnecessary refactoring in later tutorials and have a consistent direction to go in.
Day 6
Got a little sidetracked today and ended up working on the code and script for tutorial 2. This may be me getting a bit ahead of myself. I think the reason for this was I was working on a tricky section of the graphics engine and hit a bit of a roadblock. Instead of pushing through I let myself work on something easier and more interesting. While this is work that needed to be done too, I should focus on staying on track for meeting my weekly goals.
So I’ll have to focus tomorrow on getting some nice visuals as the first tutorial cannot be released until that’s finished.
Week 1 goal revision
I want to have a 2nd revision of the tutorial 1 video completed for the end of week 1. If I was more experienced with video creation I think doing a video per week would have made for good milestones, but I’m not. So to avoid the situation where the later tutorials are significantly better quality than the first, I’m going to hold back on releasing video 1 until I’ve learned a bit more and can do a couple more revisions.
Day 5
Start of a new week and I’m somewhat on track towards my goals. I’ve finished the first video draft of tutorial 1. It’s about 10 minutes so far which is in the range I was aiming for. It definitely is a bit rougher than I would have hoped, but I knew going into this that I was going to need multiple revisions since a lot of this is new to me.
I’ve settled on using DaVinci Resolve 16 for my video editing software. It is probably a bit overkill, but after my computer crashed for the 3rd time when using some simpler software, I figured I might as well bite the bullet and start learning some real software. (However this was probably my fault and not the software, my raw footage was 4K and my computers not up to that). There are a lot of great tutorials on DR16 which also makes the learning process pretty easy.
The plan for this week now is to get some initial feedback and then redo the tutorial. I’ve already learned a lot from my mistakes working on the first draft. While I’m waiting on the feedback, I’m going to work on the graphics engine to create some nice visuals showcasing the topics I hope to cover over the start of the series. I want to include this at the start of the first video as a hook to motivate people .
Day 2
Finished a rough draft of the script for the first video, and started learning some video editing software. Also played around with a set up for recording audio and did some practice recordings.
Video editing and audio recording are all pretty new for me and it was a little uncomfortable. I’ve never really liked my voice and I had a speech impediment as a kid, so recording my voice has always been something I’ve just kind of avoided. But that’s also part of the reason why I want to do this project, and as everywhere on the internet keeps saying, something something discomfort… something something growth.
Day 1
Big start so far today. Created the github repo that will store all the tutorial code (https://github.com/blurrypiano/littleVulkanEngine) and completed the code for tutorial 1. I also screen recorded me typing the code which will be used in the first video, but this may need to be re-done if I end up changing anything.
I’m thinking of using the footage captured today for a rough draft of the video, which I’ll try to find some friends who I could get to give it a watch and get their feedback before making the final version to release next week.
Ultimately I’m pretty happy with how things have gone so far despite hitting a couple roadblocks. I’ve never coded c++ in a professional setting, so I’m not sure how well my code will hold up to scrutiny.
Estimated Timeframe
Oct 15th - Nov 12th
Week 1 Goal
Each weeks milestone will be to release a video tutorial on youtube.
Tutorial 1: Introduction video and opening a window
This videos focus will be an introduction on what the series is going to be, will showcase a demo of what the end result of the first initial project we are working towards, and will cover the topics of creating a project and opening an empty window.
Week 2 Goal
**Tutorial 2: Introduction to Graphics pipelines and programming a simple shader ** Will cover the vulkan graphics pipeline and it’s stages, a basic summary of what each stage does and the what and why of graphics pipelines and how they take data as an input and output an image. It will finish with introducing vertex and fragment shaders and an example using them to draw a simple hard-coded triangle.
Week 3 Goal
**Tutorial 3: Compiling shaders and creating a pipeline object ** This video will show how to compile the shader code we wrote in the previous lesson, and use them to create a graphics pipeline object. Creating the graphics pipeline may need to be broken up into two lessons. We will review what each pipeline stage does in more detail in this lesson, as we write the code to configure some available parameters.
Week 4 Goal
**Tutorial 4: Drawing a triangle **We finally get to see something after this lesson! This lesson will cover the topics of how the screen knows what to display, and using command buffers to send draw commands to our graphics pipeline.