Skip to content

wjzhou/raytracer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is the simple raytracer for cpsc-566. It use blinn-phong shading model, 
because material properities for this model is eaiser to find.

* Prerequisite
gcc 4.5+
boost
Graphicmagick (optional)
 
* Usage:
** compile
unzip and cd to the directory,then:  
$./configure CXX=/opt/local/bin/g++ CC=/opt/local/bin/gcc
$make

** execute
*** render single scene
$./src/raytracer -i /path/to/scenefile
The output and depth will be in the current directory
the default output file will be "output.ppm"
and default depth  file will be "depth.pgm"

*** render multiply scene
$cd scene
$./scene/traceAll scene

* Enhance
** Antialias using various super sampling
$cd scene
$../src/raytracer -i ./Objects.txt -o ./Objects.png -d ./Objects_depth.png
  --superSamplingMethod=jitter --superSamplingSamples=4

* Options
** Options for super sampling
-superSamplingMethod=string   indicate the method used for super sampling
                              allowed value: grid,random,poisson_disc,jitter,
                                             rotated_grid. 
--superSamplingSamples=arg    indicate number of samples per pixel. For some
                              method(for example grid), this must be square.
--RotatedGridAngleSuperSampling(option) used in rotated_grid method.
* Tested platform
This program has been test under Gentoo linux 2012 with gcc 4.5.3
and MAC lion with macport gcc45(4.5.3) boost(1.49.0) GraphicsMagick(1.3.14)

* Reference
The initial math.hpp is from Jacco Bikker www.bik5.com.(deleted)
The new math library is from Daniel Wesslèn
(https://github.com/boost-vault/Math-Geometry/blob/master/math2-matrix-vector.zip)
The material properties are from opengl red book teapot.c
The ply file parser are from libply by Ares Lagae <ares.lagae@cs.kuleuven.be>

* FAQ:
1. The output file may not have desired format.
If the Graphicmagick does not support the format, it will output a miff(
Magick image file format) file.

2. If there still some thing wrong with the program, try using minimal set.
At configure time, try configure using --disable-gm and --disable-openmp.

3. Linker error on mac os x with error: std::ctype<char>::_M_widen_init() const
It may mixed with code compiled by the default compiler. Especially make sure
boost and graphicmagick is compiled with the new compiler and get the right 
version of GraphicsMagick++-config.

* Sample scenes:
#scene with plane sphere and triangles
$cd scene
$../src/raytracer -i Objects.txt -o Objects.png -d Objects_dep.png 
#scene demo specular
$../src/raytracer -i Specular.txt -o Specular.png -d Specular_dep.png
#scene demo triangle mesh(may a little slow, need 1 min for my i7 CPU)
$../src/raytracer -i Teapot.txt -o Teapot.png -d Teapot_dep.png
#scene with two light source
$../src/raytracer -i TwoLight.txt -o TwoLight.png -d TwoLight_dep.png

About

A simple raytracer for CSPC 566 CSUF

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published