CS6620 | Advanced Graphics 2 | University of Utah |
Prof: Peter Shirley | Ray Tracing | Sem: Spring 2002 |
|
Assignment 06 - Image Texture Mapping |
On top of the framework I built for Assignment 05a - Specular Study, I've added the ability to use images as texture maps. I did this by expanding the set of channel classes I created for Assignment 05 - Solid Texture (Marble). I've created a new derived class called a ChannelImage that returns colors from an image depending on a parameterization of the surface. Here's where it got a little tricky. Each surface contains a material, but sometimes the material needs properties from the surface in order to compute the color at a point (for example, a (u,v) pair in this case). So, all the color functions in the Channel classes take a pointer to a surface as well as the original point on the surface now. In the scene description file, you can now attach any image to a material, like so:material "picture" { diffuse { image "image.tga" } } } Targa (.tga), Portable Pixmap (.ppm) and PC Paintbrush (.pcx) files are the only image file types that are currently supported. The filtering is locked in to bi-linear right now, but I hope to expand that to use other filtering methods in the future.
(unless otherwise noted). |
|
||||||||||||||||
Here is another mercator projection image. I created a rendering of a
sphere texture mapped with this image at 18 degree intervals around
the y axis. This created 20 frames which I then composited into an
animation. The lighting was always from the point of view of the
camera, so that the texture map is visible in each frame.
|
||||||||||||||||
Here is the same map on spheres composed of triangles. (You can tell the difference because the triangles are flat shaded.) There is a sphere of 16x16, 32x32, 64x64 & 128x128 triangles. |
All of the images above can be regenerated by specifying the appropriate
scene file on the command line of the rayn program
rayn-06.zip (271 Kb). The source code is
included in the zip file. Here is a description of the command line
parameters for
rayn.
usage: rayn [options] <scene_file> required: <scene_file> file containing scene description options: -o <output_file> output image filename (output.tga) -w <width> width of output image (256) -h <height> height of output image (256) -shadows <true/false> generate shadow rays (true) -rgs <true/false> generate regular grid subdivision (true) -bvh <true/false> generate bounding volume hierarchy (false) -sort <true/false> sort (not split) the surface list (false) -cull <true/false> cull backfacing triangles (false) |
Questions/comments to nate@pobox.com. |
|
March 2002 © Nate Robins |