https://github.com/crocidb/pathtracer
An path tracer implementation based on Ray Tracing in One Weekend in Rust with CPU multithreading.
https://github.com/crocidb/pathtracer
graphics graphics-programming parallel pathtracer raytracer raytracing raytracing-one-weekend renderer rendering rust
Last synced: 6 months ago
JSON representation
An path tracer implementation based on Ray Tracing in One Weekend in Rust with CPU multithreading.
- Host: GitHub
- URL: https://github.com/crocidb/pathtracer
- Owner: CrociDB
- Created: 2019-02-16T16:38:39.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-30T12:32:09.000Z (over 6 years ago)
- Last Synced: 2025-06-25T15:08:20.443Z (9 months ago)
- Topics: graphics, graphics-programming, parallel, pathtracer, raytracer, raytracing, raytracing-one-weekend, renderer, rendering, rust
- Language: Rust
- Homepage:
- Size: 62.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
An implementation based on `Ray Tracing in One Weekend` by **Peter Shirley**[1] in Rust with CPU multithreading.
[1] http://www.realtimerendering.com/raytracing/Ray%20Tracing%20in%20a%20Weekend.pdf

## Building
### Linux (Debian based)
Assuming you have `rustc 1.33` or newer already installed, install `libsdl2-dev` on your system:
```sh
$ sudo apt-get libsdl2-dev
```
Open `Cargo.toml` and remove `build` property (that's only for Windows).
Now simply go for:
``` sh
$ cargo run --release
```
*I strongly recommend running it on the release configuration, since it's optimized and runs at least 15x faster.*
### Windows (MSVC)
Assuming you have `rustc 1.33` or newer already installed, download SDL2 runtime libraries from [here](https://www.libsdl.org/download-2.0.php), then extract all `*.lib` files to `pathtracer-root\msvc\lib\64\*.lib` and all the `*.dll` files to `pathtracer-root\msvc\dll\64\*.lib`, assuming you're running on a `x86-64` environment. Otherwise, open `src\build.rs` and figure it out.
Now simply do:
```
> cargo run --release
```
*I strongly recommend running it on the release configuration, since it's optimized and runs at least 15x faster.*
## Instructions
When a black window open, press `SPACE` and wait sometime for it to render.
You can change how many rays per pixel you want to cast, on `src/tracer/mod.rs` there's a global constant called `SAMPLINGS_PER_PIXEL`, it's set to `100` by default, but you can test how many rays you want.
*Warning: be careful when running more than **100** rays per pixel, since it may get your computer really slow for a few minutes.*