DXR Path Tracer
![](https://static.wixstatic.com/media/bd49bc_c43db7cf1aaf42cc8dee2cfafc4e9b0bf000.jpg/v1/fill/w_866,h_487,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/bd49bc_c43db7cf1aaf42cc8dee2cfafc4e9b0bf000.jpg)
Project Overview
Path Tracing Pipeline
This project is designed to simulate global illumination by using DirectX Raytracing pipeline. Physically Based Rendering (PBR) and Path Tracing were integrated to achieve photo realistic rendering effect.
For each pixel, shoot 32 random rays, each ray will bounce at maximum 6 times, I also used Russian Roulette to terminal some rays in advance. After tracing, I get the accumulated radiance and average them to calculate final result.
![pt1.png](https://static.wixstatic.com/media/bd49bc_d0f27e41e40c4440bfa5f91d105d03b1~mv2.png/v1/fill/w_579,h_335,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/pt1.png)
Path Tracing in Cornell Box
HLSL Shader Code of Path Tracing
PBR
For PBR, I used Cook-Torrance BRDF to calculate all the specular part of BRDF.
As for DFG term in BRDF, Trowbridge-Reitz for D, Smith for G, Fresnel-Schlick for F.
![pt4.png](https://static.wixstatic.com/media/bd49bc_b4af63f363834b6099111a29882fb34c~mv2.png/v1/fill/w_600,h_285,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/pt4.png)
PBR Props in the Scene
I implemented Fresnel-Schlick reflection, refraction based on the index of refraction (IOR), and total internal reflection (TIR). It probabilistically determines whether a ray reflects or refracts using Fresnel coefficients, ensuring realistic light interactions.
![pt6.png](https://static.wixstatic.com/media/bd49bc_b8f605897770459a9627f9ee9fe466e7~mv2.png/v1/fill/w_589,h_289,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/pt6.png)
Glass Material in the Scene
DXR Pipeline
I integrate DirectX Raytracing pipeline into my engine. In my RT pipeline,
-
Build AccelerationStructure
-
Set RayGen、Miss、HitGroup
-
Set Root Signature
-
Set Shader Bind Table
-
Dispatch Rays
![dxr1.png](https://static.wixstatic.com/media/bd49bc_904105fd86fa4a0d9e9372330f9991da~mv2.png/v1/fill/w_702,h_252,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/dxr1.png)
DirectX Raytracing Pipeline
Engine Code of DXR Initilization
Screenshots
![](https://static.wixstatic.com/media/bd49bc_97781856fbbb43f9b879aff3490f82ca~mv2.png/v1/fill/w_980,h_504,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/bd49bc_97781856fbbb43f9b879aff3490f82ca~mv2.png)
![](https://static.wixstatic.com/media/bd49bc_4abb7bf4348b4ac29af86da8d3500896~mv2.png/v1/fill/w_980,h_491,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/bd49bc_4abb7bf4348b4ac29af86da8d3500896~mv2.png)
![](https://static.wixstatic.com/media/bd49bc_24e42d497ba54fd1977a91ddb986da81~mv2.png/v1/fill/w_980,h_511,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/bd49bc_24e42d497ba54fd1977a91ddb986da81~mv2.png)
![](https://static.wixstatic.com/media/bd49bc_97781856fbbb43f9b879aff3490f82ca~mv2.png/v1/fill/w_980,h_504,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/bd49bc_97781856fbbb43f9b879aff3490f82ca~mv2.png)