Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jsyrjala/zraytrace
Raytracing implemented in Zig language
https://github.com/jsyrjala/zraytrace
raytracing raytracing-in-one-weekend zig
Last synced: about 2 months 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 4 years ago)
- Default Branch: master
- Last Pushed: 2021-10-03T19:08:45.000Z (over 3 years ago)
- Last Synced: 2024-10-16T03:43:03.346Z (3 months 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
- triangleTextures:
- constant color
- image texturesAlgorithms
- Bounded volume hierarchyFile 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.
![7 spheres with various materials and textures](https://github.com/jsyrjala/zraytrace/raw/master/showcase/7-spheres.png)
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