{"id":13682636,"url":"https://github.com/Dalamar42/rayt","last_synced_at":"2025-04-30T09:33:42.479Z","repository":{"id":94260101,"uuid":"177324048","full_name":"Dalamar42/rayt","owner":"Dalamar42","description":"Monte Carlo ray tracer developed using Rust","archived":false,"fork":false,"pushed_at":"2020-04-17T23:13:38.000Z","size":28104,"stargazers_count":184,"open_issues_count":8,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-08-02T13:34:22.258Z","etag":null,"topics":["ray-tracing","raytracing"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Dalamar42.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-03-23T18:12:30.000Z","updated_at":"2024-06-26T07:15:16.000Z","dependencies_parsed_at":"2023-04-14T11:45:54.065Z","dependency_job_id":null,"html_url":"https://github.com/Dalamar42/rayt","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/Dalamar42%2Frayt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dalamar42%2Frayt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dalamar42%2Frayt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dalamar42%2Frayt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dalamar42","download_url":"https://codeload.github.com/Dalamar42/rayt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224206155,"owners_count":17273400,"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":["ray-tracing","raytracing"],"created_at":"2024-08-02T13:01:50.302Z","updated_at":"2025-04-30T09:33:42.472Z","avatar_url":"https://github.com/Dalamar42.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# Rayt\n\n\u003cp float=\"left\"\u003e\n  \u003cimg src=\"/samples/cornell_box.png\" width=\"450\" /\u003e\n  \u003cimg src=\"/samples/next_week_final.png\" width=\"450\" /\u003e\n\u003c/p\u003e\n\nThis is a Rust implementation of the ray-tracer from Peter Shirley's excellent [books][books],\n`Ray Tracing in One Weekend`, `Ray Tracing: The Next Week`, and `Ray Tracing: The Rest of Your Life`.\n\nThis is not by any means a fully featured ray-tracer. Rather, this is something I built in order to learn Rust\nand ray-tracing. I am sharing it in case it is useful to others trying to do the same.\n\n## Functionality\nRayt stores and reads scene data in its own format using yaml files. Those are nothing more than a yaml\nserialisation of the corresponding Rust objects.\n\nThere are two modes of operation described in more detail in the next section.\n- `generate` which will generate the yaml file for a scene based on presets in the code\n- `render` which will render the scene in the given yaml\n\nVarious examples from the books are provided in the form of scenes. The `generate` mode can be used to\nquickly regenerate the config files after making changes to them in the code, but for small scenes the files \ncan be easily directly edited as well.\n\n## How to run\nThis code was developed and tested using Rust `1.42`, however it is not using any bleeding edge features of\nthe language so any reasonably recent stable version should be enough to compile it.\n\nTo install the binary in your local environment:\n```bash\ncargo install --path ${PATH_TO_THIS_REPO} \n```\n\nHelp:\n```bash\nrayt --help\nrayt generate --help\nrayt render --help\n```\n\nGenerate the Cornell box scene yaml file:\n```bash\nrayt --config config/cornell_box.yaml generate --scene CornellBox\n```\n\nTo render the Cornell box:\n```bash\nrayt --config config/cornell_box.yaml \\\n    render --width 512 --rays 1000 --threads 8 --output output/cornell_box.png\n```\n\nSome scenes use assets as textures, for example the final scene from the `Ray Tracing: The Next Week` book.\nThese assets can be passed in using `--asset`:\n```bash\nrayt --config config/next_week_final.yaml \\\n    render --width 512 --rays 1000 --threads 8 --asset assets/earth.jpg --output output/next_week_final.png\n```\n\nThe option `--threads` can be used to control how many threads the renderer should use and the option `--rays`\nwill determine how many rays (samples) will be taken for each pixel. Approximately 1000 samples should be\nenough to produce a decent image with some noise from the provided scenes, but more are needed for a clear\nimage. The rendering times will increase quite significantly with the number of samples selected and the size\nof the image. On my machine rendering `next_week_final.yaml` with 5000 samples, and a width of 1024 pixels\ntook around 9 hours. Conversely, the `cornell_box.yaml` with a 1000 samples, and a width of 512 finishes in a\nfew minutes.\n\nA `Makefile` is included with some convenience targets:\n- `make regenerate-scenes` will create all the scene config yaml files\n- `make render-test` will render all scenes using a moderate resolution and number of rays and put the\n  generated images in `output/test`\n- `make cornell-test` is the same as `make render-test`, but only for the Cornell box\n- `make regenerate-samples` will create high-resolution / high-ray-count versions of the Cornell box and the\n  final image from book 2 and put them in `output/samples`\n\n## Samples\nThe directory `samples` contains images generated with a high number of rays, specifically 5000 rays per pixel,\nto showcase what kinds of images `rayt` can render.\n\n## Assets\n\nThe included assets were taken from the following sources:\n\n- _blue_marble.jpg_ - [NASA Visible Earth][nasa-visible-earth]\n- _earth.jpg_ - [NASA Visible Earth][nasa-visible-earth]\n- _earth_night.jpg_ - [NASA Visible Earth][nasa-visible-earth]\n- _jupiter.jpg_ - [NASA Cassini][nasa-cassini]\n- _mars.jpg_ - [USGS][usgs-mars]\n- _moon.jpg_ - [USGS][usgs-moon]\n\n## License\n\nSee the LICENSE file that is included with this repository.\n\n[books]: https://github.com/RayTracing/raytracing.github.io\n[nasa-visible-earth]: https://visibleearth.nasa.gov/\n[nasa-cassini]: https://solarsystem.nasa.gov/missions/cassini/galleries/\n[usgs-mars]: https://astrogeology.usgs.gov/search/details/Mars/Viking/MDIM21/Mars_Viking_MDIM21_ClrMosaic_global_232m/cub\n[usgs-moon]: https://astrogeology.usgs.gov/search/map/Moon/Clementine/UVVIS/Lunar_Clementine_UVVIS_750nm_Global_Mosaic_118m_v2\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDalamar42%2Frayt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDalamar42%2Frayt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDalamar42%2Frayt/lists"}