Direct3D 12 raytracing samples

This collection of samples act as an introduction to DirectX Raytracing (DXR). The samples are divided into tutorials and advanced samples. Each tutorial sample introduces a few new DXR concepts. Advanced samples demonstrate more complex techniques and applications of raytracing.

Requirements

Getting Started

Known issues

Depending on your Visual Studio version, some samples may fail to compile with these errors:

  • The system cannot find the path specified. *.hlsl.h
  • error MSB6006: "dxc.exe" exited with code 1.

Please see this GitHub issue for details on how to fix it: https://github.com/microsoft/DirectX-Graphics-Samples/issues/657

Tutorial Samples

1. Hello World Sample

This sample demonstrates how to setup a raytracing pipeline and render a triangle in screen space.

D3D12 Raytracing Hello World GUI

2. Simple Lighting Sample

This sample demonstrates how to do ray generation for a dynamic perspective camera and calculate simple diffuse shading for a cube from a dynamic point light.

D3D12 Raytracing Hello World GUI

3. Procedural Geometry Sample

This sample demonstrates how to implement procedural geometry using intersection shaders and shows usage of more complex shader table layouts and multiple ray types.

D3D12 Raytracing Procedural Geometry GUI

4. Library Subobjects Sample

This sample modifies the Simple Lighting sample, and illustrates how to use library subobjects.

D3D12 Raytracing Library Subobjects GUI

Advanced Samples

Real-Time Denoised Ambient Occlusion

This sample implements a real-time denoiser for 1spp raytraced Ambient Occlusion. It also demonstrates a physically-based specular pathtracer implementation and dynamic geometry support.

D3D12 Raytracing Real-Time Denoised Ambient Occlusion

MiniEngine Sample

This sample demonstrates integration of the DirectX Raytracing in the MiniEngine's Model Viewer and several sample uses of raytracing.

D3D12 Raytracing Mini Engine

Further resources

Feedback and Questions

We welcome all feedback, questions and discussions about DXR on our discord server.