CSCE 441 – Computer Graphics

Homework 5                                                                                                   due 4/10/2013

You should implement ONE of the two options.

Option 1. [200 points]  You are to write a routine that will scan convert triangles.  Your routine should account for all of the following:

You might not want to attempt all of these at once (in fact, you should probably handle them one at a time in the order listed).

 

You are welcome to use any method we talked about in order to do hidden surface removal.  However, you will probably find it easiest to use the Z-buffer.  You will need to implement the Z-buffer in software, however.  That way, you will only need to handle one triangle at a time, and won’t have to keep a complicated list of edges, etc.

 

Also, for this assignment, all color information will come from texture maps.  The color level for the ambient, diffuse, and specular calculations should be obtained by scaling that texture color by the coefficients for each of the three lighting calculations.

 

Skeleton code will be provided to load in a list of triangles, vertex normals, light positions, texture maps, etc.  For the purposes of this assignment, you do not need to worry about any of the view transformations.  That is, you can assume that no transformations are required, and you can perform your lighting calculations directly on the 3D positions.  The x,y position of the triangle will be the x,y position on the screen, and the view direction will be constant (and assumed infinitely far away).  This is unrealistic and not the way you’d want to actually implement this, but it makes the computations much easier.  You also don’t need to worry about clipping.  You do not need to worry about perspectively correct interpolation, either. Note that because we limit the primitives to triangles, your scan-conversion process can be much simpler than a general polygon scan-conversion routine.

 

An executable is given on the website as well.  You should try to make your program match this one in function.  Do not worry about the tiny “fringing” effects in textures.

 

Grading:

[45] Scan Conversion correct – points correctly determined

[20] Z-buffering (or other hidden surface technique) correct (includes interpolating z)

[10] Ambient lighting correct

[20] Diffuse lighting correct

[30] Specular lighting correct

[50] Phong shading (surface rendering) used (Includes normal interpolation)

[25] Texture mapping implemented/working (includes u,v interpolation and color multiplication)

 

Option 2. [200 points] You are to write a ray tracing program.  Your program should generate a fixed, raytraced view of a scene.  You are to write the raytracer yourself, from scratch.  That means that you are to write your own ray routines, not use external libraries. 

 

Your program should have the following characteristics:

 

Be sure that your code is well-written/documented enough that it can easily be verified that  you are performing lighting, ray casting, etc. in the right manner.

 

Skeleton code will be provided on the web (similar to assignment 2) that will allow you to set individual pixel colors and display the resulting image (using OpenGL).  However, you are to set your own scene up however you would like it.  You will need to choose an eye position, world-space screen position, and positions for the objects themselves.

 

As a side note, if this program is well-written, it will be easy to extend it to handle more interesting scenes.  This can include things like: triangles/polygons, cylinders, and other shapes; refraction; texture mapping;

 

[10] Scene set up – eyepoint and screen in world, and rays generated

[20] Planes drawn

[20] Spheres drawn

[10] Ambient lighting correct

[20] Diffuse lighting correct

[30] Specular lighting correct

[35] Shadows included and correct

[35] Reflection included and correct

[20] Numbers of Objects, lights, etc. meet requirements