{"id":13699647,"url":"https://github.com/aras-p/ToyPathTracer","last_synced_at":"2025-05-04T16:35:27.024Z","repository":{"id":41394718,"uuid":"126492058","full_name":"aras-p/ToyPathTracer","owner":"aras-p","description":"Toy path tracer for my own learning purposes (CPU/GPU, C++/C#, Win/Mac/Wasm, DX11/Metal, also Unity)","archived":false,"fork":false,"pushed_at":"2025-04-12T05:53:35.000Z","size":503,"stargazers_count":1095,"open_issues_count":2,"forks_count":114,"subscribers_count":48,"default_branch":"main","last_synced_at":"2025-05-03T11:07:16.477Z","etag":null,"topics":["burst","cpp","csharp","gpu","metal","path-tracing","unity"],"latest_commit_sha":null,"homepage":"https://aras-p.info/blog/2018/03/28/Daily-Pathtracer-Part-0-Intro/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aras-p.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","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,"zenodo":null}},"created_at":"2018-03-23T13:53:26.000Z","updated_at":"2025-05-01T13:09:27.000Z","dependencies_parsed_at":"2025-01-06T00:01:53.242Z","dependency_job_id":"901a72fa-29bc-4f57-a66c-c620fc2a6a3a","html_url":"https://github.com/aras-p/ToyPathTracer","commit_stats":{"total_commits":128,"total_committers":5,"mean_commits":25.6,"dds":0.3828125,"last_synced_commit":"1cc912b162d578e2a72571c4feb1d474b72592f1"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aras-p%2FToyPathTracer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aras-p%2FToyPathTracer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aras-p%2FToyPathTracer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aras-p%2FToyPathTracer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aras-p","download_url":"https://codeload.github.com/aras-p/ToyPathTracer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252366670,"owners_count":21736615,"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":["burst","cpp","csharp","gpu","metal","path-tracing","unity"],"created_at":"2024-08-02T20:00:40.269Z","updated_at":"2025-05-04T16:35:26.987Z","avatar_url":"https://github.com/aras-p.png","language":"C++","funding_links":[],"categories":["C++","Graphics"],"sub_categories":[],"readme":"# Toy Path Tracer [![Build Status](https://github.com/aras-p/ToyPathTracer/workflows/build_and_test/badge.svg)](https://github.com/aras-p/ToyPathTracer/actions)\n\nToy path tracer I did in 2018 for my own learning purposes. Somewhat based on Peter Shirley's\n[Ray Tracing in One Weekend](https://raytracing.github.io/) minibook (highly recommended!), and on Kevin Beason's\n[smallpt](http://www.kevinbeason.com/smallpt/).\n\n![Screenshot](/Shots/screenshot.jpg?raw=true \"Screenshot\")\n\nI decided to write blog posts about things I discover as I do this:\n\n* [Part 0: Intro](http://aras-p.info/blog/2018/03/28/Daily-Pathtracer-Part-0-Intro/)\n* [Part 1: Initial C++ and walkthrough](http://aras-p.info/blog/2018/03/28/Daily-Pathtracer-Part-1-Initial-C--/)\n* [Part 2: Fix stupid performance issue](http://aras-p.info/blog/2018/03/28/Daily-Pathtracer-Part-2-Fix-Stupid/)\n* [Part 3: C#, Unity and Burst](http://aras-p.info/blog/2018/03/28/Daily-Pathtracer-Part-3-CSharp-Unity-Burst/)\n* [Part 4: Correctness fixes and Mitsuba](http://aras-p.info/blog/2018/03/31/Daily-Pathtracer-Part-4-Fixes--Mitsuba/)\n* [Part 5: simple GPU version via Metal](http://aras-p.info/blog/2018/04/03/Daily-Pathtracer-Part-5-Metal-GPU/)\n* [Part 6: simple GPU version via D3D11](http://aras-p.info/blog/2018/04/04/Daily-Pathtracer-Part-6-D3D11-GPU/)\n* [Part 7: initial C++ SIMD \u0026 SoA](http://aras-p.info/blog/2018/04/10/Daily-Pathtracer-Part-7-Initial-SIMD/)\n* [Part 8: SSE SIMD for HitSpheres](http://aras-p.info/blog/2018/04/11/Daily-Pathtracer-8-SSE-HitSpheres/)\n* [Part 9: ryg optimizes my code](http://aras-p.info/blog/2018/04/13/Daily-Pathtracer-9-A-wild-ryg-appears/)\n* [Part 10: Update all implementations to match](http://aras-p.info/blog/2018/04/16/Daily-Pathtracer-10-Update-CsharpGPU/)\n* [Part 11: Buffer-oriented approach on CPU](http://aras-p.info/blog/2018/04/19/Daily-Pathtracer-11-Buffer-Oriented/)\n* [Part 12: Buffer-oriented approach on GPU D3D11](http://aras-p.info/blog/2018/04/25/Daily-Pathtracer-12-GPU-Buffer-Oriented-D3D11/)\n* [Part 13: GPU thread group data optimization](http://aras-p.info/blog/2018/05/28/Pathtracer-13-GPU-threadgroup-memory-is-useful/)\n* [Part 14: Make it run on iOS](http://aras-p.info/blog/2018/05/30/Pathtracer-14-iOS/)\n* [Part 15: A bunch of path tracing links](http://aras-p.info/blog/2018/08/01/Pathtracer-15-Pause--Links/)\n* [Part 16: Unity C# Burst optimization](http://aras-p.info/blog/2018/10/29/Pathtracer-16-Burst-SIMD-Optimization/)\n* [Part 17: WebAssembly](http://aras-p.info/blog/2018/11/16/Pathtracer-17-WebAssembly/)\n\nNote: it can only do spheres, no bounding volume hierachy of any sorts, a lot of stuff hardcoded.\n\nPerformance numbers in Mray/s on a scene with ~50 spheres and two light sources, running on the CPU:\n\n| Language | Approach                | Ryzen 5950 | AMD TR1950 | MBP 2021   | MBP 2018  | MBA 2020 | iPhone 11 | iPhone X | iPhone SE |\n|:--- |:---                          |        ---:|        ---:|        ---:|       ---:|      ---:|       ---:|      ---:|       ---:|\n| C++ | SIMD Intrinsics              |   281.0    |   187.0    |   105.4    |   74.0    |     32.3 |      26.4 |     12.9 |       8.5 |\n|     | Scalar                       |   141.2    |   100.0    |    84.8    |   35.7    |          |      15.9 |\n|     | WebAssembly (no threads, no SIMD) | 8.4   |     5.0    |     8.1    |           |          |       5.6 |\n| C#  | Unity Burst \"manual\" SIMD    |   227.2    |   133.0    |   103.7    |   60.0    |          |      29.7 |\n|     | Unity Burst                  |            |    82.0    |            |   36.0    |          |           |\n|     | Unity (Editor)               |     6.5    |            |     3.4    |           |          |           |\n|     | Unity (player Mono)          |     6.7    |            |     3.5    |           |          |           |\n|     | Unity (player IL2CPP)        |    39.1    |            |    63.8    |           |          |      17.2 |\n|     | .NET 6.0                     |    91.5    |    53.0    |    40.9    |           |\n|     | .NET Core 2.0                |    86.1    |    53.0    |            |   23.6    |\n|     | Mono --llvm                  |            |            |    35.1    |   22.0    |\n|     | Mono                         |    23.6    |            |     3.6    |    6.1    |\n\nMore detailed specs of the machines above are:\n* `Ryzen 5950`: AMD Ryzen 5950X (3.4GHz, 16c/32t), Visual Studio 2022.\n* `AMD TR1950`: AMD ThreadRipper 1950X (3.4GHz, SMT disabled - 16c/16t), Visual Studio 2017.\n* `MBP 2021`: Apple MacBook Pro M1 Max (8+2 cores), Xcode 13.2.\n* `MBP 2018`: Apple MacBook Pro mid-2018 (Core i9 2.9GHz, 6c/12t).\n* `MBA 2020`: Apple MacBook Air 2020 (Core i7 1.2GHz, 4c/8t).\n* `iPhone 11`: A13 chip.\n* `iPhone X`: A11 chip.\n* `iPhone SE`: A9 chip.\n\nSoftware versions:\n* Unity 2021.3.16. Burst 1.6.6 (safety checks off). C# testing in editor, Release mode.\n* Mono 6.12.\n\nAnd on the GPU, via a compute shader in D3D11 or Metal depending on the platform:\n\n| GPU | Perf |\n|:--- |  ---:|\n| D3D11 | |\n| GeForce RTX 3080Ti         | 3920 |\n| GeForce GTX 1080Ti         | 1854 |\n| Metal | |\n| MBP 2024 (M4 Max)          | 1680 |\n| MBP 2021 (M1 Max)          | 1065 |\n| MBP 2018 (Radeon Pro 560X) | 246 |\n| MBA 2020 (Iris Plus)       | 201 |\n| iPhone 11 Pro (A13)        | 80 |\n| iPhone X (A11)             | 46 |\n| iPhone SE (A9)             | 20 |\n\n\nA lot of stuff in the implementation is *totally* suboptimal or using the tech in a \"wrong\" way.\nI know it's just a simple toy, ok :)\n\n### Building\n\n* C++ projects:\n  * Windows (Visual Studio 2017) in `Cpp/Windows/ToyPathTracer.sln`. DX11 Win32 app that displays result as a fullscreen CPU-updated or GPU-rendered texture.\n    Pressing G toggles between GPU and CPU tracing, A toggles animation, P toggles progressive accumulation.\n  * Mac/iOS (Xcode 10) in `Cpp/Apple/ToyPathTracer.xcodeproj`. Metal app that displays result as a fullscreen CPU-updated or GPU-rendered texture.\n    Pressing G toggles between GPU and CPU tracing, A toggles animation, P toggles progressive accumulation.\n    Should work on both Mac (`Test Mac` target) and iOS (`Test iOS` target).\n  * WebAssembly in `Cpp/Emscripten/build.sh`. CPU, single threaded, no SIMD.\n* C# project in `Cs/TestCs.sln`. A command line app that renders some frames and dumps out final TGA screenshot at the end.\n* Unity project in `Unity`. I used Unity 2021.3.16.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faras-p%2FToyPathTracer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faras-p%2FToyPathTracer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faras-p%2FToyPathTracer/lists"}