{"id":16168924,"url":"https://github.com/andrewgazelka/cpp-raytracer","last_synced_at":"2026-04-30T15:31:55.540Z","repository":{"id":149928135,"uuid":"347218581","full_name":"andrewgazelka/Cpp-raytracer","owner":"andrewgazelka","description":"👁 A ray-tracer for UMN 5607","archived":false,"fork":false,"pushed_at":"2021-03-30T16:10:27.000Z","size":3534,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-25T10:33:55.534Z","etag":null,"topics":["cpp17","raytracing","spheres","triangles"],"latest_commit_sha":null,"homepage":"","language":"C","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/andrewgazelka.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-03-12T22:53:58.000Z","updated_at":"2021-04-13T16:57:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"f3a4986d-c763-45f5-9863-8bd75b38a164","html_url":"https://github.com/andrewgazelka/Cpp-raytracer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andrewgazelka/Cpp-raytracer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewgazelka%2FCpp-raytracer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewgazelka%2FCpp-raytracer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewgazelka%2FCpp-raytracer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewgazelka%2FCpp-raytracer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrewgazelka","download_url":"https://codeload.github.com/andrewgazelka/Cpp-raytracer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewgazelka%2FCpp-raytracer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32469344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"ssl_error","status_checked_at":"2026-04-30T13:12:06.837Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cpp17","raytracing","spheres","triangles"],"created_at":"2024-10-10T03:13:39.626Z","updated_at":"2026-04-30T15:31:55.524Z","avatar_url":"https://github.com/andrewgazelka.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Project 3 Computer Graphics\n\n## Compilation\n\nThis project has only been tested on MacOS. It is not guaranteed to work\non other platforms.\n\n- Install `googletest` (`brew install googletest` on MacOS)\n- Install `boost`\n- Go to project root directory `mkdir build`\n- `cd build`\n- `cmake ..`\n- `make`\n\n## Running\n`./project3 {input_file}`\n\n# Features 3B\n\n- Everything in 3A\n\n## Transmissive\n\nBelow is a modified version of `outdoor.txt`,\nwhich swaps the materials for each sphere. \nThe sphere on the left is reflective and the\nsphere on the right is transmissive with an\nior of 1.5\n\n![Transimissive 1](.github/outdoor-mod.png)\n\nThe same image with a 1.1 transmission on the right sphere is  \n\n![Transimissive 2](.github/outdoor-mod2.png)\n\nwith a 1.01 transmission\n\n![Transimissive 3](.github/outdoor-mod3.png)\n\nand finally with 1.00 transmission\n\n![Transimissive 4](.github/outdoor-mod4.png)\n\n\n## Reflections\n\nHere is the `outdoor.txt` file with only reflections and no\ntransmissive term\n\n![Reflection 4](.github/outdoor-refl.png)\n\nHere is `sphere2.txt` unmodified for reference\n\n![Spheres 2](.github/spheres2-main.png)\n\n## Recursion to a bounded depth\n\nHere is spheres 2 with recursion to a bounded depth of 2 \n(which was the default)\n\n![Spheres 2](.github/spheres2-main.png)\n\nThe same with a bounded depth of 1 is\n\n![Spheres 2 b](.github/spheres2-b1.png)\n\nWe can see that the red sphere on the right of the yellow sphere is more illuminated\nwith a bounded depth of 2 than 1.\n\n\nand with a bounded depth of 0 is\n\n![Spheres 2 c](.github/spheres2-c.png)\n\nThere are no reflections as the depth is limited so no can occur.\n\n## Triangles\nHere is `outdoor.txt` with only one triangle\n\n![Tri](.github/outdoor-tri.png)\n\n## Planes\nHere is `outdoor.txt` but with a triangle replaced with a plane\n\n![Tri](.github/outdoor-plane.png)\n\nHere it `outdoor.txt` but with one vertex in the plane shifted up a bit.\n\n![Tri](.github/outdoor-plane2.png)\n\n## Boxes\nA modified version of `outdoor.txt` with a box\n\n![Box](.github/outdoor-box.png)\n\n\n\n# Features 3A\n\n\n## Sample Scene 1\nWe start with 50 samples per pixel on the file [spheres1.txt](.github/spheres1.txt)\n\n\u003cp align=\"center\"\u003e\n\n![Sample Scene 1](.github/spheres1.png)\n\n\u003c/p\u003e\n\n## Scene Setup\n\n### Camera Placement\n\u003cp align=\"center\"\u003e\n\n[The viewpoint is adjusted slightly](.github/spheres1-vp.txt)\n```text\ncamera_pos: -6 3 -2\n```\n\n![Sample Scene 1](.github/spheres1-vp.png)\n\n\u003c/p\u003e\n\n### Film Resolution (and Aspect Ratio)\n\n\u003cp align=\"center\"\u003e\n\n![Sample Scene 2](.github/spheres1-res.png)\n\n\u003c/p\u003e\n\n### Background Colors\n\n\u003cp align=\"center\"\u003e\n\n![Sample Scene 4](.github/spheres1-bg.png)\n\n\u003c/p\u003e\n\n### PNG Output\n- This should be clear\n\n\n## Primitive\n### Spheres\n- This should be clear\n\n## Lighting\n### Ambient Lights\n- This should be apparent by the default image\n\n### Point light sources\n- This should be apparent by the default image\n\n### Multiple light sources\n\n\u003cp align=\"center\"\u003e\n\n![Sample Scene 4](.github/spheres2-main.png)\n\n\u003c/p\u003e\n\n### Shadows\n- This should be apparent by the default image\n\n## Sampling \n- I added a custom command `samples: {#}` to determine the number of samples\n- The first sample is always at the center of the pixels\n- The rest are randomly distributed between the pixel boundary\n- This makes 1 sample equivalent to basic sampling and `n \u003e 1` samples equivalent to\njittered sampling\n  \n### Basic Sampling\n- results in jagged edges\n\u003cp align=\"center\"\u003e\n\n![Sample Scene 5](.github/spheres-samples1.png)\n\n\u003c/p\u003e\n\n### Sampling with `n=100`\n- smoother result like box-filtering.\n\n\u003cp align=\"center\"\u003e\n\n![Sample Scene 6](.github/spheres-samples100.png)\n\n\u003c/p\u003e\n\n## Materials\n### Color \u0026 Specularity\n- This should be apparent by the default image\n\n# Implementation\nThe code is implemented in C++. Some interesting features\n\n## General\n- I really like immutable data, so I made a macro `#define let const auto`\n- There are no switch statements for strings in C++. This is an issue for parsing commands.\nTo get around this I made an unordered map of string to enum and then used the switch\n  statement on the enum.\n- I use modern C++ 17 features such as destructuring and default nested struct values\n\n## Ray Tracing\n- Most of the logic occurs in `Scene` class\n- Collision uses the quadratic formula\n- Collision which occurs with a `t-value` less than 0.001 is ignored (to prevent shadow acne)\n- For each sample loops over all lights and sees if can reach it (to do this needs to iterate over all spheres)\n- Shades with appropriate formulas\n\n## Sampling\n- See the `Features/Sampling` section\n\n# Challenges\n- The switch statements described in the previous \n\n# Issues\n- So far, I do not see any issues in my code (apart from missing features)\n- If there is an issue, feel free to create a GitHub issue.\n\n\n  \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewgazelka%2Fcpp-raytracer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewgazelka%2Fcpp-raytracer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewgazelka%2Fcpp-raytracer/lists"}