Awesome
Kaguya
This is a hobby project using DirectX 12 and DirectX RayTracing (DXR). This project is inspired by Peter Shirley and his ray tracing book series: In One Weekend, The Next Week, The Rest of Your Life, Alan Wolfe's blog post series on causual shadertoy path tracing and lastly Physically Based Rendering: From Theory to Implementation by Matt Pharr, Wenzel Jakob, and Greg Humphreys. For those of you who haven't read any of these and would like to explore ray tracing, I highly recommend them!
Showcase
Features
Graphics
- Render graph system
- Progressive stochastic path tracing
- Importance sampling of BSDFs and multiple importance sampling of lights
- Lambertian, Mirror, Glass, and Disney BSDFs
- Point and quad lights
- Real-time path tracing using both DXR 1.0 and DXR 1.1
D3D12
- Bindless resource
- Asynchronous PSO compilation using coroutines and threadpools
- Utilization of graphics and asynchronous compute queues
- Acceleration structure compaction using modified RTXMU
Misc
- Custom scene serialization using json
- Custom binary format for loading meshes and meshlets
- Asynchronous asset importing using threads
- Asset management using lightweight handles
World
- Ecs with the following implemented components:
- Core: Main component that all actor in the scene have, it contains tag that identifies the actor and a transform which controls position, scale, and orientation
- Camera: controls camera parameters for scene viewing
- Light: used to illuminate the scene, controls light parameters
- Supported types:
- Point
- Quad
- Supported types:
- Static Mesh: references a mesh in the asset window to be rendered and controls material parameters and submits the referenced mesh to RaytracingAccelerationStructure for path tracing
- Supported BSDFs:
- Lambertian
- Mirror
- Glass
- Disney
- Supported BSDFs:
- NativeScript: C++ scripting
Build
- Visual Studio 2019. I am using VS 2022, but 2019 should still work.
- GPU/Driver that supports DXR.
- Windows SDK Version: 10.0.19041.0
- Windows 10 Minimum Version: 20H2. I am on Windows 11 insider build, older version should still work.
- CMake Version 3.16 or up. Make sure the option "Add CMake to the system PATH for all users" during installation.
- C++ 20
-
Initialize submodules after you have cloned, obtain assets used by the project from here: Assets and copy the Assets folder to the root repo folder. use
Setup.bat
to generate visual studio solution (Make sure you have CMake installed and is a environmental variable). -
When the project is build, all the assets and required dlls will be copied to the directory of the executable. There is a folder containing all the scenes in the asset directory for the showcase, those can be loaded from the context menu of the World window of the application's UI.
Let me know if you have any trouble setting up the project and getting it up and running!
Future stuff to work on
- GPU driven architecture
- Deferred renderer
- Hybrid renderer (Raster & Raytracing)
- Explore spectral rendering and all kinds of integrators mentioned in PBRT
- Add physx back into World system
- Mesh shading using meshlets
- Vulkan support
Acknowledgements
- assimp
- DirectX Mesh
- DirectX Tex
- DirectX Shader Compiler
- entt
- cityhash
- imgui
- ImGuizmo
- json
- D3D12 Agility SDK
- WinPixEventRuntime
Thanks to Benedikt Bitterli for rendering resources!
References
- 3D Game Programming with DirectX 12 Book by Frank D Luna
- Direct3D 12 programming guide from MSDN
- DirectX Specs
- Physically Based Rendering: From Theory to Implementation by Matt Pharr, Wenzel Jakob, and Greg Humphreys.
- Ray Tracing Gems: High-Quality and Real-Time Rendering with DXR and Other APIs
- Ray Tracing book series (In One Weekend, The Next Week, The Rest of Your Life) by Peter Shirley
- Real-Time Rendering, Fourth Edition by Eric Haines, Naty Hoffman, and Tomas Möller
- Casual Shadertoy Path Tracing series by Alan Wolfe
Implementation details
-
Render Graph
-
BSDF
-
Light Sampling
- Solid angle quadrilateral light sampling: https://www.arnoldrenderer.com/research/egsr2013_spherical_rectangle.pdf