CS 6620 - Fall 2015 - Ray Tracing for Graphics

Project 7 - Textures

In this project we add textures to objects as well as background and reflection/refraction environment images.

Requirements

XML Scene Format

We have some additions to the XML scene format description to support textures. Textures can be used with color values as shown below. If a color is specified, the value of the texture should be multiplied with the color.

<diffuse r="1" g="0.5" b="0.5" texture="bricks.ppm"/>

<specular value="1" texture="checkerboard"/>

<diffuse texture="bricks.ppm"/>

If the texture attribute value is "checkerboard," we use the checker board procedural texture. Otherwise, we assume that the texture attribute value is the file name of an image and we use that image as the texture. The image file should be located in the same directory as the scene XML file.

The checker board procedural texture has two colors. By default these colors are black and white, but custom color values can be specified as shown below.

<diffuse texture="checkerboard">
   <color1 r="1" g="0" b="0"/>
   <color2 r="0" g="1" b="0"/>
</diffuse>

Each texture has its own texture space, which can be defined using transformations, just like object transformations.

<diffuse texture="checkerboard">
   <scale x="0.25" y="0.5"/>
   <translate x="0.2"/>
</diffuse>

We specify the background image (or color) using the "background" tag, placed inside the "scene" tag. By default the background image is mapped to fit the screen, but transformations can be applied.

<background r="1" g="1" b="1" texture="clouds.ppm">
   <scale y="0.4"/>
   <translate y="-0.1"/>
</background>

The reflection/refraction environment is used when a bounced ray doesn't hit any of the objects. We use environment mapping for the environment texture.

<environment value="0.3" texture="clouds.ppm"/>

Source Code

The following source code files are provided to help you with this and upcoming projects. You are not required to use them, but it is highly recommened that you use some of them. Some of these files include additional code as compared to the same files in the previous project, so make sure to download them all again.

Test Scenes

The following scene files are provided to help you test your implementation. You can also prepare other scenes to show your work.

Optional Feature Suggestions

Student Project Pages



_