{"id":18535804,"url":"https://github.com/daniel5151/vrai-tracer","last_synced_at":"2025-04-09T15:32:50.134Z","repository":{"id":48149158,"uuid":"198671567","full_name":"daniel5151/vrai-tracer","owner":"daniel5151","description":"Following along with \"Ray Tracing in One Weekend\" in Rust.","archived":true,"fork":false,"pushed_at":"2019-09-09T16:52:57.000Z","size":1556,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-17T07:32:38.506Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daniel5151.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-24T16:24:53.000Z","updated_at":"2023-08-30T21:04:39.000Z","dependencies_parsed_at":"2022-08-25T09:01:23.737Z","dependency_job_id":null,"html_url":"https://github.com/daniel5151/vrai-tracer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel5151%2Fvrai-tracer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel5151%2Fvrai-tracer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel5151%2Fvrai-tracer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel5151%2Fvrai-tracer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daniel5151","download_url":"https://codeload.github.com/daniel5151/vrai-tracer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248058201,"owners_count":21040717,"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":[],"created_at":"2024-11-06T19:27:47.246Z","updated_at":"2025-04-09T15:32:50.129Z","avatar_url":"https://github.com/daniel5151.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vrai-tracer\n\n_AKA:_ \"true-tracer\" (in French)\n\nMy attempt at following along with [Ray Tracing in One Weekend](https://github.com/RayTracing/raytracinginoneweekend) in Rust.\n\nI plan to use this project as a testbed for implementing and profiling various \nprogramming paradigms and techniques in Rust. For example:\n- Exploring dynamic dispatch vs. enum-based static dispatch with respect to\n  performance, resource usage, and programming ergonomics.\n- Various ways to multithread the raytracer.\n- SIMD?\n\n![20 samples / pixel](vrai-tracer.png)\n\n## Highlights\n\n### Dynamic and Static dispatch... In one codebase?!\n\nThanks to Rust's powerful Trait system, robust generics, and rich macros,\nthis codebase can switch between Dynamic and Static dispatch by toggling a\nsingle feature flag! Enabling the `enum_dispatch` feature switches the entire\nproject from Trait Object based dynamic dispatch, to enum based static dispatch!\n\nAnd no, the codebase is _not_ a mess of `#[cfg(feature = \"enum_dispatch\")]`\ndeclarations :smile:. The bulk of the conditionally compiled code lives in\n`src/hittable/mod.rs` and `src/material/mod.rs`, while the rest of the codebase\nuses types exported from those modules, unaware of the specific dispatch type.\n\n### Live preview\n\nI've opted to render directly onto a live framebuffer (courtesy of the great\n`minifb` crate). This is neat, since it allows for cool things such as live\ntweaking of render parameters, scene animation, and visualizing the render\nprogress by sending pixels to the buffer as they're completed. I'll be adding\nstatic image output at some point as well.\n\n#### With non-blocking rendering!\n\nThis is surprisingly tricky to get right in Rust, what with the borrow checker\nnot letting me just share a buffer between threads easily.\n\nCheck out `src/render/nonblocking.rs` for how I pulled it off.\n_Spoiler alert: lots of channels!_ \n\n## Usage\n\n```\ncargo run --release [samples] [resolution]\n```\n\nWhere resolution is of the form `WxH` (e.g: `640x480`)\n\nI plan to parse CLI parameters properly at some point in the future :smile:.\n\nChanging the scene requires modifying the code at the moment.\nI hope to replace this with a serde based configuration format at some point.\n\n## Controls\n\n- Hit `Space` to start some basic camera movement.\n- Hold `F` to freeze the current scene in place.\n- `-` and `=` change the FOV.\n- `W` and `S` move the camera in and away from the direction it's looking.\n- `\u003c` and `\u003e` change the number of samples.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaniel5151%2Fvrai-tracer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaniel5151%2Fvrai-tracer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaniel5151%2Fvrai-tracer/lists"}