This repository contains a collection of Rust crates that together form a simple ray tracing renderer. The project is organized as a Cargo workspace.
rt- command line application that loads scene definitions and renders imagescore- ray tracing core containing intersection logic and shadingscene- scene description and serializationjson- lightweight JSON parser used by the rendererjsonc- bindings to a C JSON-with-comments parserjson_minifier_cli- CLI tool for minifying JSON filespackandpack_cli- utilities for building asset packstypes- common math and color types
To build all crates in the workspace:
cargo build --workspaceThe rt crate provides a CLI to render a scene file. A sample scene is included as input.scene.rt:
cargo run --package rt -- input.scene.rtScenes can also be loaded programmatically with scene::Scene::from_json_value:
let json = std::fs::read_to_string("input.scene.rt").unwrap();
let value = jsonc::parse(&json).unwrap();
let dummy_loader = MyLoader; // implements `scene::ImageLoader`
let scene = scene::Scene::from_json_value(value, 1.0, &dummy_loader).unwrap();Use --help to see additional command line options such as output image dimensions and camera parameters.
Before committing changes, ensure the code is formatted and that the workspace builds:
cargo fmt --all
cargo test --workspace