Project III:
Lighting, and Shading of a 3D model
Using Project two:
- Read from a file a list of polygons stored as the number
of polygons, number of points for each polygon, and the
points for each polygon.
- From another file, read a set of light positions and
light colors.
- Shading, user can choose from:
- Flat Shading
- Interpolated
- Gouraud Shading
- Z Buffer Algorithm
- Ambient Light
- Point Light source illumination and Light attenuation
- Diffuse Color illumination
- Specular reflection lighting and color
You will be responsible for this project in groups of two
people. You must comments all your code effectively so that I can
follow what you are doing in them. You may write the code in
XWindows or MSWindows 95/NT.
Points:200
Due Date: March 5, 1998.
You need to implement the following classes to get your
project done correctly:
class Polygon3D
class Vertex
class VertexList
class Light
class Edge
class EdgeList
Remember to implement the structure as we discussed in class.
Get started on this project as soon as possible, because it is
more complicated than the first two. I believe you can figure out
how to implement the classes based on the class discussion. If
you do have problems, do come to see me early.
Light text file:
- Floating point number as Ambient Light value.
- Number of Lights
- Number of times:
- Three floating point numbers for position
- Three floating point numbers for RGB
- Three floating point numbers for C1, C2, and C3.
1.0
2
0 0 0
255 255 255
0 1 1
5 2 3
0 0 255
0 1 0
Polygon Text File:
- Number of polygons
- Number of times:
- Number of points:
- For number of points times:
- Three floating point numbers for position
of point.
- Three floating point number for diffuse color
- Three floating point number for specular color
- One floating point number for Ka
- One floating point number for Kd
- One floating point number for Ks
- One floating point number for N
- Example:
2
4
0 0 0
0 5 0
5 5 0
5 0 0
255 0 0
255 255 255
.9
.5
.2
1
4
0 0 -5
0 5 -5
5 5 -5
5 0 -5
0 0 255
128 255 255
.5
.9
.1
1