{"id":20372412,"url":"https://github.com/vkoskiv/c-ray","last_synced_at":"2025-04-14T08:17:16.191Z","repository":{"id":37601795,"uuid":"81029769","full_name":"vkoskiv/c-ray","owner":"vkoskiv","description":"c-ray is a small, simple path tracer written in C","archived":false,"fork":false,"pushed_at":"2025-04-02T10:41:16.000Z","size":43297,"stargazers_count":811,"open_issues_count":18,"forks_count":43,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-04-14T08:17:07.025Z","etag":null,"topics":["bvh-accelerator","c","graphics","graphics-rendering","json","kd-tree","monte-carlo","path-tracer","path-tracing","ray-tracing","raytrace","raytracer","raytracing","raytracing-algorithms","sdl2"],"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/vkoskiv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"github":"VKoskiv"}},"created_at":"2017-02-05T23:26:08.000Z","updated_at":"2025-04-02T10:41:19.000Z","dependencies_parsed_at":"2024-01-14T02:43:59.243Z","dependency_job_id":"0d12186b-d435-4644-9124-c63d4a455051","html_url":"https://github.com/vkoskiv/c-ray","commit_stats":{"total_commits":2248,"total_committers":6,"mean_commits":374.6666666666667,"dds":0.01868327402135228,"last_synced_commit":"e90bc6cf304901b9c93a63a51f9817b58c4524f9"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vkoskiv%2Fc-ray","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vkoskiv%2Fc-ray/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vkoskiv%2Fc-ray/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vkoskiv%2Fc-ray/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vkoskiv","download_url":"https://codeload.github.com/vkoskiv/c-ray/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248843999,"owners_count":21170499,"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":["bvh-accelerator","c","graphics","graphics-rendering","json","kd-tree","monte-carlo","path-tracer","path-tracing","ray-tracing","raytrace","raytracer","raytracing","raytracing-algorithms","sdl2"],"created_at":"2024-11-15T01:13:07.184Z","updated_at":"2025-04-14T08:17:16.154Z","avatar_url":"https://github.com/vkoskiv.png","language":"C","readme":"\u003cp align=\"center\"\u003e\n\t\u003cimg src=\"https://i.imgur.com/fPBuCTG.png\" width=\"256\"\u003e\n\u003c/p\u003e\n\n# c-ray\n\nA portable, hackable, embeddable software path tracer.\n\n[![Build Status](https://github.com/VKoskiv/c-ray/workflows/C-ray%20CI/badge.svg)](https://github.com/VKoskiv/c-ray/actions?query=workflow%3A%22C-ray+CI%22)\n[![justforfunnoreally.dev badge](https://img.shields.io/badge/justforfunnoreally-dev-9ff)](https://justforfunnoreally.dev)\n\n## Example renders\n\n\u003cp align=\"center\"\u003e\n\t\u003cimg src=\"https://vkoskiv.com/c-ray/renders/readme_0.png\" width=\"768\"\u003e\n\t\u003cbr\u003e(1000 samples, 1920x1080, 512 max bounces, 26min, scene by \u003ca href=\"https://www.blendswap.com/blend/13953\"\u003eScott Graham\u003c/a\u003e)\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\t\u003cimg src=\"https://vkoskiv.com/c-ray/renders/readme_1.png\" width=\"768\"\u003e\n\t\u003cbr\u003e(256 samples, 2560x1440, 12 max bounces, 9min 37s, scene by \u003ca href=\"https://www.blendswap.com/blend/18762\"\u003eMaTTeSr\u003c/a\u003e)\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\t\u003cimg src=\"https://vkoskiv.com/c-ray/renders/readme_2.png\" width=\"768\"\u003e\n\t\u003cbr\u003e(512 samples, 2560x1600, 30 max bounces, 8min)\n\u003c/p\u003e\n\n## About\n\nc-ray is a portable, hackable, offline CPU rendering engine built for learning. The core is in plain C99, with an emphasis on clarity and avoiding superfluous abstraction. Contributions are welcome. See the [contributing section](https://github.com/vkoskiv/c-ray/wiki/Contributing) in the wiki for more details.\n\nAn incomplete list of features:\n- [Cluster rendering support over TCP/IP](https://github.com/vkoskiv/c-ray/wiki/Using-cluster-rendering)\n- [A C API](https://github.com/vkoskiv/c-ray/blob/master/include/c-ray/c-ray.h)\n- [Python bindings](https://github.com/vkoskiv/c-ray/blob/master/bindings/c_ray.py)\n- [A Blender add-on](https://github.com/vkoskiv/c-ray/blob/master/bindings/blender_init.py)\n- A node-graph material/shader system with 32+ node types, including a Principled BSDF approximation.\n- A performant BVH accelerator (by @madmann92)\n- A simple unidirectional Monte Carlo integrator with global illumination\n- Real-time render preview and state reporting using a callback mechanism\n- Simple thin-lens camera approximation with depth of field\n- Multithreading\n- Object instancing\n- HDR environment maps for realistic lighting\n- Triangles and spheres\n- Russian Roulette path optimization\n\nThings I'm looking to implement:\n- More advanced light sampling\n- Better performance \u0026 lower memory consumption.\n- Proper physically based materials in place of the current ad-hoc implementations\n- More cool advanced techniques from research literature\n\n## Portability\n\nc-ray has been verified to work on the following architectures\n- x86 \u0026 x86\\_64 (Primarily developed on x86\\_64)\n- ARMv6, ARMv7 and ARMv8, AARCH64 (Various Raspberry Pi systems)\n- PowerPC 7xx and 74xx (PowerPC G3 and G4 systems)\n- MIPS R5000 ([1996 SGI O2](https://twitter.com/vkoskiv/status/1236419126555488257?s=20))\n- SuperSPARC II ([1992 SUN SparcStation 10](https://twitter.com/vkoskiv/status/1234515380200235008?s=20))\n- [WebAssembly with emscripten](https://github.com/ani003/c-ray/tree/wasm)\n\n## Usage\n\nA basic driver program can be used to run c-ray standalone (see 'Stand-alone usage' below), but the easiest way to try out c-ray is to build and install the Blender add-on, and trying it out there:\n\n1. Check `BLENDER_ROOT` in `lib.mk`, make sure it points to the version of Blender you have installed\n2. `make fullblsync` will then compile the python bindings (`cray_wrap.so`), and install under `BLENDER_ROOT` as an add-on.\n3. Enable the c-ray add-on in Blender Preferences, and choose `c-ray for Blender` as your render engine.\n4. Report bugs or missing features (there are a lot!) by filing an issue here on GitHub\n\n## Dependencies\n\n### Compile time:\n\n- Standard C99 compiler with some fairly common libraries (libc, libm, pthreads)\n\n### Runtime:\n- CMake for the build system (Optional, a basic makefile is provided for *nix systems)\n- SDL2 (Optional, enabled if SDL2 was found at runtime)\n- Python3 (Optional, it's used for some utility scripts)\n\n## Tests\n\nYou can run the integrated test suite by invoking the test script like this:\n`./run-tests.sh`\nThis will compile c-ray with the correct flags, and then run each test individually in separate processes. If you want to run them in a shared process, do\n`bin/c-ray --test`\nYou can also run a single suite\n`./run-tests.sh mathnode`\n\n## Stand-alone usage\n\nYou can mostly ignore these instructions below if you're only interested in running c-ray as a Blender add-on.\n\nLinux:\n1. (Optional) Install SDL2 (See installing SDL below)\n2. Run `make` to build the project\n3. If the plain Makefile doesn't work on your system, run `cmake .` and then try `make` again.\n4. Run binary. For example: `bin/c-ray input/hdr.json`. You can also pipe files into `c-ray` and it will read from there. This is useful for scripts that invoke `c-ray`.\nExample: `cat input/scene.json | bin/c-ray`\n*Note: When reading the json from `stdin`, c-ray assumes that the asset path is `./`. This can be specified with `--asset-path`*\n\nmacOS:\n1. Follow Linux instructions, or you can try `mkdir build \u0026\u0026 cd build \u0026\u0026 cmake -G Xcode ..`\n\nWindows:\n1. Install [Build Tools for Visual Studio](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019)\n2. Optional: Download SDL2 Development libaries from here and extract: https://www.libsdl.org/download-2.0.php (https://www.libsdl.org/release/SDL2-devel-2.0.8-VC.zip)\n3. Open a `Developer Command Prompt for VS 2019`, navigate to where you cloned c-ray and set path to SDL2DIR (where you extracted the files to, should have a few folders like 'include' and 'lib'): `set SDL2DIR=E:\\sdl2\\SDL2-devel-2.0.8-VC\\SDL2-2.0.8`\n4. Run cmake: `cmake -G \"Visual Studio 16 2019\" .`\n5. (Optional) Copy your `SDL2.dll` into `bin\\Release\\` and `bin\\Debug\\`\n6. Build the generated solution: `msbuild c-ray.sln /p:Configuration=Release`\n7. Run:\t`bin\\Release\\c-ray.exe input\\scene.json` or `type input\\scene.json | bin\\Release\\c-ray.exe`\n\n## Usage\n\nAll the .json files in `input/` are test scenes provided with c-ray, assets for those scenes are (mostly) bundled with the repository as well.\n\nIf you make a cool scene and have Python3 installed, you can bundle up the scene into a portable .zip file using the `scripts/bundle.py` script.\n\n## Credits\n\n3rd party libraries included in this project include:\n\n- lodePNG PNG compression library: http://lodev.org/lodepng/\n- stb\\_image.h by Sean Barrett: https://github.com/nothings/stb/blob/master/stb_image.h\n- SDL2: https://www.libsdl.org/index.php (Optional)\n- JSON parsing library: https://github.com/DaveGamble/cJSON\n- PCG random number generator: http://www.pcg-random.org\n\n## Contributors\n\n- Huge thanks to [@madmann91](https://github.com/madmann91) for the BVH accelerator and overall ~60% performance improvement\n\nPlease file an issue detailing any improvements you're planning on making. I openly welcome contributions!\n\nYou can also ping me on **Discord**: `vkoskiv#3100`\n","funding_links":["https://github.com/sponsors/VKoskiv"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvkoskiv%2Fc-ray","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvkoskiv%2Fc-ray","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvkoskiv%2Fc-ray/lists"}