https://github.com/jsyrjala/zraytrace
Raytracing implemented in Zig language
https://github.com/jsyrjala/zraytrace
raytracing raytracing-in-one-weekend zig
Last synced: about 1 year ago
JSON representation
Raytracing implemented in Zig language
- Host: GitHub
- URL: https://github.com/jsyrjala/zraytrace
- Owner: jsyrjala
- Created: 2020-10-03T08:05:34.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-10-03T19:08:45.000Z (over 4 years ago)
- Last Synced: 2025-01-30T12:46:48.626Z (over 1 year ago)
- Topics: raytracing, raytracing-in-one-weekend, zig
- Language: Zig
- Homepage:
- Size: 3.75 MB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# zraytrace
Ray tracing implemented in [Zig](https://ziglang.org/).
## Inspiration
Code follows mostly [Ray Tracing in One Weekend](https://raytracing.github.io/) and [Physically Based Rendering](http://www.pbr-book.org/).
## Features
Single threaded, uses only on CPU.
Materials:
- diffuse (matte)
- metal (fully reflective)
- dielectric (glass like objects)
Shapes
- sphere
- triangle
Textures:
- constant color
- image textures
Algorithms
- Bounded volume hierarchy
File formats:
- PNG images, read and write
- OBJ 3d models, read
# Examples
## Spheres
This doesn't use bounded volume hierarchy because its overhead is too big for scene with 7 spheres.

From the left:
- reflective texture mapped sphere (earth)
- hollow dielectric sphere (glass)
- diffuse texture mapped sphere (Nitor logo)
- filled dielectric sphere (glass)
- reflective sphere with silver color (mirror ball)
- diffuse green sphere (ground level)
Some statistics
- Surfaces: 7
- Pixels: 1000x1000
- Samples per pixel: 1000
- Max recursion depth: 30
- Total reflections: 1144753226
- Total background hits: 999892115
- Total pixels: 1000000
- Total samples: 1000000000
- Total rays: 2144645362
- Total reflections: 1144753226
- Pixels per second: 1619.68 pixels/s
- Total runtime: 617.41 seconds