{"id":27442520,"url":"https://github.com/xuyanwen2012/toytracer","last_synced_at":"2025-09-10T13:33:08.559Z","repository":{"id":128405359,"uuid":"214765100","full_name":"xuyanwen2012/ToyTracer","owner":"xuyanwen2012","description":"A toy Ray-tracer implemented with c++ \u0026 glm","archived":false,"fork":false,"pushed_at":"2019-10-18T20:46:08.000Z","size":3840,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T00:33:59.702Z","etag":null,"topics":["cpp","cpp11","raytracer","raytracing"],"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/xuyanwen2012.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,"zenodo":null}},"created_at":"2019-10-13T05:19:56.000Z","updated_at":"2019-12-06T00:26:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"6c8ecea5-2a42-4605-9370-9710c0034987","html_url":"https://github.com/xuyanwen2012/ToyTracer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xuyanwen2012/ToyTracer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuyanwen2012%2FToyTracer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuyanwen2012%2FToyTracer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuyanwen2012%2FToyTracer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuyanwen2012%2FToyTracer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xuyanwen2012","download_url":"https://codeload.github.com/xuyanwen2012/ToyTracer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuyanwen2012%2FToyTracer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274470403,"owners_count":25291604,"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","status":"online","status_checked_at":"2025-09-10T02:00:12.551Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["cpp","cpp11","raytracer","raytracing"],"created_at":"2025-04-15T00:29:42.203Z","updated_at":"2025-09-10T13:33:08.535Z","avatar_url":"https://github.com/xuyanwen2012.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🎺 ToyTracer\n\u003e CMPM 164, Fall 2019\n\nThis repo is for homework 2B. \n\nA naive toy Ray Tracer built from ~~scract~~ (given up), used a third-party library [OpenGL Mathematics](https://github.com/g-truc/glm) (*GLM*). \n\n## Outputs\n\n![alt text](0.png)\n\nWith 1280x720, Gama 2.2, FoV 90, Max Recursion Depth 10.  \n\n## Features\n\n- `Phong Lighting`: Has 3 solid spherical objects with 2 shperical lights and 1 directional light using the Phong lighting model.\n- `Relection \u0026 Refraction`: Have 3 spherical objects different material, including shadows.\n- `Additonal Shapes`: Have Triangle shape, Plane shape.\n- `Fresnel Effect`\n- `Gamma Correction`\n- `Modern C++ Practices`\n\n## Sample Code\n\nSphere Implementation\n\n```c++\n\n#pragma once\n\n#include \u003cglm/gtx/intersect.hpp\u003e\n\n#include \"Element.h\"\n\nclass Sphere : public Element\n{\npublic:\n   Sphere(Material material, const glm::vec3\u0026 center, const float radius) :\n      Element(material),\n      origin_(center),\n      radius_(radius)\n   {\n   }\n\n   bool Intersect(const Ray\u0026 ray, float\u0026 dist) override\n   {\n      return intersectRaySphere(\n         ray.GetOrigin(), ray.GetDirection(),\n         origin_, radius_ * radius_,\n         dist\n      );\n   }\n\n   glm::vec3 GetSurfaceNormal(glm::vec3\u0026 hit_point) override\n   {\n      return (hit_point - origin_) / radius_; // from glm\n   }\n\n   glm::vec2 TextureCoords(glm::vec3\u0026 hit_point) override\n   {\n      const auto hit_vec = hit_point - origin_;\n\n      return {\n         (1.0 + atan2(hit_vec.z, hit_vec.x)) / glm::pi\u003cfloat\u003e() * 0.5f,\n         acos(hit_vec.y / radius_) / glm::pi\u003cfloat\u003e()\n      };\n   }\n\nprivate:\n   glm::vec3 origin_;\n   float radius_;\n};\n\n```\n\n## Meta\n\nYanwen Xu – [UCSC](https://people.ucsc.edu/~yxu83/) – yxu83@ucsc.edu\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxuyanwen2012%2Ftoytracer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxuyanwen2012%2Ftoytracer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxuyanwen2012%2Ftoytracer/lists"}