<html>
<head>
<title>SSRT</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#000000" text="#CCCCCC" link="#33FF00">
<p><b><font size="+4" color="#FFCC00">SSRT: Shaun's Simple Ray-Tracer</font></b><font size="+1">
  <script src="visited_ssrt.php"> </script>
  </font></p>
<center> <p><FONT SIZE=12></FONT><font face="Arial, Helvetica, sans-serif" size=
"5">You
 can find my new Home Page and SSRT site at <a href="http://www.nirenstein.com">www.nirenstein.com</a></ font></font>
<p></center>

<p><font size="+1">This page contains publicly available source code and binaries 
  for a Monte-carlo path tracer that I (<a href="mailto:shaun@cs.uct.ac.za">Shaun 
  Nirenstein</a>) have written recently. The design goal of this ray tracer is 
  simplicity, since my intentions are entirely pedagogical. This is not my field 
  of research, so I would appreciate any feedback with respect to any conceptual 
  errors in the implementation.</font></p>
<p><font size="+1">The win32 SSRT source, executable and an example scene can 
  be downloaded <a href="SSRT.zip">here</a>. It's 1.2MB.</font></p>
<p> 
<font size="+1">Specifically, the source code: </font> 
<UL>
  <Li><font size="+1" color="#FF9900">Is completely self contained, and requires 
    no 3rd party libraries: </font> 
    <ul>
      <li><font size="+1" color="#FF9900">The win32 version <b>only</b> uses the 
        win32 API, and even then, only as a light weight front end</font></li>
      <li><font size="+1" color="#FF9900">The Linux/*nix version (coming soon) 
        uses identical source code, except for the GTK frontend</font></li>
      <li><font size="+1" color="#FF9900">GNU compatible C++ is used</font></li>
    </ul>
  <li><font size="+1" color="#FF9900">Is minimalist: </font> 
    <ul>
      <li><font size="+1" color="#FF9900">The RayTracer kernel class is less than 
        500 lines of code</font></li>
      <li><font size="+1" color="#FF9900">The Model class is less than 500 lines 
        of code, and includes support for a straight forward flexible text based 
        model format</font></li>
    </ul>
  </li>
  <li><font size="+1" color="#FF9900">Is easy to understand: </font> 
    <ul>
      <li><font size="+1" color="#FF9900">Clarity is favoured over (non-algorithmic) 
        efficiency</font></li>
      <li><font size="+1" color="#FF9900">The code is well documented and of consistent 
        structure</font></li>
    </ul>
  </li>
</UL>
<p><font size="+1">Despite this simplicity, the features I have implemented are:</font><font size="+1"></font></p>
<ul>
  <li><font size="+1" color="#FFCC00">Global diffuse illumination</font></li>
  <li><font size="+1" color="#FFCC00">Perfect and imperfect global specular illumination</font></li>
  <li><font size="+1" color="#FFCC00">Phong BRDF based importance sampling and 
    cosine sampling</font></li>
  <li><font size="+1" color="#FFCC00">Stratified sampling is used for sampling 
    the diffuse part of the Phong BRDF</font></li>
  <li><font size="+1" color="#FFCC00">Arbitrary area light sources</font></li>
  <li><font size="+1" color="#FFCC00">Support for triangle based primitives</font></li>
  <li><font size="+1" color="#FFCC00">Bounding box checks for ray acceleration</font></li>
  <li><font size="+1" color="#FFCC00">An easy to use camera model</font></li>
  <li><font size="+1" color="#FFCC00">A limited implementation of refraction</font></li>
</ul>
<p><font size="+1">Things you can do to improve SSRT (alternatively, things you 
  can ask your students to do, if you are running an advanced graphics course):</font></p>
<ul>
  <li><font size="+1" color="#FF9933">Add stratified sampling to the specular 
    node</font></li>
  <li><font size="+1" color="#FF9933">Add support for other BRDF models:</font> 
    <ul>
      <li><font size="+1" color="#FF9933">Add support for anisotropic BRDFs</font></li>
      <li><font size="+1" color="#FF9933">Add support for BRDFs that have elevation 
        variant cosine lobes </font></li>
      <li><font size="+1" color="#FF9933">Add support for arbitrary (sampled) 
        BRDFs</font></li>
      <li><font size="+1" color="#FF9933">Use wavelength dependent BRDFs</font></li>
    </ul>
  </li>
  <li><font size="+1" color="#FF9933">Integrate photon mapping</font></li>
  <li><font size="+1" color="#FF9933">Improve the support for refraction:</font> 
    <ul>
      <li><font size="+1" color="#FF9933">Add wavelength dependent indices of 
        refraction</font></li>
      <li><font size="+1" color="#FF9933">Use Fresnel's equations to determine 
        refraction/reflection contributions</font> </li>
    </ul>
  </li>
  <li><font size="+1" color="#FF9933">Integrate a method for sub-surface scattering</font></li>
  <li><font size="+1" color="#FF9933">Modify SSRT to generate animations, and 
    export to a video format</font></li>
  <li><font size="+1" color="#FF9933">Use a kd-tree to accelerate the ray-model 
    intersection tests</font></li>
  <li><font size="+1" color="#FF9933">Add support for alternative primitives, 
    such as quadrics, patches and implicit surfaces</font></li>
  <li><font size="+1" color="#FF9933">Add participating media</font></li>
</ul>
<p><font size="+1">Links that I found useful when developing SSRT:</font></p>
<p><font size="+1"><a href="http://www.cs.utah.edu/%7Eshirley/papers/">Peter Shirley's 
  papers</a></font><br>
  <font size="+1"><a href="http://www.cs.kuleuven.ac.be/%7Ephil/GI/">The Global 
  Illumination Compedium</a></font> <br>
</p>
<p><font size="+1">Gallery pictures:</font></p>
<p><img src="Red_specular_floor.jpg" width="1031" height="1031"></p>
<p><font size="+1">The floor in the above image is reddish, and is imperfectly 
  specular. The sphere is perfectly specular.You will note that there is colour 
  bleeding on the top and back wall and on the cube.</font></p>
<p><img src="back_wall.jpg" width="1037" height="1034"></p>
<p><font size="+1">The above image is similar to the one above it. It is just 
  that the back wall is imperfectly specular. Note the colour bleading on the 
  floor, roof and cube..</font></p>
<p><font size="+1">Here are some gallery pictures throughout the development of 
  SSRT:</font></p>
<p><img src="Non_Importance.jpg" width="514" height="516"><font size="+1">This 
  image was generated using 25 rays per pixel. The reflection in the sphere is 
  a bit dark due to a scaling problem that has been fixed. You will notice that 
  there is some subtle colour bleeding on the white wall, roof and floor from 
  the coloured walls. </font></p>
<p><img src="importance.jpg" width="513" height="514"><font size="+1">Same as 
  above, but with importance sampling (just cosine sampling, since all surfaces 
  are either perfectly diffuse or perfectly specular). You will note that using 
  the same number of samples per pixel, the image is less noisy.</font></p>
<p><img src="importance_stratified_1_sampler_per_strata.jpg" width="517" height="517"><font size="+1">Importance 
  and stratified sampling. The same fixed sample is being used per strata here. 
  There's far less noise in the image, but there are some other obvious artefacts.</font></p>
<p><img src="imp_strat_non_rand_seq.jpg" width="511" height="514"><font size="+1">Importance 
  and stratified sampling, using varying samples per strata. This has converged 
  <b>a lot </b>quicker. If you look at the floor, there is still a minor artifact 
  caused, by the reuse of the same pattern of strata. I.e., for all path depths, 
  the same strata element is used.</font></p>
<p><font size="+1"><img src="importance_stratified_with_sequences.jpg" width="516" height="515">The 
  final image version. Now, random sequences are randomly used to determine the 
  ordering of strata, for each depth in the path tree.</font></p>
<p><img src="Non_Importance.jpg" width="514" height="516"><img src="importance_stratified_with_sequences.jpg" width="516" height="515"><font size="+1">A 
  side by side comparison of SSRT without and with all the goodies. They used 
  the same parameters, and took the same amount of time (approx. 1 minute on a 
  P4 3.0Ghz -- not the fastest time around).</font></p>
</body>
</html>

