Zero-dependency, concurrent raytracer written in Swift. A simple weekend experiment following the excellent book at https://raytracing.github.io/.
Features:
- Positionable camera with Depth of Field and Field of View.
- Three kinds of materials: Lambertian, Dielectric and Metal.
- Configurable antialiasing.
- Optimized to make use of all available cores.
- Outputs Portable Bitmap Format files.
This raytracer runs entirely in the CPU. At some point I might add SIMD or GPU support for learning purposes, but being ultra-performant is not the main priority.
Usage:
Setup your scene in the main.swift
file and run:
$ swift run
[12/12] Linking raytracer
Rendering using all available cores: 8
Rendering took 2622 ms
Writing image in Portable Bitmap Format
Done, result at ~/src/raytracer-swift/result.ppm
You can configure the quality via the samplesPerPixel
parameter.