Yet another raytracer. Writen in Go
Go Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
doc
images
out
.gitignore
README.md
_vertex_raytracer_autocomplete
camera.go
clamp.go
color01.go
cylinder.go
generategif.sh
hittable.go
image.go
intersectionInfo.go
light.go
main.go
material.go
matrix.go
noise.go
options.go
plane.go
ray.go
sphere.go
sphere_test.go
texture.go
utils.go
vertex.go
vertex_test.go

README.md

Vertex is a work-in-progress raytracer writen in go.

You have probably reached this place by accident : do not expect great code quality, I write this thing in order to learn the language.

Current result

Current status

Pretty much all the current features are here : random dynamic textures on spheres, lights with specular highlights, reflection, soft shadows, anti-aliasing, exposure and gamma correction.

The first versions were quick to generate (1-3 seconds), but throwing a lot of rays for the softshadows and reflection, along with the blinn-phong specular highlight computation starts to slow things down. This picture took 1mn 57 to generate.

This is normal since the time complexity of the raytracing is a linear function of the number of rays. When you send 16 more ray, for soft shadows, the algorithm is 16 times slower.

Evolution of the project :

Evolution

Features/Todo

The current image status can be seen in the out directory.

  • introduce basic algorithm
  • antialiasing
  • introduce simple lighting
  • add shadows
  • add reflection
  • command line parameters
  • Other intersections
    • Plane
    • Torus
    • Cylinder
  • Transformations (rotation translation scaling)
  • Refraction
  • Lambert shading
  • Blinn phong for specular highlights (pretty costly)
  • Gamma correction
    • [ ]should be configurable (toggle yes/no)
  • Exposure correction
    • should be configurable (cli options or configuration file)
    • add possibility to choose between the different exposure methods
  • Texture mapping
    • File image
    • Checkboard
  • Cool generated textures
    • Perlin noise
    • Wood
    • Marble
  • Bump mapping
  • Displacement mapping
  • Space partitionning
  • load scene from file (simple json ?)
  • Add save to PPM file format
  • Depth of field
  • Soft shadows
  • Better antialiasing (adaptative, poisson disk-based random sampling ?)
  • Metaballs. Just because metaballs

Go further, to infinity and beyond !

Run the scene

In order to generate the raytraced scene with 3x3 antialiasing, reflection with 2 level with output in raytrace.png, run :

./Vertex -as=3 -depth=2 -output="raytrace.png"

For other parameters, get help with :

./Vertex --help 

The gif is generated thanks to the bash file generategif.sh