{"id":24884448,"url":"https://github.com/cpscript/micropython-raytracer","last_synced_at":"2025-08-17T21:14:12.090Z","repository":{"id":222031330,"uuid":"756054691","full_name":"CPScript/MicroPython-RayTracer","owner":"CPScript","description":"RayTracer for most micro-controllers with MicroPython","archived":false,"fork":false,"pushed_at":"2025-01-30T21:06:54.000Z","size":1664,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-11T19:54:49.113Z","etag":null,"topics":["assembly","c","micro-controller","micropython","python"],"latest_commit_sha":null,"homepage":"","language":"Python","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/CPScript.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":"2024-02-11T20:56:13.000Z","updated_at":"2025-02-10T00:16:29.000Z","dependencies_parsed_at":"2024-11-17T17:24:48.807Z","dependency_job_id":null,"html_url":"https://github.com/CPScript/MicroPython-RayTracer","commit_stats":null,"previous_names":["cpscript/casio-ray.tracer.main.py","cpscript/casio-ray.tracer","cpscript/casio-raytracer","cpscript/micropython-raytracer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CPScript/MicroPython-RayTracer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CPScript%2FMicroPython-RayTracer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CPScript%2FMicroPython-RayTracer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CPScript%2FMicroPython-RayTracer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CPScript%2FMicroPython-RayTracer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CPScript","download_url":"https://codeload.github.com/CPScript/MicroPython-RayTracer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CPScript%2FMicroPython-RayTracer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270907415,"owners_count":24665958,"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-08-17T02:00:09.016Z","response_time":129,"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":["assembly","c","micro-controller","micropython","python"],"created_at":"2025-02-01T14:27:13.990Z","updated_at":"2025-08-17T21:14:12.065Z","avatar_url":"https://github.com/CPScript.png","language":"Python","readme":"\u003e A lightweight ray tracer optimized for MicroPython-based Micro Controllers, featuring **fast pixel rendering**, **framebuffer optimizations**, and **C-accelerated shading calculations**.\n\n## 🚀 Features\n\n- **Framebuffer Rendering**: Faster pixel updates using `framebuf`\n- **Optimized Shading**: Uses a **C module** for fast lighting calculations\n- **Integer Math**: Reduces slow floating-point operations\n- **ESP32/RP2040 Parallel Processing**: Can utilize multi-core rendering (optional)\n- **Modular Structure**: Easily customizable for different displays and resolutions\n\n---\n\n## 🛠 Installation\n\n### 1️⃣ Flash MicroPython\nEnsure your board has **MicroPython** installed. If not, download it from:\n[MicroPython Downloads](https://micropython.org/download/)\n\n### 2️⃣ Install Required Modules\nUpload the **setup script** and install dependencies:\n\n```bash\nmpremote fs cp setup.py :/setup.py\nmpremote run setup.py\n```\n\n### 3️⃣ Upload Project Files\nTransfer all required source files to your MicroPython device:\n```bash\nmpremote fs cp -r src :/src\nmpremote fs cp -r modules :/modules\n```\n\n### 4️⃣ Compile C Module (Optional for Performance)\nIf using ESP32/RP2040, compile the C module for optimized shading:\n\n```bash\nmpy-cross modules/fast_raytrace.c\n```\n\u003e Refer to MicroPython's `C module guide` for detailed instructions.\n\n---\n\n#### 📌 Usage\n\nRun the ray tracer with:\n```\nimport src.main\n```\n\n\u003e Output: Will render a simple sphere with shading\n\n--- \n\n#### 📂 Tree\n```\n/ray_tracer_project\n│── /src\n│   ├── graphics.py      # Handles pixel drawing \u0026 framebuffer\n│   ├── ray_tracer.py    # Main ray tracing logic\n│   ├── main.py          # Entry point of the program\n│── /modules\n│   ├── fast_raytrace.c  # C module for faster shading\n│── setup.py             # Installs required modules\n```\n\n---\n\n#### 🖥️ How It Works\n### 📍 1. Graphics Engine\n\n**graphics.py**:\n\n-    Uses framebuf for efficient screen updates\n-    Draws pixels via the display driver\n-    Implements clear screen \u0026 refresh functions\n\n### 🎮 2. Ray Tracing Algorithm\n\n**ray_tracer.py**:\n\n-    Traces rays to detect sphere intersections\n-    Calculates shading intensity based on a light source\n-    Uses the fast C module for improved performance\n\n### ⚡ 3. Optimized Performance\n\n-    Batch pixel updates reduce display lag\n-    Precomputed math avoids redundant calculations\n-    C acceleration speeds up shading operations\n\n---\n\n#### ⚡ Optimizations \u0026 Performance\n\nOptimization | Benefit\n---|---\nFramebuffer (`framebuf`) | Fast pixel updates\nC Module (`fast_raytrace.`c) | Accelerates shading calculations\nInteger Math | Avoids slow floating-point operations\nESP32/RP2040 Parallelism | Uses multiple cores for rendering\n\n---\n\n#### 🔧 Customization\n\nModify the following parameters in `ray_tracer.py`:\n\n-    Resolution (WIDTH, HEIGHT)\n-    Sphere Position (SPHERE_POS)\n-    Light Source (LIGHT_POS)\n-    Color Intensity (`shade()` function in `fast_raytrace.c`)\n\n---\n\n\u003e Built off of \"https://github.com/CPScript/fx-CG50_RayTracer\"\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcpscript%2Fmicropython-raytracer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcpscript%2Fmicropython-raytracer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcpscript%2Fmicropython-raytracer/lists"}