Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Toy path tracer for my own learning purposes (CPU/GPU, C++/C#, Win/Mac/Wasm, DX11/Metal, also Unity)

License

NotificationsYou must be signed in to change notification settings

aras-p/ToyPathTracer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Toy path tracer I did in 2018 for my own learning purposes. Somewhat based on Peter Shirley'sRay Tracing in One Weekend minibook (highly recommended!), and on Kevin Beason'ssmallpt.

Screenshot

I decided to write blog posts about things I discover as I do this:

Note: it can only do spheres, no bounding volume hierachy of any sorts, a lot of stuff hardcoded.

Performance numbers in Mray/s on a scene with ~50 spheres and two light sources, running on the CPU:

LanguageApproachRyzen 5950AMD TR1950MBP 2021MBP 2018MBA 2020iPhone 11iPhone XiPhone SE
C++SIMD Intrinsics281.0187.0105.474.032.326.412.98.5
Scalar141.2100.084.835.715.9
WebAssembly (no threads, no SIMD)8.45.08.15.6
C#Unity Burst "manual" SIMD227.2133.0103.760.029.7
Unity Burst82.036.0
Unity (Editor)6.53.4
Unity (player Mono)6.73.5
Unity (player IL2CPP)39.163.817.2
.NET 6.091.553.040.9
.NET Core 2.086.153.023.6
Mono --llvm35.122.0
Mono23.63.66.1

More detailed specs of the machines above are:

  • Ryzen 5950: AMD Ryzen 5950X (3.4GHz, 16c/32t), Visual Studio 2022.
  • AMD TR1950: AMD ThreadRipper 1950X (3.4GHz, SMT disabled - 16c/16t), Visual Studio 2017.
  • MBP 2021: Apple MacBook Pro M1 Max (8+2 cores), Xcode 13.2.
  • MBP 2018: Apple MacBook Pro mid-2018 (Core i9 2.9GHz, 6c/12t).
  • MBA 2020: Apple MacBook Air 2020 (Core i7 1.2GHz, 4c/8t).
  • iPhone 11: A13 chip.
  • iPhone X: A11 chip.
  • iPhone SE: A9 chip.

Software versions:

  • Unity 2021.3.16. Burst 1.6.6 (safety checks off). C# testing in editor, Release mode.
  • Mono 6.12.

And on the GPU, via a compute shader in D3D11 or Metal depending on the platform:

GPUPerf
D3D11
GeForce RTX 3080Ti3920
GeForce GTX 1080Ti1854
Metal
MBP 2024 (M4 Max)1680
MBP 2021 (M1 Max)1065
MBP 2018 (Radeon Pro 560X)246
MBA 2020 (Iris Plus)201
iPhone 11 Pro (A13)80
iPhone X (A11)46
iPhone SE (A9)20

A lot of stuff in the implementation istotally suboptimal or using the tech in a "wrong" way.I know it's just a simple toy, ok :)

Building

  • C++ projects:
    • Windows (Visual Studio 2017) inCpp/Windows/ToyPathTracer.sln. DX11 Win32 app that displays result as a fullscreen CPU-updated or GPU-rendered texture.Pressing G toggles between GPU and CPU tracing, A toggles animation, P toggles progressive accumulation.
    • Mac/iOS (Xcode 10) inCpp/Apple/ToyPathTracer.xcodeproj. Metal app that displays result as a fullscreen CPU-updated or GPU-rendered texture.Pressing G toggles between GPU and CPU tracing, A toggles animation, P toggles progressive accumulation.Should work on both Mac (Test Mac target) and iOS (Test iOS target).
    • WebAssembly inCpp/Emscripten/build.sh. CPU, single threaded, no SIMD.
  • C# project inCs/TestCs.sln. A command line app that renders some frames and dumps out final TGA screenshot at the end.
  • Unity project inUnity. I used Unity 2021.3.16.

About

Toy path tracer for my own learning purposes (CPU/GPU, C++/C#, Win/Mac/Wasm, DX11/Metal, also Unity)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp