Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

tinyray

A simple raytracer in exactly 450 lines of C-code.

Output

Features

  • Sphere-Ray Intersection
  • Materials
  • Diffuse and Specular Lighting
  • Point, Directional, and Ambient Lights
  • Custom Floating-Point Vector Library
  • Output to image with stb_image
  • Gradient Background
  • Watermark

Building

Find a compiler and build tinyray.c. Run the executable and it'll create an image called 'output.bmp' in that directory. Simple as that!

Some examples:

# Building with gcc
$ gcc tinyray.c -o "tinyray"

# Building with cl
> cl tinyray.c

tinyray uses the excellent stb_image_write library for outputting a bitmap image.

License

Public Domain - Do whatever you like!

Credit would be very much appreciated though :)

Helpful Resources

I created this toy raytracer to learn about basic raytracing (and for fun, of course), taking inspiration from the following resources:

The first link is especially helpful in understanding how raytracing works from a mathematical perspective.

I created this for fun for the UoA ENGGEN 131 Art Challenge

About

A simple raytracer in exactly 450 lines of C code.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Contributors

Languages