A little ray tracer written in Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
img
lib
.gitignore
.ruby-version
Gemfile
Gemfile.lock
README.md
script.rb

README.md

raytracer

A small ray tracer written in Ruby, based on this excellent series of posts, since I'd never written one before.

Installation

  1. Install Ruby 2.3+
  2. Download this repo
  3. bundle
  4. ruby script.rb

Rendering is done in 4 threads and goes pretty quickly, but the final step of drawing the image can take awhile (sometimes a few minutes, increasing with the size of the output image). This drawing step is handled by ImageMagick.

script.rb has examples of image-based and programmatic textures, and changing to save the rendered image to a file instead of displaying it is a one line change to call .write(filename) rather than display.

http://i.imgur.com/YQpHy0e.png is an example render from this tracer.