https://github.com/reecelikesramen/rust-raytracer
Rust raytracing engine from scratch for use with CLI, WASM, or as a library
https://github.com/reecelikesramen/rust-raytracer
cli library raytracer raytracing rust wasm webassembly
Last synced: 2 months ago
JSON representation
Rust raytracing engine from scratch for use with CLI, WASM, or as a library
- Host: GitHub
- URL: https://github.com/reecelikesramen/rust-raytracer
- Owner: reecelikesramen
- License: mit
- Created: 2024-11-14T20:41:22.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-30T19:44:00.000Z (over 1 year ago)
- Last Synced: 2025-03-28T16:43:47.906Z (over 1 year ago)
- Topics: cli, library, raytracer, raytracing, rust, wasm, webassembly
- Language: Rust
- Homepage:
- Size: 11.7 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WebTracer: A Rust & WASM Ray tracing Engine
Currently implementing forward ray tracing
## Setting up
### Build CLI for regular use
`cargo build -p raytracer-cli --release`
### Build the WASM binding (in the web-test branch)
```sh
cd raytracer-wasm
wasm-pack build --target web --out-dir ../web-test/pkg --release
cd ../web-test
python -m http.server
```
Open http://localhost:8000
## Main Goals
- [x] Learn Rust fundamentals by recreating my [raytracer](https://github.com/reecelikesramen/raytracer) project from CS 4212 Computer Graphics in Rust.
- [x] Separate the CLI and the core library, enable the library to compile to WASM and invoke from the web browser.
- [ ] Optimize the raytracer by parallelizing math operations to increase exposure to low-level optimization.
- [ ] Extend the raytracer with more interesting shaders, shapes, and light types.
## Renders
Note: the following scenes were created by Dr. Pete Willemsen at University of Minnesota Duluth.
CLI args for all renders here: `raytracer-cli --width 1000 --height 1000 --rays-per-pixel 9 --recursion-depth 6`
Simple sphere scene:

Spheres and triangles:

Cornell Room:

1000 spheres:

Cityscape:

Stanford bunny:

## TODO
- Instanced models [model done]
- Transforms for instanced models [model done]
- Textures [model done]
- Diffuse, specular can be texture or color [model done]
- ParsedScene doesn't need a shaders map
- SceneArgs container for disable_shadows, recursion_depth, image_width, image_height, etc...
- Background structure for either background_color or env_map
- Impl scene stuff so its not just public members
- MTL parsing into shaders
- Vectors that must be normalized can be wrapped in na::Unit