Skip to content
项目

关于

Realtime GPU path tracer based on D3D12 and Vulkan

设计与媒体

这些数字如何统计

可以做什么

  • Realtime GPU wavefront path tracing using compute shaders
  • Vulkan and D3D12 backends through GpuApi
  • Hardware ray tracing through Ray Query when supported by the selected backend
  • CPU-built BVH fallback with GPU traversal when Ray Query is unavailable

实测星标增长

24小时
0
7天
0
15天
+1
1个月
0

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

Realtime GPU Path Tracing Engine

Join my telegram channel, where I post everything related to graphics! https://t.me/cg_lib

Watch demo on YouTube Bistro scene

Features

  • Realtime GPU wavefront path tracing using compute shaders
  • Vulkan and D3D12 backends through GpuApi
  • Hardware ray tracing through Ray Query when supported by the selected backend
  • CPU-built BVH fallback with GPU traversal when Ray Query is unavailable
  • Lambert diffuse and GGX reflection BRDFs
  • Point, directional and environment light sampling
  • Temporal reprojection filter
  • Depth, normals, albedo and motion vector AOV generation
  • Runtime compute pipeline hot reload

Ray Tracing Paths

The application selects the acceleration-structure path automatically:

  • If Device::SupportsRayQuery() is true, HardwareRtAccelerationStructure builds BLAS objects per mesh and a TLAS over scene instances. Tracing uses trace_rayquery.cs and trace_shadow_rayquery.cs.
  • Otherwise Bvh builds a CPU BVH from scene meshes/instances, uploads the nodes and triangles, and tracing uses trace_bvh.cs and trace_shadow_bvh.cs.

Both paths keep the same high-level scene model: SceneInstance stores the mesh index and transform, while ray-hit data stores instance_id and primitive_id.

Building

Requirements:

  • CMake
  • A C++17 compiler
  • GLFW
  • Vulkan SDK for the Vulkan backend
  • Windows SDK with D3D12 for the D3D12 backend

Clone with submodules:

git clone --recursive https://github.com/AlexanderVeselov/RayTracing.git
cd RayTracing

Generate and build:

cmake -S . -B build
cmake --build build --config Release --target RayTracingApp

The Visual Studio project sets the debugger working directory to the repository root. dxcompiler.dll and dxil.dll are copied next to RayTracingApp after build.

Running

Run RayTracingApp from the repository root:

build\src\Release\RayTracingApp.exe --backend vulkan --scene assets/ShaderBalls.obj

Command-line options:

  • --help prints command-line help
  • -w <width> sets window width, default 1280
  • -h <height> sets window height, default 720
  • --scene <path> sets OBJ scene path, default assets/ShaderBalls.obj
  • --scale <scale> sets imported scene scale, default 1.0
  • --flip_yz <0|1> flips Y and Z axes during import, default 0
  • --backend <vulkan|d3d12> selects render backend, default vulkan

Press R while the app is running to reload registered compute pipelines. The reload keeps the previous pipeline if shader compilation or reflected layout compatibility checks fail.

run_bistro.bat downloads Amazon Lumberyard Bistro content into assets, builds the project and runs the Bistro scene.

探索相关项目

加载中…