This is a Monte Carlo style 3d renderer (so the more samples you use, the closer to a perfect render it gets.) Here are some images I've rendered with it so far:
- Shapes
- Sphere
- Plane
- Triangle
- Rectangle
- Rectangular prism
- Volumes of any other shape
- Materials
- Diffuse
- Reflective
- Refractive
- Light emitter
- Volumes
- Subsurface Scattering
- Lens blur
- Motion blur
Edit Sources/Raytracer/main.swift
to change the size of the image, objects, etc. Then run the raytracer:
swift build
.build/debug/Raytracer
A general overview of ratracing: http://www.davepagurek.com/blog/how-raytracing-works
Subsurface scattering: http://www.davepagurek.com/blog/volumes-subsurface-scattering
Antialiasing works by first rendering an image, then applying a find edges filter, and then rerendering edge areas at a sub-pixel level.
Here is a detail of the original depth image:
Edges are found by subtracting a blurred version from the original:
Then, those areas are rerendered at double the pixel density to smooth the edges: