CS 6620 - Fall 2012 - Ray Tracing for Graphics

Project 2 - Shading

In this project we add shading to our ray tracer.

Requirements

XML Scene Format

Our XML scene has some additional descriptions for materials and lights.

<xml>
  <scene>
    <!-- Objects -->
    <object type="sphere" name="sphere1" material="mtl1">
      <scale x="25" y="25" z="3"/>
      <translate x="0" y="50" z="0"/>
    </object>
    <object type="sphere" name="sphere2" material="mtl2">
      <scale value="8.0"/>
      <rotate angle="30" y="1"/>
      <translate x="0" y="50" z="5.1"/>
      <object type="sphere" name="sphere3" material="mtl1">
        <scale value="0.2"/>
        <translate x="0" y="0" z="1.2"/>
      </object>
    </object>

    <!-- Materials -->
    <material type="blinn" name="mtl1">
      <diffuse  r="0.8" g="0.2" b="0.2"/>
      <specular r="1.0" g="1.0" b="1.0" value="0.7"/>
      <glossiness value="20"/>
    </material>
    <material type="blinn" name="mtl2">
      <diffuse  r="0.1" g="0.1" b="0.9"/>
      <specular r="0.9" g="0.9" b="1.0" value="0.8"/>
      <glossiness value="10"/>
    </material>

    <!-- Lights -->
    <light type="ambient" name="ambientLight">
      <intensity value="0.1"/>
    </light>
    <light type="direct" name="directionalLight">
      <intensity value="0.5"/>
      <direction x="1" y="0.5" z="-1"/>
    </light>
    <light type="point" name="pointLight">
      <intensity value="0.5"/>
      <position x="140" y="40" z="70"/>
    </light>
  </scene>

  <camera>
    <position x="0" y="0" z="10"/>
    <target x="0" y="50" z="0"/>
    <up x="0" y="0" z="1"/>
    <fov value="40"/>
    <width value="800"/>
    <height value="600"/>
  </camera>
</xml>

Resources

Here is a header file that includes classes for keeping the new scene definition in the memory. It uses the point and matrix classes from cyCodeBase. You will also need the color classes. Here is an example implementation of the xml parser using TinyXML. You are free (but not obligated) to make use of these files.

Optional Feature Suggestions

Student Project Pages



_