Alex Tardif: Learning graphics

May 31, 2024

All credit goes to Alex Tardif. I’m only posting this here so I don’t lose the content.

Overview

“Graphics has become too difficult.”

I have increasingly heard this or some variation of it in recent years, that graphics programming has become so complicated and difficult to learn that it’s discouraging people from pursuing it as a hobby and/or profession, or causing them to give up after they’ve started. I have a deep love for this area of programming, so this kind of commentary always hits me in the gut. Graphics programming in games is an incredibly rewarding specialization, is constantly evolving and innovating, and has (for the most part) one of the better communities in programming which thrives on sharing as much as possible. So what’s going on?

Well, it’s complicated, but they’re not wrong.

When I started making this post a couple months ago, it looked very different than it does now, and it was working towards an argument for a higher level (DX11-but-better) API wrapper for D3D12, basically. The more I wrote, the more I understood the issue was more complex than that, and then posted this poll on twitter, confirming that there really wasn’t (as one person put it) a one-size-fits-all solution for learning graphics anymore. Some might look at that and say “well, there never was one before either” and they’d be right, but the gaps have widened in recent years. Let’s talk about that.

The “Full Stack” Graphics Programmer is Gone

This is where a lot of people get deflated without realizing the landscape has changed significantly in the last few years. We can argue about when it happened exactly, but I think an accurate rough estimate of when the full stack graphics programmer died was around 2013. For context, this was also the year I started working in the field, and a lot of it went over my head at the time.

In 2013, the industry had begun an evolution with significant implications on the complexity of game graphics programming. On one end, we had the advent of physically based rendering in games, as seen in the SIGGRAPH 2013 Course: Physically Based Shading in Theory and Practice, and on the other, we had the release of AMD’s Mantle API.


What this meant was that game graphics was about to expand significantly, and for good reason. PBR catapulted real-time rendering out of the Blinn-Phong era and sought to redefine authoring pipelines, while Mantle offered a lower level API that finally delivered tools for reducing CPU overhead of graphics API features (like draw calls and creating pipelines) which was widely seen as a major limiting factor at the time. Prior to this it was common to see graphics programmers working on all levels of the “stack,” but today this is increasingly rare. I think the first time I saw this visualized was in Angelo Pesce’s “The Technical Interview [LEAKED]”


While the divides between different sub-specializations of game graphics will vary from one project to the next, they undeniably exist. Keep this in mind when you feel overwhelmed by all that graphics development has to offer, and allow yourself the time to become focused on the specialization(s) that interest and matter to you the most. My personal graph hovers around the engine/API part of the spectrum, with mild (but enough) understanding of other areas, and if you looked at the folks I have hired onto our team at ZOS, you’d rightly see that I sought out those with different expertise to cover the spectrum. It takes a well-rounded team!

If you’re bought into this idea, then you may be wondering where to start. If my poll thread was any indication, there is not a “correct” place to start, certainly not that everyone would agree with. With that said, here are my recommendations (at time of writing, 2021).

Where Should I Get Started?

“I am not sure what I want, or I want an introduction to most aspects of graphics programming”
https://learnopengl.com/ is (as far as I am aware) the single best resource for learning the bulk of the major parts of graphics programming. Start from the beginning and work your way through, the process may help illuminate where your interests are.


“I want to learn rendering”
Learn ray tracing! Start from https://raytracing.github.io/ and then move onto https://pbrt.org/, both marvelous resources and also freely available online. In my opinion the future in which games adopt raytracing en masse is rapidly approaching.


“I want to learn how to write shaders”
You can’t go wrong with Shadertoy. There are lots of tutorials and samples from the community, for all levels of experience, and examples of likely any shading topic you can think of. You won’t have to think about or set up any graphics APIs or anything like that. This is the closest thing you will find to a graphics playground.


“I want to understand the lower-level graphics pipeline and architecture”
If you want to dive in the deep end: I recommend you begin with learning D3D12 or Vulkan. If you don’t care about mobile, I believe D3D12 requires less mental overhead and time to learn, with the trade-off being that the resources available today for learning are not necessarily as good. For D3D12, start from the D3D12 sample github, specifically the “hello world” samples:
https://github.com/microsoft/DirectX-Graphics-Samples/tree/master/Samples/Desktop/D3D12HelloWorld

And consult the programming guide and reference documentation as you replicate the samples yourself:
https://docs.microsoft.com/en-us/windows/win32/direct3d12/directx-12-programming-guide
https://microsoft.github.io/DirectX-Specs/

Join the discord, it can really make a difference with your learning experience: https://discord.com/invite/directx
Also worth checking out some nice resources that Jendrik Illner put together: https://www.jendrikillner.com/post/d3d12-learning-plan/

For Vulkan, start from the Vulkan samples tutorial (thank you Aeva): https://vulkan.lunarg.com/doc/view/1.2.154.1/windows/tutorial/html/index.html
And potentially also the Vulkan tutorial: https://vulkan-tutorial.com/
Once you have completed it, make your way to Sasha Willems’s Vulkan examples github: https://github.com/SaschaWillems/Vulkan
And of course, always have the Vulkan spec handy. https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html
Join the community discord: https://discord.com/invite/tFdvbEj

A solid goal is making a higher-level wrapper for the API you’ve chosen. You’ll learn a ton about APIs and abstractions by doing so. Something to keep in mind as you’re beginning is that a lot of resources that are helpful for getting started are in different places on github (DirectXTex, Vulkan Memory Allocator, D3D12 Memory Allocator, DirectX Shader Compiler, etc).

I am writing a D3D12 starter-pack tutorial using more modern concepts and hope to publish it in the near future. It feels like there is a need for this.

If you want a gentler introduction: I recommend you learn D3D11 or OpenGL using the many available resources and tutorials for either (for example the one I linked earlier). If you don’t have a preference, I recommend D3D11 as navigating samples and tutorials of OpenGL can have different versions of it all over the place which may cause you unnecessary confusion. What you learn doing this will still be relevant if or when you eventually get into the lower level APIs.

Overall, this area is what spawned my twitter poll, and is where many can understandably become discouraged. I wish D3D11 had kept up with newer features that only D3D12 now receives, though there are good reasons why it doesn’t. If it had, or if we had an official high level D3D12 wrapper, I would have recommended that here. I get the feeling something reflected in my poll is that there is a desire for such a thing, and that in general people would prefer if authorities in the space (eg Microsoft) provided it rather than having to pull various 3rd party options from github.

Don’t get bullied into the D3D12/Vulkan side of things if you’re overwhelmed to the point of wanting to give up on graphics development while learning those. There’s nothing wrong with learning the earlier APIs to grasp higher level concepts first before going to lower level APIs to understand what they were doing under the hood for you.

Book Resources

If you want a couple resources that will always be relevant and focus on foundations, I recommend checking out Foundations of Game Engine Development and Real-Time Rendering.