{"id":18471971,"url":"https://github.com/nelarius/rayfinder","last_synced_at":"2025-04-08T11:32:29.001Z","repository":{"id":204254964,"uuid":"711433158","full_name":"Nelarius/rayfinder","owner":"Nelarius","description":"An interactive, experimental, pathtracer implemented using desktop WebGPU.","archived":false,"fork":false,"pushed_at":"2024-07-14T04:36:44.000Z","size":53593,"stargazers_count":32,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-04T15:06:32.226Z","etag":null,"topics":["computer-graphics","cpp","raytracer","webgpu"],"latest_commit_sha":null,"homepage":"https://nelari.us/post/pathtracer_devlog/","language":"C","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Nelarius.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-29T08:57:53.000Z","updated_at":"2025-03-29T01:39:52.000Z","dependencies_parsed_at":"2024-04-27T09:45:32.489Z","dependency_job_id":null,"html_url":"https://github.com/Nelarius/rayfinder","commit_stats":null,"previous_names":["nelarius/pathtracer-playground","nelarius/rayfinder"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nelarius%2Frayfinder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nelarius%2Frayfinder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nelarius%2Frayfinder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nelarius%2Frayfinder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nelarius","download_url":"https://codeload.github.com/Nelarius/rayfinder/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247834089,"owners_count":21003910,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["computer-graphics","cpp","raytracer","webgpu"],"created_at":"2024-11-06T10:18:35.096Z","updated_at":"2025-04-08T11:32:23.988Z","avatar_url":"https://github.com/Nelarius.png","language":"C","readme":"# rayfinder\n\nAn interactive experimental pathtracer, implemented using WebGPU via the [Dawn](https://dawn.googlesource.com/dawn) renderer.\n\n## Showcase\n\n![sponza-1](/img/sponza-1.png)\n\n![sponza-2](/img/sponza-2.png)\n\n## References\n\n- [WGSL offset computer](https://webgpufundamentals.org/webgpu/lessons/resources/wgsl-offset-computer.html)\n  - Great tool for checking correct memory layout\n- _Physically Based Rendering, fourth edition_\n  - Bounding volume hierarchy\n  - Inverse transform sampling method\n- [Ray Tracing: The Rest of Your Life](https://raytracing.github.io/books/RayTracingTheRestOfYourLife.html)\n  - Cosine-weighted hemisphere sampling method\n- [scratchapixel/moller-trumbore-ray-triangle-intersection](https://www.scratchapixel.com/lessons/3d-basic-rendering/ray-tracing-rendering-a-triangle/moller-trumbore-ray-triangle-intersection.html)\n- _The Reference Path Tracer_, _Ray Tracing Gems II_ and associated code sample [boksajak/referencePT](https://github.com/boksajak/referencePT/)\n  - Rng initialization\n  - Next event estimation (direct light sampling) method\n- [Crash Course in BRDF implementation](https://boksajak.github.io/files/CrashCourseBRDF.pdf)\n  - BRDF interface\n  - Lambertian BRDF, `sampleLambertian`, `evalLambertian` \n- [Building an Orthonormal Basis, Revisited](https://www.jcgt.org/published/0006/01/01/paper-lowres.pdf)\n  - Robust orthonormal axis, implemented in the `pixarOnb` function\n- _A Fast and Robust Method for Avoiding Self-Intersection_, _Ray Tracing Gems_\n  - Method for the `offsetRay` function, for preventing ray self-intersections.\n- _Sampling Transformations Zoo_, _Ray Tracing Gems_\n  - The `rngNextInCone` method and source\n- [ACES Filmic Tone Mapping Curve](https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/)\n  - filmic tonemapping function\n- [Simple Analytic Approximations to the CIE XYZ Color Matching Functions](https://jcgt.org/published/0002/02/01/)\n  - C code for the CIE XYZ color matching functions' multi-lobe Gaussian fit\n- [RGB / XYZ conversion matrices](http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html)\n  - XYZ to sRGB conversion matrix\n- [Sky Dome Appearance Project](https://cgg.mff.cuni.cz/projects/SkylightModelling/)\n  - The original source of the sky and solar disk model\n  - The following [Rust implementation](https://github.com/phoekz/hw-skymodel) serves as the basis of the much simplified C code used in this project.\n- Depth precision and reverse Z projection\n  - [Depth Precision Visualized](https://www.reedbeta.com/blog/depth-precision-visualized/)\n  - [Reverse Z (and why it's so awesome)](https://tomhultonharrop.com/mathematics/graphics/2023/08/06/reverse-z.html)\n- [Free blue noise textures](http://momentsingraphics.de/BlueNoise.html)\n- _Using Blue Noise for Ray Traced Soft Shadows_, _Ray Tracing Gems II_\n\n## Build\n\nA C++20 compiler is required.\n\n```sh\n$ cmake -B build -DCMAKE_BUILD_TYPE=Debug\n$ cmake --build build --target pt -- -j 32\n```\n\nOn Windows, the platform name (`x64`, `Win32`, `ARM64`) should be provided during configuration. CMake defaults to `Win32` -- see [cmake-preset-x64-arch.md](notes/cmake-presets-x64-arch.md) for instructions on setting up a CMake Preset to force `-A x64`.\n\n```sh\n$ cmake -B build -A x64 -DCMAKE_BUILD_TYPE=Debug\n```\n\nThe shaders are appended to a header file as raw strings during the `pt` build step. Updating the header file can also be invoked manually:\n\n```sh\n$ cmake --build build --target bake-wgsl\n```\n\nIt's recommendable to build using ccache in case Dawn ever needs to be rebuilt. See [ccache.md](notes/ccache.md) for instructions.\n\n## Run\n\n### `pt` and `pt-format-tool`\n\nThe `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.\n\n```sh\n# Running the path tracer requires input data generated from a gltf file.\n$ ./build-release/pt-format-tool assets/Sponza.glb\n# Run the path tracer with the resulting .pt file.\n$ ./build-release/pt assets/Sponza.pt\n```\n\n### `bvh-visualizer`\n\nFor 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`.\n\n```sh\n$ ./build-release/bvh-visualizer assets/Duck.glb\n```\n\n### `hw-skymodel-demo`\n\nRunning the `hw-skymodel-demo` target generates a test image `hw-skymodel-demo.png`.\n\n### `tests`\n\nTo 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.\n\n```sh\n$ (cd build-debug \u0026\u0026 ./tests)\n```\n\n### `textractor`\n\nFor validating that textures are loaded correctly. Loads the specified glTF model and its base color textures, and dumps the textures into `.png` files.\n\n```sh\n$ ./build-release/textractor assets/Sponza.glb\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnelarius%2Frayfinder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnelarius%2Frayfinder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnelarius%2Frayfinder/lists"}