shovon / raytracing-c

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ray Tracing in One Weekend in C

Output from ray tracing

This is a ray tracing implementation in C, pretty much a re-implementation of an earlier attempt in Go

All implementation was translated from the minibook Ray Tracing In One Weekend. The book opted for C++, but I figured it's a good way to give C a try.

Running the ray tracer

make
./raytracer-c > img.ppm

The program outputs portable pixmap format to the console/stdout, and so, the > symbol writes the output to a file.

Rendering a whole 1024 by 576 image takes around an 5 to 6 minutes on my 2020 M1 MacBook Pro. If you want something rendered quicker, change the nx and ny variables in main(), in main.c to something smaller than 1024 by 576 (perhaps 200 and 100, respectively).

About


Languages

Language:C 98.6%Language:Makefile 1.4%