CS Comp Graphics Final
Diffuse light intensity equation
= intensity of light source x diffuse reflection coefficient x cos(angle)
Perspective Projection
A method of projection in which a three dimensional object is represented by projecting all its points to a picture plane by straight lines converging at an arbitrarily fixed point representing the eye of the owner.
Viewing Volume
A parallel-piped rectangular
What does this method do> glMaterialfv(GL_FRONT, GL_SPECULAR, ...);
Add specular properties to the material;
Which lighting is this? - No particular Direction - lights come after bouncing off several times and become directionless - all surfaces of object are evenly lit in all direction
Ambient Light
ambient light computation
Ambient light of a surface= intensity of ambient light * ambient-reflection coefficient
Which mapping distorts the normal vectors during the shading process to make the surface appear to have small variation in shape?
Bump Mapping
What does the depth buffer (z-buffer) algorithm do?
Compares surface depth at each pixel position
What does this method do? glLightfv(GL_LIGHT0, GL_SPOT_CUTOFF, 45);
Creates a spot light that restricts the shape of the positional light to a cone
What does glCopyTextImage2D() do?
Creates a two-dimensional texture, using framebuffer data to define the texels
Which lighting is this? - comes from a direction - reflected evenly off a surface - object surface is brighter is light comes squarely down on the surface than if it barley glances off a surface
Diffuse light
Case: If the min depth of a polygon is greater than the max depth of another polygon and not overlapped How do you display
Draw both polygons
Which lighting is this? - light is emanating from an object - add intensity to the object but doesn't introduce additional light to a scene
Emissive Light
What are the three projection elevation sin orthographic projection?
Front elevation, side elevation, and top elevation
Is gluLookAt() controlled by GL_PROJECTION or GL_MODELVIEW matrix>
GL_MODELVIEW
How to control the intensity distribution of the light within a cone?
GL_SPOT_EXPONENT
Which method is where visible is decided point by point at each pixel position
Image-space method
Midpoint subdivision algorithm vs Cohen-Sutherland
Instead of intersection, find midpoint
Moving object and moving light are both transformed by ________ matrix
ModelView
Which method is where you compare objects and parts of objects to each other within the scene (hidden surface removal)
Object-space methods
Case: If the min depth (z value) of a polygon is greater than the max depth of another polygon and completely behind the one How do you display>
Paint the polygons back to front
OpenGL shading equation
Isum = Ia + Idiff + Ispec
What does it mean is the w coordinate in lighting position != 0?
It means that it is a positional light source
Which lighting is this? - Highly directional light - will reflect sharply in a particular direction - will create a bright spot on surface of object
Specular Light
Case: -If the min depth of a polygon is smaller than max depth of another polygon, but not fully overlapped each other How do you display?
Subdivide polygons with overlapping z-extents into smaller polygons, and iterate depth testing
How do you assign the region code?
TBLR -If (y1 > ymax) then top= 1, else if (y1 < ymin) bottom = 1 -If (x1 < xmin) left = 1, else if (x1 > xmax) right = 1
in the method glTexImage2d(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); What is TARGET?
Target specifies the target texture Ex: GL_TEXTURE_2D
What is the dot product of hidden surface removal?
V*N = |V||N| cos(angle)
Normal Vector
Vector that is perpendicular to all other vectors
What is a region point?
a 4 digit binary code that identifies the location of the point relative to the boundaries of clipping rectangle
What does this method do> glMaterialf(GL_FRONT, GL_SHININESS, 10);
add shininess
What does this method do? glLightfv(GL_LIGHT0, GL_SPECULAR,...);
add specular light
How is viewing volume's four side walls determined?
by the border of the window
what does glPolygonMode(GLenum face, GLenum mode) do?
controls the drawing mode for a polygon's front and back faces
Second step of adding light source is to create, position and enable light source; how do you position light at a specific point?
create an array of x,y,zw coordinates to use in your definition of light
How to specify texture coordinates to polygon?
glBegin(GL_QUADS); glTextCoord2f(0,0); glVertex3f(0,0,0);
How to enable hidden surface removal
glEnable(GL_CULL_FACE)
how to use depth buffering?
glEnable(GL_DEPTH_TEST);
how to enable lighting?
glEnable(GL_LIGHTING);
First step of adding a light source is to define normal vectors; how do you do that?
glEnable(GL_NORMALIZE);
How do you enable texture mapping?
glEnable(GL_TEXTURE_2D);
method to create ambient light
glLightModelfv()
Second step of adding light source is to create, position and enable light source; what method is used to create light sources?
glLightfv();
method to create diffuse light
glMaterialfv()
How to move the camera away from the origin
glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0.0,0.0,-d);
Move the camera to see the side view of the object
glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0.0,0.0,-d); glRotatef(-90.0, 0.0,1.0,0.0);
Orthographic projection
glOrtho(L, R, B, T, near, far);
How to fill the polygon with the solid color that was the polygon's last vertex color?
glShadeModel(GL_FLAT)
how to interpolate the color between vertices?
glShadeModel(GL_SMOOTH);
How to use z-buffering algorithm by enabling the depth buffer
glutInitDisplayMode(GLUT_DEPTH); glEnable(GL_DEPTH_TEST);
in the method glTexImage2d(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); what does border specify?
it is a 0 or 1
in the method glTexImage2d(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); What is level?
level specifies the level-of-detail number EX: 0 is the base image level
Two types of methods to identify parts of the scene that are visible from a chosen viewing position
object-space methods image-space methods
Objects inside the viewing volume are projected onto the plane along a ___________ array
parallel
which coordinate relates to pitch, roll, and yaw?
pitch - x roll - y yaw - z
gluLookAt( x,y,z, //________ atx, aty, atz, // _______ upx, upy, upz // _________ );
position of camera position of reference point (any point along the ling) direction of up vectore
In material color component of light the values of R, G, B represent what?
reflection properties
What is Phong shading
rendering a polygon surface with interpolation of normal vectors and then applying the illumination model to each surface point
What does the method glTexEnvf(GLenum target, GLenum pname, GLfloat param); do?
specifies a texture environment or how texture values are interpreted when a fragment is textured
in the method glTexImage2d(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); what does format specify?
specifies the format of the texture data ex:GL_RGB
in the method glTexImage2d(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); what does internalformat specify?
specifies the number of color components in the texture EX: GL_RGB or GL_RGBA
in the method glTexImage2d(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); what does *pixels specify?
specifies the pointer to the image data in memory
What does the face in glPolygonMode(GLenum face, GLenum mode); do?
specifies the polygons that mode applies to EX: GL_FRONT, GL_BACK
What does the mode in glPolygonMode(GLenum face, GLenum mode); do?
specifies the way polygons will be rasterized EX GL_POINT, GL_LINE
in the method glTexImage2d(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); What do the width and height specify?
specify the dimensions of the texture
in the method glTexImage2d(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); what does type specify?
the data type of texture image ex: GL_UNSIGNED BYTE OR GL_BYTE
If V*N >= 0 which direction is the polygon facing?
the polygon is facing forward
Diffuse light is independent of ______
the viewing direction
Why is clipping used?
to determine which vectors (parts) are contained inside a clipping window
Steps of Gouraud Shading
used to achieve smooth lighting on low-polygon surfaces without the heavy computational requirements of calculating lighting for each pixel
How to discard front or back-facing polygons
void glCullFace(GLenum mode);
What are the vertices at side elevation?
x = 0 y = y z = z
What is the vertices at front elevation?
x = x y = y z = 0
what are the vertices at top elevation?
x = x y = 0 z = z