Progressive DirectX Raytracing (DXR) samples built with CMake.
Each sample adds one focused concept to the previous one: first writing to a texture, then acceleration structures, vertex buffers, index buffers, constant buffers, camera matrices, and finally Dear ImGui on top of a DXR frame.
cmake -S . -B build -G "Visual Studio 17 2022" -A x64
cmake --build build --config DebugRun a sample:
.\build\Debug\ClearScreen.exe- Windows 10/11
- Visual Studio 2022 with the C++ desktop workload
- DirectX 12 / DXR capable GPU
- CMake 3.24 or newer
| Example | Details |
|---|---|
![]() |
ClearScreen The first DXR sample. It creates a minimal raytracing pipeline with only rayGen, writes a gradient into a UAV texture, and copies that texture to the swap chain. There is no geometry, BLAS, TLAS, miss shader, or closest-hit shader yet. |
![]() |
AccelerationStructures Introduces acceleration structures. It builds a BLAS for one triangle and a TLAS that instances it. The ray generation shader fires primary rays, the miss shader writes the background, and the closest-hit shader colors the triangle. |
![]() |
VertexBuffer Adds vertex-buffer reads from DXR shaders. The closest-hit shader accesses a StructuredBuffer<Vertex> SRV and uses barycentric coordinates to interpolate per-vertex colors. |
![]() |
IndexBuffer Adds indexed geometry. The BLAS uses shared vertices and indices to form two triangles, and the closest-hit shader reads a StructuredBuffer<uint> to resolve each primitive's vertices. |
![]() |
ConstantBuffer Adds constant buffers to the global root signature. The sample renders an indexed DXR cube, uses world/view/projection/inverseViewProjection matrices for a real camera, and rotates the cube by updating the TLAS instance transform every frame. |
![]() |
ImGui Integrates Dear ImGui on top of the DXR result. It keeps the real matrix-based camera, the cube rotating through TLAS updates, and lets the UI adjust parameters before drawing ImGui over the back buffer. |
Assets/Shaders: DXR HLSL libraries per sample.External: third-party dependencies used byCommon.Src/Common: shared helpers for windows, descriptors, GUI integration, and DXC compilation.Src/<Example>: one.cppsample file and one tutorialREADME.md.
- CMake generates the solution under
build/. - CMake also adds the NuGet reference to
Microsoft.Direct3D.DXC.





