/ray_tracer

Ray-tracer written in go

Primary LanguageGoMIT LicenseMIT

Ray Tracer

License: MIT Go Report Card

A ray-tracer written in golang.

Roughly following the Ray Tracing in One Weekend blog.

Example Image

Install

To install, place the package in your go/src folder:

~ go get github.com/am-khan/ray_tracer/cmd/ray_tracer

Usage

To run (with build):

~ ray_tracer

Using 16 goroutines.

[================================================================================] 100.00%

Done. 
Elapsed: 25.709205942s

Environment

Currently, the environment supports spheres, aliasing and 3 types of materials:

  • Lambertian
  • Metallic
  • Dialectric

To set up a new object, go to configs/config.json and specify the properties there.

go build github.com/am-khan/ray_tracer/cmd/ray_tracer

Outputs

Images are created at ./image.png with the dimensions and attributes set within configs/config.json.

Testing

To run the unit tests - use the built-in go test runner:

~ go test ./...