CS-460/560, Week 15A
Spring, 19998
R. Eckert
MODELING AND RENDERING SCENES USING A POLYGON MESH MODEL
WITH PHONG ILLUMINATION/REFLECTION
I. SCENE FILES
Scene description file--specify:
Viewing parameters (rho, theta, phi, screen_dist)
Number of objects (num_objs)
For each object
File name of generic object description file
x,y,z scaling factors to be applied to object (sx,sy,xz)
rotation angles to be applied to object (rx,ry,rz)
translation distances to be applied to object (tx,ty,tz)
Position, Intensity of light sources (xL,yL,zL,I)
Intensity of ambient light (Ia)
Note: Use of arbitrary scaling, rotation, and translation parameters
allows us to make "many different objects" out of a generic obect.
II. GENERIC OBJECT FILES
For each object, specify:
Number of points (num_pts)
For each point
3-D World coordinates of the point (xw,yw,zw)
Number of polygons (num_polys)
For each polygon
Number of vertices (num_verts)
List of polygon vertices (*inds)
Reflection properties:
Diffuse reflection coefficients (kdR,kdG,kdB)
Specular reflection coefficient (ks)
Specular exponent (n)
Shading type (Flat, Gouraud, Phong)
III. DATA STRUCTURES NEEDED TO MODEL/RENDER A SCENE--
An array of num_objs objects. Object i would be as follows.
(Some of the values would come from the scene or object files,
many of them would be computed):
Object[i].num_pts
Object[i].w_pts[num_pts] // 3-D world coordinates of vertices
Object[i].v_pts[num_pts] // 3-D viewing coordinates of vertices
Object[i].s_pts[num_pts] // 2-D screen coordinates of vertices
Object[i].num_polys // Number of polygons
Object[i].poly[num_polys] // The array of polygons (see below)
Object[i].kdR // Diffuse reflection coefficients
Object[i].kdG
Object[i].kdB
Object[i].ks // Specular reflection coefficient
Object[i].n // Specular exponent
An array of polygons. Polygon j would be as follows.
(Some of the values would come from the scene or object files,
many of them would be computed):
poly[j].num_verts // Number of vertices
poly[j].inds[num_verts] // The list of vertices
poly[j].visibility // visibility (from back face culling)
poly[j].normal // x,y,z coordinates of outward normal
// The following could be stored if flat shading is to be done:
poly[j].IR // Red reflected light intensity
poly[j].IG // Green reflected light intensity
poly[j].IB // Blue reflected light intensity