A small collection of DirectX 11 projects I built while learning the API.
"A person who never made a mistake never tried anything new." -- Albert Einstein (or maybe Theodore Roosevelt, Matt Bellamy or even your cat. It's not so clear.)
The code inside this repository was only written for learning purposes. I never really tried to make it beautiful, easy to read, performant or 100% correct. In the end, all I wanted to do is to explore the API. Now I share my code so other people doing the same may be inspired by my journey.
Tl;dr: I know the code's dirty ;) Don't judge me.
- Install a
Windows SDK
if you haven't already (OS: Windows 8 or higher). - Run
GenerateProjectFiles.bat
. - Open the generated
DX11Sandbox.sln
with VS2022. - Build and run the desired project the desired configuration (Debug / DebugRender / Release)
Explored topics:
- Setting up a bare minimum render pipeline
- Write, load and compile bare minimum shaders
- Draw a colored triangle
Explored topics:
- Rendering of meshes from in-memory data
- Usage of constant buffers
- Texture bindings
- Different blend states and their complications (e.g. transparency)
Explored topics:
- Loading of meshes from files using Assimp
- Revisited quaternions to calculate mesh transforms
- Further abstractions of graphics resources (shaders, textures, buffers, materials,...)
ChunkyKnight_tint.mp4
Explored topics:
- Setting up material parameters via shader reflection (input layouts, cbuffers, resource bindings,...)
- Exposing an API to change material parameters during runtime
- Rendering a simple UI with Imgui
Explored topics:
- Import of glTF models using Assimp (using Sponza as showcase)
- Building a scene graph
- Using resource pools with handles instead of smart pointers
- Introduction of render queues - one for opaque materials, one for transparent materials
- Introduction of render work items as foundation for draw call batching
- Building shader permutations with macros (e.g. for alpha cutoff depending on material configuration)
- Movable camera (FPS style, WASD to move, hold right mouse button to change camera direction)
Explored topics:
- (Blinn-)Phong reflection model
- Directional lights
- Spot lights
- Point lights
Explored topics:
- Normal Mapping
- TBN Matrices
- Fixing tangents on models with mirrored UVs
- Automatically generating mip maps during run-time
Explored topics:
- Basic shadow mapping for directional lights, spot lights and point lights
- Fitting view frustums to scene
- Percentage Closer Filtering (PCF)
- Cascaded Shadow Maps (CSM)
- Stabilized CSM with Texel Snapping
- Chunky Knight mesh by thanhtp, licensed under Creative Commons Attribution.
- Sponza model by Crytek, glTF taken from KhronosGroup glTF sample models repository.
- Stanford Dragon PBR by hackmans is licensed under Creative Commons Attribution (http://creativecommons.org/licenses/by/4.0/). Original mesh by Stanford University Computer Graphics Laboratory.