{"id":25397412,"url":"https://github.com/re-ovo/wgpu-path-tracing","last_synced_at":"2025-04-11T02:45:20.714Z","repository":{"id":274991373,"uuid":"923376579","full_name":"re-ovo/wgpu-path-tracing","owner":"re-ovo","description":"Monte Carlo Path Tracing on WebGPU compute shader","archived":false,"fork":false,"pushed_at":"2025-03-18T12:25:38.000Z","size":93609,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T16:06:15.237Z","etag":null,"topics":["computeshader","monto-carlo","path-tracer","path-tracing","raytracer","raytracing","renderer","webgpu","wgsl"],"latest_commit_sha":null,"homepage":"https://wgpu-path-tracing.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/re-ovo.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":"2025-01-28T05:55:40.000Z","updated_at":"2025-03-18T12:25:41.000Z","dependencies_parsed_at":"2025-02-13T17:43:33.875Z","dependency_job_id":null,"html_url":"https://github.com/re-ovo/wgpu-path-tracing","commit_stats":null,"previous_names":["re-ovo/wgpu-path-tracing"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/re-ovo%2Fwgpu-path-tracing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/re-ovo%2Fwgpu-path-tracing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/re-ovo%2Fwgpu-path-tracing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/re-ovo%2Fwgpu-path-tracing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/re-ovo","download_url":"https://codeload.github.com/re-ovo/wgpu-path-tracing/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248331875,"owners_count":21085994,"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":["computeshader","monto-carlo","path-tracer","path-tracing","raytracer","raytracing","renderer","webgpu","wgsl"],"created_at":"2025-02-15T21:47:54.123Z","updated_at":"2025-04-11T02:45:20.704Z","avatar_url":"https://github.com/re-ovo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wgpu-path-tracing\n\n[**中文版文档**](README_ZH.md)\n\nA experimental Path Tracing implementation using WebGPU.\n\n\u003e This project is mainly used to explore the possibilities of modern Web graphics APIs in implementing Path Tracing. Due to the lack of support for [ray tracing pipelines](https://github.com/gpuweb/gpuweb/issues/535) and [bindless resources](https://github.com/gpuweb/gpuweb/issues/380) in WebGPU, it can currently only be implemented based on compute shaders and texture atlases.\n\n| Cornell (No MIS/64spp)                                            | Cornell (MIS/64spp)                                    | Cornell (MIS/512spp)                                     |\n| ----------------------------------------------------------------- | ------------------------------------------------------ | -------------------------------------------------------- |\n| ![CornellBox (No MIS/64spp)](/docs/img/cornell_64spp_mis_off.png) | ![CornellBox (MIS/64spp)](/docs/img/cornell_64spp.png) | ![CornellBox (MIS/512spp)](/docs/img/cornell_512spp.png) |\n\n## Usage\n\n```bash\n# Install dependencies\nnpm install\n\n# Run the development server\nnpm run dev\n```\n\n## Features\n\n- [x] PBR Materials (with Metallic/Roughness/Transmission/Emissive)\n- [x] GLTF Scene Loading\n- [x] Drag and Drop model file to load (asynchronous via web worker)\n- [x] GPU and CPU Time Profiler\n- [x] BVH Acceleration (with SAH)\n- [x] Multiple Importance Sampling\n- [x] Texture support (based on texture atlas)\n- [x] Depth of Field\n- [x] Tone Mapping\n- [x] HDR support\n\n## GLTF Extensions Supported\n\n- [KHR_lights_punctual](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_lights_punctual/README.md)\n- [KHR_materials_ior](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_ior/README.md)\n- [KHR_materials_transmission](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_transmission/README.md)\n- [KHR_materials_emissive_strength](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_emissive_strength/README.md)\n\n## How it works\n\n### Data Loading\n\nThe `gpu.ts` file contains the core logic for loading data from a GLTF file.\n\nIt uses the `@loaders.gl/gltf` library to load the GLTF file and preprocess the data to extract the scene's information.\n\nAll the data will be uploaded to the GPU at once.\n\n### BVH Construction\n\nThe `bvh.ts` file contains the core logic for constructing the BVH.\n\nIt uses SAH (Surface Area Heuristic) to find the best split point for the BVH.\n\n### Rendering\n\nThe `renderer.ts` file contains the core logic for rendering the scene using WebGPU.\n\nThere are two main passes:\n\n1. **Compute Pass**: This pass is responsible for path tracing. It uses a compute shader to calculate the color of each pixel by simulating the paths of light rays through the scene. The results are stored in a buffer.\n\n2. **Render Pass**: This pass takes the results from the compute pass and renders them to the screen. It uses a render pipeline to draw the final image onto the canvas.\n\n## Libraries\n\n- [wesl-js](https://github.com/wgsl-tooling-wg/wesl-js)\n- [webgpu-utils](https://github.com/greggman/webgpu-utils)\n- [@loaders.gl/gltf](https://www.npmjs.com/package/@loaders.gl/gltf)\n- [potpack](https://github.com/mapbox/potpack)\n\n## References\n\n- [Demystifying multiple importance sampling](https://lisyarus.github.io/blog/posts/multiple-importance-sampling.html#section-monte-carlo-integration)\n- [sample microfacet brdf](https://agraphicsguynotes.com/posts/sample_microfacet_brdf/)\n- [RayTracing (by pozero)](https://github.com/pozero/RayTracing)\n- [BVH with SAH](https://www.cnblogs.com/lookof/p/3546320.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fre-ovo%2Fwgpu-path-tracing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fre-ovo%2Fwgpu-path-tracing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fre-ovo%2Fwgpu-path-tracing/lists"}