Skip to content

kcloudy0717/Kaguya

Repository files navigation

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

0 1 2 3 4

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
    • 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
    • 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
  1. 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).

  2. 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

Thanks to Benedikt Bitterli for rendering resources!

References

Implementation details

About

D3D12 Rendering Engine

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published