Skip to content

An interactive, experimental, pathtracer implemented using desktop WebGPU.

License

Notifications You must be signed in to change notification settings

Nelarius/rayfinder

Repository files navigation

rayfinder

An interactive experimental pathtracer, implemented using WebGPU via the Dawn renderer.

Showcase

sponza-1

sponza-2

References

Build

A C++20 compiler is required.

$ cmake -B build -DCMAKE_BUILD_TYPE=Debug
$ cmake --build build --target pt -- -j 32

On Windows, the platform name (x64, Win32, ARM64) should be provided during configuration. CMake defaults to Win32 -- see cmake-preset-x64-arch.md for instructions on setting up a CMake Preset to force -A x64.

$ cmake -B build -A x64 -DCMAKE_BUILD_TYPE=Debug

The shaders are appended to a header file as raw strings during the pt build step. Updating the header file can also be invoked manually:

$ cmake --build build --target bake-wgsl

It's recommendable to build using ccache in case Dawn ever needs to be rebuilt. See ccache.md for instructions.

Run

pt and pt-format-tool

The pt executable contains the path tracer. You run it by providing it with input file in the pt file format. .pt files are generated from a glTF file using the pt-format-tool executable.

# Running the path tracer requires input data generated from a gltf file.
$ ./build-release/pt-format-tool assets/Sponza.glb
# Run the path tracer with the resulting .pt file.
$ ./build-release/pt assets/Sponza.pt

bvh-visualizer

For validating that the bounding volume hierarchy (BVH) and it's intersection tests are computed correctly. This executable loads the specified glTF file, builds a BVH, and produces an image where each pixel is colored by the number of nodes visited for the pixel's primary ray. Running the executable produces the test image bvh-visualizer.png.

$ ./build-release/bvh-visualizer assets/Duck.glb

hw-skymodel-demo

Running the hw-skymodel-demo target generates a test image hw-skymodel-demo.png.

tests

To run the tests, the working directory has to be in the build folder. The tests depend on assets which are copied to the build folder.

$ (cd build-debug && ./tests)

textractor

For validating that textures are loaded correctly. Loads the specified glTF model and its base color textures, and dumps the textures into .png files.

$ ./build-release/textractor assets/Sponza.glb

About

An interactive, experimental, pathtracer implemented using desktop WebGPU.

Topics

Resources

License

Stars

Watchers

Forks