{"id":16792284,"url":"https://github.com/chrivers/rustray","last_synced_at":"2025-03-17T02:15:21.197Z","repository":{"id":140207695,"uuid":"410520410","full_name":"chrivers/rustray","owner":"chrivers","description":"Ray tracer written in rust","archived":false,"fork":false,"pushed_at":"2024-04-28T10:00:24.000Z","size":3793,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-23T12:11:13.869Z","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/chrivers.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-26T10:28:38.000Z","updated_at":"2024-04-28T10:01:05.000Z","dependencies_parsed_at":"2024-04-28T11:21:26.904Z","dependency_job_id":"b461125a-5ba7-4be1-8c0b-63858627547b","html_url":"https://github.com/chrivers/rustray","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/chrivers%2Frustray","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrivers%2Frustray/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrivers%2Frustray/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrivers%2Frustray/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrivers","download_url":"https://codeload.github.com/chrivers/rustray/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243960667,"owners_count":20375105,"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-10-13T08:45:17.962Z","updated_at":"2025-03-17T02:15:21.179Z","avatar_url":"https://github.com/chrivers.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"rustray\n=======\n\nThe rustray project is a pure-rust ray tracer. It is capable of optimizing\nmaterial-related computions, by using highly composable material building\nblocks.\n\nUsage\n-----\n\nCurrently, rustray virtual 3d scenes can only be constructed by a user\nprogram. Implementing a simple scene format is on the todo list.\n\nTo see the built-in demo scene render, run:\n\n```shell\n# note: --release is important!\n# ray tracing is *painfully slow* in debug mode\ncargo run --release\n```\n\nIf this is your first time running rustray, some Creative Commons textures will\nbe downloaded from `ambientcg.com`. These will be cached for future runs.\n\nAfter rustray has run, take a look at `output.png`\n\n```shell\nxdg-open output.png\n```\n\nProgramming rustray scenes\n==========================\n\nBasic types\n-----------\n\nAll of rustray features user-selectable floating-point number type. This is\nreflected in the api, with names such as `Point\u003cF\u003e`, `Vector\u003cF\u003e`, `Color\u003cF\u003e`,\netc.\n\nThe `\u003cF\u003e` in these type names have to implement the `Float` trait. This trait is\nalready implemented for the standard `f32` and `f64` types.\n\nTracer\n------\n\nThe main starting point for rustray is the `Tracer`. It is supplied with:\n\n - A virtual camera (`Camera\u003cF\u003e`)\n - A list of objects in the scene (`Geometry\u003cF\u003e`)\n - A list of lights (`Light\u003cF\u003e`)\n\nlike so:\n\n```rust\nlet tracer = tracer::Tracer::new(\n    camera,\n    objects,\n    lights,\n);\n```\n\nAfter this setup, the tracer is ready to generate output. See `src/main.rs` for\na practical example.\n\nObjects\n-------\n\nThe parameter `objects` is a list of things that all implement `Geometry\u003cF\u003e`\n\nEach `Geometry\u003cF\u003e` can test itself for intersection with a ray. If so, they\nreturn a `Hit\u003cF\u003e` describing the hit point where the intersection took place,\nand the direction of the ray.\n\nThe next step is to resolve the material properties at this point. In addition\nto the intersection point, and ray direction, the `Hit\u003cF\u003e` struct also contains\na `HitTarget\u003cF\u003e` reference.\n\nThe `HitTarget\u003cF\u003e` can compute material properties at the hit point, such as\ntexture coordinates, surface normals, etc. Calling `resolve(...)` returns a\n`Maxel\u003cF\u003e` (\"Material Pixel\").\n\nThe `Maxel\u003cF\u003e` depends on the geometry being hit, but is unrelated to the\ndesired material simulation.\n\nTo get a color contribution from a Maxel, we call `render(...)` on the\nreferenced `Material`.\n\nThus, the pipeline is `Ray -\u003e Hit -\u003e Maxel -\u003e Color`.\n\nDemo images\n-----------\n\nGlassy material, demonstrating Fresnel behavior.\n\n![danger-glass.jpeg](example/danger-glass.jpeg)\n\nUntextured glass spheres, demonstrating Fresnel behavior. Index of refraction is\nset much higher than real glass, to get a more metallic reflective surface.\n\n![fresnell-spheres.jpeg](example/fresnell-spheres.jpeg)\n\nGlassy-metallic material showing refraction and reflection.\n\n![funky-glass.jpeg](example/funky-glass.jpeg)\n\nUtah Teapot made from glass.\n\n![glass-teapot.jpeg](example/glass-teapot.jpeg)\n\nClassic shiny spheres.\n\n![mishap.jpeg](example/mishap.jpeg)\n\nExperimental test of colored shadow material. This proof-of-concept material\ncasts red shadows. Since the main material (teapot) is transparent, this is of\ncourse highly unrealistic, but is demonstrates the possibility.\n\n![red-glass.jpeg](example/red-glass.jpeg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrivers%2Frustray","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrivers%2Frustray","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrivers%2Frustray/lists"}