CS6620 Advanced Graphics 2 University of Utah Prof: Peter Shirley Ray Tracing Sem: Spring 2002

 On top of the framework I built for Assignment 04 - RGS vs. BVH Bake-Off, I've added the ability to set materials as solid textures. I did this by creating a new class called a Channel whose sole function is to provide a color output. So, for example, there is a class derived from the channel called a ChannelColor, which is simply a constant color. Derived from the Channel class is also a ChannelMarble class which instantiates a Noise class to compute octaves of noise and combines them into marble. In the scene description file, you can now attach any color component of a material (currently only ambient, diffuse and specular) to any of these channels. It looks like this in the scene file: ```material "red" { diffuse { color < 1 0 0 > } } } ``` which will set the diffuse component to a constant red. Here's a more complex example: ```material "marble" { diffuse { marble { scale 1 period 1.3 distortion 3 octaves 12 ramp { < 1.0 0.000 0.0 > < 1.0 0.125 0.0 > < 1.0 0.250 0.0 > < 1.0 0.375 0.0 > < 1.0 0.500 0.0 > < 1.0 0.625 0.0 > < 1.0 0.750 0.0 > < 1.0 0.875 0.0 > } } } } ``` which will set the diffuse channel to the marble function with the given parameters. The hope is that this organization will allow me the flexibility that I want in setting up materials. Further work will include the ability to combine several channels arithmetically, so I can get multi-pass effects, or for things such as a base diffuse color modulated by a marble procedure or an image (texture) map. Here are some quick notes about how I generate the marble texture. The function I use to compute the marble looks something like the following: ```abs( sin( 180 * ( period * v.x + distortion * Fractal3( v, octaves ) ) ); ``` where v is the (possibly scaled) position at which the noise is to be computed and Fractal3 is a fractal sum of noise computed as follows: ```float n = 0.0f; for ( int i = 0; i < octaves; i++ ) { float o = ( float )( 1 << i ); n += Noise3( v * o ) / o; } return n; ``` where Noise3 is the standard Perlin Noise function. Timings (MM:SS.S) are for 500x500 pixel images on a PentiumIII 733Mhz with 384MB SDRAM (unless otherwise noted).

 (click on each image for a larger view).

Four images showing marble solid texture at different scales.

 scale period distortion octaves render 1 0.5 1.0 1.0 8 2.0 2 1.0 1.0 1.0 8 2.0 3 2.0 1.0 1.0 8 2.0 4 4.0 1.0 1.0 8 2.0

 (click on each image for a larger view).

Four images showing marble solid texture at different periods.

 scale period distortion octaves render 1 1.0 0.5 1.0 8 2.0 2 1.0 1.0 1.0 8 2.0 3 1.0 2.0 1.0 8 2.0 4 1.0 4.0 1.0 8 2.0

 (click on each image for a larger view).

Four images showing marble solid texture at different4 distortions.

 scale period distortion octaves render 1 1.0 1.0 0.5 8 2.0 2 1.0 1.0 1.0 8 2.0 3 1.0 1.0 2.0 8 2.0 4 1.0 1.0 4.0 8 2.0

 (click on each image for a larger view).

Four images showing marble solid texture at different octaves.

 scale period distortion octaves render 1 1.0 1.0 1.0 1 0.8 2 1.0 1.0 1.0 2 1.0 3 1.0 1.0 1.0 4 1.4 4 1.0 1.0 1.0 8 2.0

Eight images showing different color maps.

 (click on each image for a larger view).

 (click on each image for a larger view).

My best attempts at making a realistic looking marble sphere.

 scale period distortion octaves render 1 1.0 1.3 3.0 12 2.8 2 1.0 1.5 1.7 32 6.3 3 0.3 1.2 3.0 8 2.1 4 2.7 1.6 0.6 8 2.1

 (click on each image for a larger view).

And of course, how could we do without a marble teapot? We all know that Capone favored pinstripes! Also shown are some marble dolphins and a marble sphereflake.

 All of the images above can be regenerated by specifying the appropriate scene file on the command line of the rayn program rayn-05.zip (443 Kb). The source code is included in the zip file. Here is a description of the command line parameters for rayn. ```usage: rayn [options] required: file containing scene description options: -o output image filename (output.tga) -w width of output image (256) -h height of output image (256) -shadows generate shadow rays (true) -rgs generate regular grid subdivision (true) -bvh generate bounding volume hierarchy (false) -sort sort (not split) the surface list (false) -cull cull backfacing triangles (false) ```