C Ray Tracer
A very fast multithreaded ray tracer in C originally written for a school project.
C Ray Tracer is a very fast multithreaded ray tracer in C featuring a custom .scene file implementation, basic PPM file implementation, and recursive ray tracing with lighting, reflection, and three object primitives.
Details:
.scene
file implementation:- Custom file implementation
- Basic format describing a 3D scene to render
- Example
.scene
file
- PPM implementation:
- Portable PixMap (
.ppm
) - ASCII and binary formats (P3 and P6 respectively)
- Portable PixMap (
- Ray tracing:
- Features recursive ray tracing function with ray casting
- Allows for reflection, lighting, and more (e.g., refraction)
- 3 primitives:
- Sphere
- Plane
- Quadric
- Very fast
- 5.2s to render input.scene at 10000x10000 on Apple MacBook Air (Late 2020) with Clang 16
- OpenMP to easily utilize multithreading scalable to any system
- Aggressive inlining to minimize function overhead
- SIMD-friendly code
Some outputs from this ray tracer are shown below:
The following example was generated from a branched version with anaglyph support: