Skip to content

k0pernicus/c-raytracer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

c-raytracer

A raytracer exercise in C (C 11)... just for fun.
I only used the C standard library for this exercise.

Based on Ray Tracing in One Weekend.

Build

make release # or debug if you want debug symbols in the bin
./raytracer

This repository includes my vscode configuration, if you want to play / debug the program by yourself.

Visualisation

The output is a PPM file - to see the content, please to install a PPM viewer (like ImageMagick).
If you don't want to use the ppm file, you can convert it using the convert tool from imagemagick, for example on png convert output.ppm output.png.

GNU/Linux

# to display the output image using imagemagick
display output.ppm

about macOS

default

macOS allows to watch ppm images using the default image viewer of macOS.
You can try, using the command line: open output.ppm.

imagemagick / X11

If you want to use display from imagemagick for whatever reason:

# install X11 on macOS (and launch it)
brew cask install xquartz # you can use --appdir option to install xquartz in your userspace
# to communicate with xquartz, you will have to set the DISPLAY environment variable
export DISPLAY=:0
# install imagemagick
brew install imagemagick
# display the file
magick display output.ppm

If you want to have more explanation about the installation on macOS: https://imagemagick.org/script/download.php#macosx.

About

A simple raytracer in C

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published