{"id":15700346,"url":"https://github.com/soumik12345/radium","last_synced_at":"2025-06-16T11:08:27.264Z","repository":{"id":53131535,"uuid":"331975337","full_name":"soumik12345/Radium","owner":"soumik12345","description":"Radium is a Ray Tracing Engine written in C++ that runs on the CPU using shared-memory multiprocessing","archived":false,"fork":false,"pushed_at":"2021-11-13T04:00:52.000Z","size":19853,"stargazers_count":20,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-12T13:12:58.560Z","etag":null,"topics":["computer-graphics","cpp","monte-carlo","multiprocessing","openmp","raytracing","russian-roulette"],"latest_commit_sha":null,"homepage":"","language":"C++","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/soumik12345.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}},"created_at":"2021-01-22T14:49:33.000Z","updated_at":"2025-01-16T04:41:01.000Z","dependencies_parsed_at":"2022-09-09T09:30:56.675Z","dependency_job_id":null,"html_url":"https://github.com/soumik12345/Radium","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/soumik12345/Radium","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soumik12345%2FRadium","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soumik12345%2FRadium/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soumik12345%2FRadium/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soumik12345%2FRadium/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soumik12345","download_url":"https://codeload.github.com/soumik12345/Radium/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soumik12345%2FRadium/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260148388,"owners_count":22965912,"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":["computer-graphics","cpp","monte-carlo","multiprocessing","openmp","raytracing","russian-roulette"],"created_at":"2024-10-03T19:48:05.245Z","updated_at":"2025-06-16T11:08:27.241Z","avatar_url":"https://github.com/soumik12345.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Radium\n\nRadium is a small and lightweight Ray Tracing Engine written in C++ that runs on the\nCPU using shared-memory multiprocessing.\n\n## Features\n\n- Simple and easy-to-use API.\n\n- Global illumination using Unbiased Monte Carlo Path Tracing.\n\n- Soft shadows from Diffuse Light Sources.\n\n- Specular, Diffuse, and Refractive Materials are supported.\n\n- Total Internal Reflection for Refractive Materials.\n\n- Russian Roulette for path termination.\n\n- Radium has been tested on MacOS and Linux. Support for Windows is Experimental via WSL.\n\n## Build Instructions\n\n- `git clone --recursive https://github.com/soumik12345/Radium`\n\n- `sh ./install.sh linux` in order to install the python dependencies. For MacOs, use argument `mac`.\n\n- Make sure you have CMake installed for your system.\n\n- Edit to include the engine code `src/main.cpp`.\n\n- `sh ./build_and_run.sh`\n\n- In order to run Radium on Google Colab, refer to\n  [![](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/soumik12345/Radium/blob/monte_carlo/notebooks/Demo.ipynb)\n\n## API Usage Example\n\nRendering a [Cornell Box](https://en.wikipedia.org/wiki/Cornell_box) is considered a standard benchmark for a\nrendering system. The basic environment consists of:\n\n- One light source in the center of a white ceiling\n- A green right wall\n- A red left wall\n- A white back wall\n- A white floor\n\nWe will try to add two more objects, a DIFFUSE and a REFRACTED object.\n\n```c++\n#include \"Radium.h\"\n\n\nint main() {\n\n    // Step 1: Create an instance of the Radium Renderer\n    Renderer renderer(1024, 768, 5000); // Parameters -\u003e Frame Width, Frame Height, Samples per Pixel\n\n    // Step 2: Set the position and direction of the Renderer Camera\n    renderer.setCameraPosition(50, 50, 295.6); // Set Position of the Renderer Camera\n    renderer.setCameraDirection(0, -0.042612, -1); // Set Direction of Renderer Camera\n\n    // Step 3: Create the Scene by placing Spherical Objects\n    // Parameters for Sphere -\u003e Radius, Position, Emission, Color, Material\n    renderer.addObject(\n            Sphere(1e5, Vector3(1e5 + 1, 40.8, 81.6), Vector3(), Vector3(.75, .25, .25), DIFFUSE)); // Left Wall\n    renderer.addObject(\n            Sphere(1e5, Vector3(-1e5 + 99, 40.8, 81.6), Vector3(), Vector3(.25, .25, .75), DIFFUSE)); // Right Wall\n    renderer.addObject(\n            Sphere(1e5, Vector3(50, 40.8, 1e5), Vector3(), Vector3(.75, .75, .75), DIFFUSE)); // Back Wall\n    renderer.addObject(\n            Sphere(1e5, Vector3(50, 40.8, -1e5 + 170), Vector3(), Vector3(), DIFFUSE)); // Front Wall\n    renderer.addObject(\n            Sphere(1e5, Vector3(50, 1e5, 81.6), Vector3(), Vector3(.75, .75, .75), DIFFUSE)); // Bottom Floor\n    renderer.addObject(\n            Sphere(1e5, Vector3(50, -1e5 + 81.6, 81.6), Vector3(), Vector3(.75, .75, .75), DIFFUSE)); // Top Ceiling\n    renderer.addObject(\n            Sphere(16.5, Vector3(27, 16.5, 47), Vector3(), Vector3(1, 1, 1) * .999, SPECULAR)); // Shiny Surface Ball\n    renderer.addObject(\n            Sphere(16.5, Vector3(73, 16.5, 78), Vector3(), Vector3(1, 1, 1) * .999, REFRACTED)); // Glass Ball\n    renderer.addObject(\n            Sphere(600, Vector3(50, 681.6 - .27, 81.6), Vector3(12, 12, 12), Vector3(), DIFFUSE)); // Light Source\n\n    // Step 4: Render the Scene\n    renderer.render(true); // Parameter -\u003e Flag to turn on Progressbar or not\n\n    // Step 5: Export the Scene and Camera Settings to CSV files\n    // These CSV files can be parsed by renderer.importCamera and renderer.importWorld methods\n    renderer.exportWorld(\"cornell_box_world.csv\");\n    renderer.exportCamera(\"cornell_box_camera.csv\");\n\n    return 0;\n}\n```\n\nThis gives us the following result:\n\n![](./assets/simple_cornell_box.png)\n\nThis took 100 minutes to render on Intel Core i5 8th Gen.\n\nYou can also render a scene from the exported CSV files as shown below,\n\n```c++\n#include \"Radium.h\"\n\n\nint main() {\n\n    Renderer renderer(1024, 768, 40);\n\n    renderer.importCamera(\"../scenes/cameras/demo_4_camera.csv\");\n    renderer.importWorld(\"../scenes/worlds/demo_4_world.csv\");\n\n    renderer.render(true);\n\n    return 0;\n}\n\n```\n\n### Points to be Noted:\n\n- Radium supports only spherical objects, other shapes are not supported.\n  In order to render flat surfaces, we can use a sphere with a large radius\n  and place the camera close to it, so that the curvature of the surface is not noticeable.\n  \n- If you are using build_and_run.sh, make sure that your world file\n  ends with `world.csv` and camera file with `camera.csv`.\n  \n- By default, the World settings are exported at `./scenes/worlds`,\n  the camera settings are exported at `./scenes/cameras` and\n  the rendered image is exported at `./dump` in both ppm and png format.\n  \n- Radium achieves parallelism in the computation using an OpenMP `#pragma`\n  to dynamically allocate rows of the image to different threads for each processor or core.\n  Hence, if you have openmp installed on your system, it would significantly increase the rendering speed.\n  \n- Rendering time increases with increase in samples per pixel.\n  Rendering at lower samples per pixel however increases black dot artifacts.\n\n## Demos\n\n### Demo 1\n\n![](./assets/demo_1.png)\n\n|Frame Dimensions|Number of Objects|Samples per Pixel|Processor|Render Time|\n|----------------|-----------------|-----------------|---------|-----------|\n|(1024, 768)|7|5000|Intel Core i5 8th Gen|91 Miniutes|\n\n\n### Demo 2\n\n![](./assets/demo_2.png)\n\n|Frame Dimensions|Number of Objects|Samples per Pixel|Processor|Render Time|\n|----------------|-----------------|-----------------|---------|-----------|\n|(1024, 768)|5|40|Intel Core i5 8th Gen|2 Minutes|\n\n### Demo 3\n\n![](./assets/demo_3.png)\n\n|Frame Dimensions|Number of Objects|Samples per Pixel|Processor|Render Time|\n|----------------|-----------------|-----------------|---------|-----------|\n|(1024, 768)|7|200|Intel Core i5 8th Gen|4 Minutes|\n\n### Demo 4\n\n![](./assets/demo_4.png)\n\n|Frame Dimensions|Number of Objects|Samples per Pixel|Processor|Render Time|\n|----------------|-----------------|-----------------|---------|-----------|\n|(1024, 768)|9|5000|Intel Core i5 8th Gen|71 Minutes|\n\n## Acknowledgement\n\n- [An improved illumination model for shaded display](https://dl.acm.org/doi/10.1145/358876.358882)\n  by [Turner Whitted](https://dl.acm.org/profile/81100586999).\n  \n- [The rendering equation](https://dl.acm.org/doi/10.1145/15922.15902)\n  by [James T Kajiya](https://dl.acm.org/profile/81100653012).\n  \n- Data for constructing the demo images have been taken from the demos of Kevin Beason's\n  [smallpt](http://www.kevinbeason.com/smallpt/extraScenes.txt)\n  \n- [An Introduction to Ray Tracing](https://amzn.to/2Op60pm).\n  \n- [Realistic Ray Tracing](https://amzn.to/3rZIvkB) by [Peter Shirley](https://twitter.com/Peter_shirley).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoumik12345%2Fradium","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoumik12345%2Fradium","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoumik12345%2Fradium/lists"}