





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






First milestone due Saturday, 4 November 2006, 11:59 PM Completed project due Wednesday, 15 November 2006, 11:59 PM
In this project you will implement a static ray-tracer for scenes containing primitive 3- dimensional objects, including ellipsoids, boxes, cylinders, and cones. Your renderer will support multiple light sources, object shadows, reflection, refraction, and transparency. Ad- ditionally, you will create at least one interesting 3-dimensional scene, and render it with your ray-tracer.
This project is due at 11:59 PM on Wednesday, November 15th. There is one project milestone due at 11:59 on Saturday, November 4th. The whole project is worth 150 points.
For this lab, you must work with a partner other than the partners you worked with in the first two labs. As soon as possible, send an email with your partner’s name and username to [email protected]. If you have trouble finding a partner, let us know and we will try to pair you up.
Your program will take a single command-line argument: the name of a text file that defines a scene to render. The format of the text file is given in the section “Scene File Format,” below. Under the Windows OS, the path to a file is passed as an argument to a program if the program is opened by dragging the file onto the program’s icon.
When the program starts, the window will contain only a black background. Once the scene file is successfully parsed, your program should begin rendering the scene. The scene should be rendered progressively– that is, as soon as you have calculated the color for a pixel, that pixel should be colored in the window. Your program should not wait for the rendering process to finish before displaying the scene.
All images should be rendered at a resolution of 500 by 500 pixels. (You can modify the constants WIDTH and HEIGHT in OpenGLFrame.h to set the window size automatically.)
By the first milestone deadline, your program must do the following:
By the final project deadline, in addition to the requirements for milestone 1, your pro- gram must do the following:
Your final submission should contain one or more scene files of your own creation. Be creative. Your files should demonstrate all the various ray tracing effects and all the object types. (Though you can get full credit for only one scene, you are encouraged to submit sev- eral.) For each scene file you create, please include a picture file in jpg format that contains your renderer’s output for that scene. Please put effort in this portion of the lab.
You may receive extra credit if you implement the torus.
a README file containing:
Only one partner per group should turn in code. The other partner should put a README file in his or her own ~/comp360/lab3 directory that gives their partner’s name and username.
Do not touch the files in your submission directory after the project deadline. If your project will be completed late, email your labby and let him know. Otherwise, he may attempt to grade an incomplete or nonexistent project directory, and the project grade will reflect this.
Please follow the same submission directions as above when you complete Milestone 1, but put the milestone files in the directory ~/comp360/lab3-milestone. The README for the milestone requires only your name and a list of the features your milestone code supports. Do not touch the milestone files after the milestone deadline; late milestone submissions will incur penalties at the usual rate.
A lab 3 scene file is an ASCII text file containing data that define lighting and geometry for a ray-traced scene. A scene file is organized into two parts, lighting attributes and object definitions. Lighting attributes are always given first.
In a scene file, values are separated by one or more blank spaces. Scene files support C++-style double-backslash (//) comments– the double backslash characters mean that input should be ignored until the next newline character. An example file appears at the bottom of this document.
The lighting of the scene appears in the following sequence.
(a) The light’s position in space. (Three floating point values.) (b) The light’s color. (Three floating point values.)
Beneath the lighting attributes, the input file will contain at least one object definition. Object definitions are given with the following sequence.
(a) The object’s type, one of the strings “ellipsoid”, “box”, “cone”, or “cylinder”. (b) A set of numbers defining the object’s geometry– format varies, see below. (c) A set of numbers defining the object’s material properties. The format is the same for all objects.
The object definition formats are as follows.
Sphere
A sphere is defined by the following values.
Ellipsoid
An ellipsoid is defined by the following values.
Note that if the last two values are equal, the cylinder’s base is a circle, and the result is a canonical cylinder.
Cone
A cone is defined by the following values.
Material Properties
Immediately after the definition of an object’s geometry, its material properties are given as follows.
// Lighting 1 1 1 // R, G, B of ambient color 1 // Number of light sources 10 10 0 // x, y, z position of the first light source 1 1 1 // Color of the first light source
// Objects 2 // Number of objects
// First object cylinder // Type 0 0 0 // x, y, z coordinates of center of the base of the cylinder 1 0 0 // Normalized vector of first axis of the ellipse forming the // base of the cylinder 0 1 0 // Normalized vector of the second axis of the ellipse 0 0 1 // Normalized vector of the direction of cylinder axis 20 // Height of the cylinder (along the axis) 5 6 // Length of each axis of the ellipse 0.1 0.1 0.1 // Ambient coefficient 0.45 0.45 0.45 // Diffuse coefficient 0.5 0.5 0.5 // Specular coefficient 5 // Specular exponent 0.1 .7 1 // R,G,B of material color 0.5 // Reflection coefficient 0.1 // Transparency coefficient 1.6 // Index of refraction
// Second object box // Type 0 0 0 // x, y, z coordinates of corner of box 1 0 0 // Normalized vector of the direction of Length (vl) 0 1 0 // Normalized vector of the direction of Width (vw). // (Dot product of vl and vw should be zero.) 0 0 1 // Normalized vector of the direction of Height (vh). // (vh should be the cross product of vl and vw.) 5 5 10 // The Length, Width, and Height of the box, in floats. 0.1 0.1 0.1 // Ambient coefficient 0.45 0.45 0.45 // Diffuse coefficient 0.5 0.5 0.5 // Specular coefficient 5 // Specular exponent 1 1 1 // R,G,B of material color 0.5 // Reflection coefficient 0.1 // Transparency coefficient