ECSE-4750 Computer Graphics, Rensselaer Polytechnic Institute, WR Franklin, Final Exam questions 2014, plus unused and old questions, with some solutions
NAME: ___W. Randolph Franklin
EMAIL:__________________________ RIN:__________________________
TOTAL: ___________/140
- There are 35 questions. Answer them all. However, you may write free as the correct answer to any two questions.
- Each question is worth 4 points.
- There are 10 pages.
- This exam is closed book; you may have two 2-sided letter-size note sheets. You may not use computers or communication devices, or share material with other students.
- ________ If a=(5,1,2) then write {$(a\cdot p)\, a$} as a matrix M, depending only on {$a$}, times {$p$}. {$ \begin{pmatrix} 25& 5 & 10 \\ 5 & 1 & 2 \\ 10 & 2 & 4 \end{pmatrix} $}
- ________ Why can the following not possibly be a 3D Cartesian rotation matrix? {$ \begin{pmatrix} 2& 0 &0\\1 & 0 &0\\0& 0 &2\end{pmatrix} $} Any of the following suffice: The determinant is not 1. No column's length is 1. The columns are not perpendicular.
- ________ Consider a 3D triangle with vertices (1,2,3), (5,0,1), (0,2,0). What is the z value of the point in the triangle with x=0, y=1? The equation of the plane is 3x+7y-z=14. So z= -7.
- ________ Write the vector formula for the 3D rotation by 60 degrees about the Z axis.
- ______ Can the volume of a small cube change when its vertices are rotated? Justify your answer.
- ________ Does projection preserve straight lines? Justify your answer.
- ________ Does projection preserve angles? Justify your answer.
- ________ Name the effect which accentuates the visibility of the common edge between two adjacent bands of slightly different brightness. The Mach band effect.
- ________ In the graphics pipeline, when a triangle is processed, the (x,y,z) coordinates of the vertices are interpolated across the whole triangle to give the coordinates of each fragment. Name two other things that may commonly be specified at the vertices and then interpolated across the triangle to give a value for each fragment. Colors. Normals. Texture coordinates.
- ______ Before memory was cheap enough for depth buffers to be practical, one hidden surface technique involved sorting the objects by distance and then drawing them into the color buffer back-to-front. Name this method. The painter's algorithm.
- ______ Clouds and crowds are examples of what type of system?
- ________ Following the principle that less is more, the OpenGL designers decided not to include some functionality that a program that processes images would probably need. Name it.
- _______ What is this technique in shader programs called: p.xyzw = q.wyzx Swizzling.
- _______ Can the standard OpenGL pipeline easily handle light scattering from object to object? Why (not)? No, because it processes objects independently from each other.
- ________ Consider a cubic 3D Bezier curve with Cartesian control points P0(0,0,0), P1(8,8,8), P2(8,8,8), P3(0,0,0). Compute the point P for t=.5.
- ________ When using 2D homogeneous coordinates, what is the equation of the line through the points (0,0,3) and (1,0,1). Write your answer in the form ax+by+cw=0, giving numbers for a,b,c. Reduce a,b,c so that they have no common factors.
- ________ When using 2D homogeneous coordinates, what is the equation of the line through the points (0,1,1) and (2,2,2)?
- ________ When using 2D homogeneous coordinates, at what point do the lines x+y+w=0 and x+2y+3w=0 intersect?
- ________ Consider the triangle with Cartesian vertices (0,0,0), (1,0,0),(0,1,1). What is the normal to its surface? Your answer must be normalized.
- ________ Here is a 2D homogeneous transformation matrix. Prove that it is, or is not, a rotation. If it is, then what is the angle of rotation? {$ \begin{pmatrix} 0 & -4 & 0 \\ 4 & 0 & 0 \\ 0 & 0 & 4 \end{pmatrix} $}
- ________ What is the quaternion for a 90 degree rotation about the X axis? q = cos(45) + sin(45) i = .7 + .7i
- ________ What is the quaternion for a 180 degree rotation about the Z axis?
- ________ Assume that one rotation is expressed as the quaternion j and that a 2nd rotation is the quaternion k. What is the quaternion for those two rotations in order combined?
- ________ What is its axis and angle?
- ________ Suppose that you want to move a robot arm along a path that is a spline curve. What is wrong with using a piecewise quadratic spline? Saying, "the curve looks bad", is not informative enough.
- _______ Write the equations for the following projection: The camera is at (0,0,0). The projection plane is x+y+z=4. Use cartesian coordinates. In other words tell me what the general point {$(x_0 , y_0 , z_0 ) $} projects to. The point will scale by {$ \frac{4}{x_0 + y_0 + z_0} $}. {$ x_0 \rightarrow \frac{4}{x_0 + y_0 + z_0} x_0 $}. {$ y_0 \rightarrow \frac{4}{x_0 + y_0 + z_0} y_0 $}. {$ z_0 \rightarrow \frac{4}{x_0 + y_0 + z_0} z_0 $}.
- ________ Write the homogeneous 4x4 matrix for the above transformation.
- ________ When texture mapping for a scene with a perspective projection, it is usually not possible to create a single texture map whose texels will be the same size as pixels for all objects in the scene. Why? Even if you could compute the appropriate texel size for an object at a certain position, if it moves, as the object's distance from the camera changes, the projected size of the texels will change.
- ________ Suppose that you are writing a flight simulator, where we are looking at the scene from outside the airplane. One obvious technique is to render the background before rendering the airplane. Name this technique.
- _______ Name the rendering technique where diffuse light bounces from object to object.
- _______ Name the type of mapping that can have a shiny doorknob reflect its surroundings.
- _______ Name the type of mapping that combines a diffuse object color with a light texture.
- ________ With view normalization,
- Do distances change? y / n
- Do angles change? y / n
- Do straight lines stay straight? y / n
- Do parallel lines stay parallel? y / n
- _______ It can happen that two objects appear to be the same color under incandescent light but differently colored under fluorescent light.
- What are these color pairs called?
- How can this happen?
- _______ Place these 3 steps in order from earliest to latest.
- fragment processing
- rasterizing
- vertex processing
- user-specified color at each vertex. y / n, y / n
- user-specified ambient lights with ambient material colors. y / n, y / n
- user-specified diffuse lights with diffuse material colors. y / n, y / n
v
* user-specified specular lights with specular material colors. y / n, y / n
- ______ For each of those say whether the color changes when only the light moves, by circling y or n in the first y / n group above.
- ______ For each of those say whether the color changes when only the camera
moves, by marking the 2nd y / n group.
Look at this shader program:
uniform vec3 lightPos[3]; varying vec3 N, L[3]; void main(void) { // vertex MVP transform gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; vec4 V = gl_ModelViewMatrix * gl_Vertex; // eye-space normal N = gl_NormalMatrix * gl_Normal; // Light vectors for (int i = 0; i < 3; i++) L[i] = lightPos[i] - V.xyz; // Copy the primary color gl_FrontColor = gl_Color; }
- ________ Is this a vertex shader or a fragment shader?
- ________ Where does the variable gl_Vertex get its value?
- ________ Where does the variable lightPos get its value?
- ________ Who uses the value of variable N after this shader finishes?
- ________ What is this code doing? What is lightPos?
uniformLoc = glGetUniformLocation(progObj, "lightPos"); if (uniformLoc != -1) glUniform3fv(uniformLoc, 1, lightPos0Eye);
- _______ In a shader, what is the difference between a uniform variable and a varying variable? From https://www.opengl.org/wiki/Uniform_%28GLSL%29: A uniform is a global GLSL variable declared with the "uniform" storage qualifier. These act as parameters that the user of a shader program can pass to that program. ... Uniforms are so named because they do not change from one execution of a shader program to the next within a particular rendering call. This makes them unlike shader stage inputs and outputs, which are often different for each invocation of a program stage. From https://www.opengl.org/sdk/docs/tutorials/ClockworkCoders/varying.php: Varying variables provide an interface between Vertex and Fragment Shader. Vertex Shaders compute values per vertex and fragment shaders compute values per fragment. If you define a varying variable in a vertex shader, its value will be interpolated (perspective-correct) over the primitive being rendered and you can access the interpolated value in the fragment shader.
- _______ In a shader, what does this code do:
v.yxzw = v.xyzw
? - ________ In the following code, the 2nd line clearly defines a NURBS curve.
gluBeginTrim(nurbsObject); gluNurbsCurve(nurbsObject, 10, curveKnots, 2, curvePoints[0], 4, GLU_MAP1_TRIM_2); gluEndTrim(nurbsObject);
- What is this curve being used for?
- The curve is being created from control points stored in curvePoints. In what coordinate space are those points defined?
- ______ Designers usually use Bezier curves, where the curve goes near (but not through) the interior control points. They do not usually use Catmull-Rom curves, where the curve goes through all the control points. Why? In that case, the curve would be forced to swing widely outside the convex hull of the control points by an unintuitive amount (or else have a sharp bend). It was considered preferable to keep the curve smooth and inside the control polygon but have it not go through the interior control points.
- ______ Imagine a 2-D quadratric Cartesian Bezier curve with control points P0(0,0), P1(1,0), P2(0,1). What are the points on the curve with t=0, t=1/2, t=1?
- ______ Imagine a 2-D quadratric Cartesian Bezier curve with control points P0(0,0), P1(1,0), P2(0,1). Imagine that you are joining a 2nd Bezier curve to the end of this one, so that there is C1 continuity at the joint. What are the 1st and 2nd control points of this new curve?
- ______ How many degrees of freedom would a 2-D quadratric Cartesian Bezier curve have?
- ______ What do these lines do:
- ______ glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, order, controlPoints[0]);
- ______ glEnable(GL_MAP1_VERTEX_3);
- ______ glMapGrid1f(100, 0.0, 1.0);
- ______ glEvalMesh1(GL_LINE, 0, 100);
- ______ glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 6, controlPoints[0][0]);
- ______ glMapGrid2f(20, 0.0, 1.0, 20, 0.0, 1.0);
- ______ glEvalMesh2(GL_LINE, 0, 20, 0, 20);
- ______ glEvalCoord1f(u);
- ______ glEnable(GL_MAP2_VERTEX_3);
- ______ What are the usually used conditions at the joint between 2 cubic Bezier curves so that the joint is invisible?
- ______ How many degrees of freedom would a 3D cubic homogeneous Bezier patch have?
n
- ______ Give 3 reasons why we usually use a sequence of low-degree curves instead of one high degree curve. (These answers overlap; other answers are ok.) Local control. More intuitive relation between the control points and the curve. Less roundoff error during the computation. Better numerical conditioning in the solution equation - small changes in coefficients cause small changes in the curve. The higher degree curve doesn't give you any new capability.
- ______ Give 1 reason why we use parametric curves instead of explicit curves.
- ______ What do evaluators provide a way to do?
- ______ Give 1 reason why we use parametric curves instead of explicit curves.
- ______ What kind of curves can evaluators be used to draw?
- ______ What does the word Rational in NURBS mean?
- ______ What does the phrase non uniform in NURBS mean?
- ______ When are 3D texture maps useful?
- ______ An evaluator is often used to generate vertex positions. Name 3 other things an evaluator might generate.
- ______ What do the following lines do:
- ______ nurbsObject = gluNewNurbsRenderer();
- ______ gluNurbsProperty(nurbsObject, GLU_SAMPLING_METHOD, GLU_PATH_LENGTH);
- ______ gluNurbsProperty(nurbsObject, GLU_SAMPLING_TOLERANCE, 10.0);
- ______ gluBeginCurve(nurbsObject);
- ______ gluNurbsCurve(nurbsObject, 34, knots, 3, ctrlpoints[0], 4, GL_MAP1_VERTEX_3);
- ______ gluEndCurve(nurbsObject);
- ______ gluBeginSurface(nurbsObject);
- ______ gluNurbsSurface(nurbsObject, 19, uknots, 14, vknots, 30, 3, controlPoints[0][0], 4, 4, GL_MAP2_VERTEX_3);
- ______ gluNurbsSurface(nurbsObject, 4, uTextureknots, 4, vTextureknots, 4, 2, texturePoints[0][0], 2, 2, GL_MAP2_TEXTURE_COORD_2);
- ______ gluEndSurface(nurbsObject);
- ______ gluBeginTrim(nurbsObject);
- ______ gluNurbsCurve(nurbsObject, 10, curveKnots, 2, curvePoints[0], 4, GLU_MAP1_TRIM_2);
- ______ gluEndTrim(nurbsObject);
- ______ What is the tristimulus theory of color?
- ______ Why were experiments on people necessary to devise the CIE chromaticity diagram?
- ______ What did Philo T Farnsworth invent?
- ______ Define local control. One control point affects only a local part of the spline near it. Distant parts of the spline are not affected. They are affected only by the control points near them. In contrast, if you interpolate one polynomial through a set of points, then changing any point completely changes the entire polynomial.
- ______ A material's color is represented by 10 numbers. Name them.
- ______ What coordinate system do you define a trim line in?
- ______ What preprocessing technique handles a texel being much smaller (or much larger) than a pixel?
- ______ Aliasing becomes a problem when objects are what compared to a pixel's size?
- smaller
- larger
- the same
- The pixel size is irrelevant; aliasing happens when objects are all the same size.
- ______ The Bresenham line algorithm was devised to operate efficiently with (or without) what property of hardware?
- ______ What might clipping do to the number of vertices?
- The number of vertices might stay the same or reduce but not grow.
- The number of vertices might stay the same or grow but not reduce.
- The number of vertices might stay the same or grow or reduce.
- The number of vertices must stay the same.
- ______ In the 12 stage pipeline devised by Jim Clark, six stages are used for what operation?
- ______ What is the aliasing problem (in Computer Graphics)?
- ______ What are some solutions?
- ______ What is a mipmap?
- ______ What conditions are usually required when two cubic Bezier curves meet at a joint?
- ______ What happens if they're not met?
- ______ Define cubic Bezier curve.
- ______ What is a spline?
- ______ What is a bumpmap, and why is it useful? A texture is used to perturb the normal at each pixel of a polygon. The perturbed normal is input to the lighting equation. This is a cheap way to emulate small 3D relief on the polygon.
- ______ What is a texture sampler, and how is it more powerful than an array?
- ______ If you want to create a highlight in the middle of a triangle, can you do that by computing the color at each vertex and interpolating (rastering) the color across the triangle? Justify your answer.
- ______ In this code to compute diffuse lighting: float intensity = max(0.0, dot(N, normalize(L))); what's the point of max? It keeps the surface's brightness from going negative when the light is behind the polygon.
- ______ When I write C code to multiply a vector and a matrix, I probably write a for loop. However, in shaders you see simply this: gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; Why don't you write a loop there? GLSL overloads operators like * for matrices and vectors. You could use a loop but it would probably be slower.
- ______ What is immediate mode?
- ______ What are the major advantages and disadvantages of immediate mode
- ______ Name a function that is immediate mode.
- ______ What happened to immediate mode in the current OpenGL? Why?
- ______ Name several things removed from the current (or recent) OpenGL.
- ______ Vertex buffer object:
- What is it?
- What are its major advantages and disadvantages?
- ______ What was the latest shader added to the OpenGL pipeline?
- ______ What does it do?
- ______ What does Primitive Assembly mean?
- ______ What is Face Culling?
- ______ What new shader computes the positions, normals, etc of new vertices created in a tesselation?
- ______ Which shader outputs a depth value and color values that will potentially be written (without any more interpolation or other processing) to the frame buffer?
- ______ What does this do: glEnableClientState(GL_COLOR_ARRAY);
- ______ What does this do: glVertexPointer(3, GL_FLOAT, 0, vertices);
- ______ What does this do: glViewport (0, 0, (GLsizei)w, (GLsizei)h);
- ______ What does this do: glMatrixMode(GL_PROJECTION);
- ______ What does this do: glLoadIdentity();
- ______ What does this do: glArrayElement(i);
- ______ What does this do: bufferData = (float*)glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
- ______ What does this do: glGenBuffers(2, buffer);
- ______ What does this do: glBindBuffer(GL_ARRAY_BUFFER, buffer[VERTICES]);
- ______ glWhat does this do: BufferData(GL_ARRAY_BUFFER, sizeof(vertices) + sizeof(colors), NULL, GL_STATIC_DRAW);
- ______ What does this do: glLinkProgram(programId);
- ______ What does this do: glEnableClientState(GL_VERTEX_ARRAY);
- ______ What does this do: glColorPointer(3, GL_FLOAT, 0, colors);
- ______ What does this do: glMatrixMode(GL_MODELVIEW);
- ______ What does this do: glClearColor(1.0, 1.0, 1.0, 0.0);
- ______ What does this do: glDrawElements(GL_TRIANGLE_STRIP, 10, GL_UNSIGNED_INT, stripIndices);
- ______ What does this do: programId = glCreateProgram();
- ______ Why is it inefficient to do computations in the display routine that could be done at initialization time.
- ______ What does this do: <body onload="webGLStart(); resizeCanvas(600); flipAnim()">
- ______ Look at the following block of code:
attribute vec2 aVertexPosition; attribute vec3 aPlotPosition; varying vec3 vPosition; void main(void) { gl_Position = vec4(aVertexPosition, 1.0, 1.0); vPosition = aPlotPosition; }
- In two words, what is this block of code?
- What does attribute mean?
- What does varying mean?
- What variable(s) are output to the next stage?
- What is the next stage?
- ______ Why are Euler angles not recommended for animating rotations? Smooth changes in the Euler angles cause nonsmooth changes in the object's orientation.
- ______ Given a sphere of radius one, what's the normal to the surface at the point (3/13, 4/13, 12/13)? A sphere's normals point straight out, so (3/13, 4/13, 12/13). Note that its length is already 1.
- ______ Describe a type of scene better suited for processing with radiosity than with ray tracing. Surfaces that reflect light onto each other diffusely.
- ______ What advantage does a cubic spline have over a quadratic spline? A cubic Bezier twists through space and is not confined to one plane. It's impossible to simulate that effect with a spline of planar, i.e., quadratic, pieces. Also, you can match curvature at the joint.
- ______ What type of light and surface specially handles a light source that is just above the horizon, compared to a light that is high up. Diffuse.
- ______ How would you make a spline that does not have a continuous tangent at a joint? Bunch up the control points. Three overlapping control points will make the tangent discontinuous at that joint, for a piecewise cubic spline.
- ______ Why do you need to clip away stuff that is behind the camera? I.e., what's especially bad about this stuff as opposed to stuff that is just outside the clip region? That stuff, which should be invisible, will project mixed in with stuff in front of the camera.
- ______ Why is the normalization transformation useful? It makes the clip volume to be a cube, and the projection to be straight down, which are easier to work with.
- ______ What's a mipmap and what's it good for? A pyramid of coarser and coarser texture maps, computed from the input hi-res texture map. Therefore it's easier to find a level whose texels are closer to the pixel size.
- ______ Why is 3D clipping usually implemented with six stages of a viewing pipeline? Each stage clips one side of the viewing cube. Breaking up the clipping operation like this makes it easier to implement.
- ______ What does this do: gl.vertexAttribPointer( vNormal, 3, gl.FLOAT, false, 0, 0 ); Declare that the current buffer contains 3 floats per vertex.
- ______ What does this do: gl.bufferData( gl.ARRAY_BUFFER, flatten(normalsArray), gl.STATIC_DRAW ); Write a array of normals, flattened to remove metadata, into the current buffer.
- ______ In the previous question, what does flatten mean? A 2D Javascript array has other data besides the array elements, such as its size. Flatten converts the array to a simple list of floats w/o any of this metadata. (Therefore the callee has to know the array size.)
- ______ What causes some people to be tetrachromats? For females, the two X chromasomes for the green retina cones are different, so they have two, slightly different, green cones. They can see four primaries: red, green-1, green-2, blue.
- ________ If a=(5,6,7) then write {$(a\cdot p)\, a$} as a matrix M, depending only on {$a$}, times {$p$}.
- ________ Why can the following not possibly be a 3D Cartesian rotation matrix? {$ \begin{pmatrix} 2& 0 &0\\1 & 0 &0\\0& 0 &1\end{pmatrix} $}
- ________ Consider a 3D triangle with vertices (1,2,3), (5,0,10), (0,20,0). What is the z value of the point in the triangle with x=3, y=1?
- ________ Write the vector formula for the 3D rotation by 60 degrees about the Z axis.
- ______ Can the volume of a small cube change when its vertices are rotated? Justify your answer.
- ________ Does projection preserve straight lines? Justify your answer.
- ________ Does projection preserve angles? Justify your answer. No. For example, a square may project to a rectangle (in a parallel projection) or trapezoid (in a perspective projection). The angle that the diagonal makes with an edge is no longer 45 degrees.
- ________ Name the effect which accentuates the visibility of the common edge between two adjacent bands of slightly different brightness.
- ________ In the graphics pipeline, when a triangle is processed, the (x,y,z) coordinates of the vertices are interpolated across the whole triangle to give the coordinates of each fragment. Name two other things that may commonly be specified at the vertices and then interpolated across the triangle to give a value for each fragment.
- ______ Before memory was cheap enough for depth buffers to be practical, one hidden surface technique involved sorting the objects by distance and then drawing them into the color buffer back-to-front. Name this method.
- ______ Clouds and crowds are examples of what type of system?
- ________ Following the principle that less is more, the OpenGL designers decided not to include some functionality that a program that processes images would probably need. Name it.
- _______ What is this technique in shader programs called: v.xyz = u.yzx
- _______ Can the standard OpenGL pipeline easily handle light scattering from object to object? Why (not)?
- ________ Consider a cubic 3D Bezier curve with Cartesian control points P0(0,0,0), P1(8,8,8), P2(8,8,8), P3(0,0,0). Compute the point P for t=.5.
- ________ When using 2D homogeneous coordinates, what is the equation of the line through the points (0,0,3) and (1,0,1). Write your answer in the form ax+by+cw=0, giving numbers for a,b,c. Reduce a,b,c so that they have no common factors.
- ________ When using 2D homogeneous coordinates, what is the equation of the line through the points (0,1,1) and (2,2,2)?
- ________ When using 2D homogeneous coordinates, at what point do the lines x+y+w=0 and x+2y+3w=0 intersect? (1,-2,1)
- ________ Consider the triangle with Cartesian vertices (0,0,0), (1,0,0),(0,1,1). What is the normal to its surface? Your answer must be normalized. (0, -.7, .7) or (0, .7, -.7)
- ________ Here is a 2D homogeneous transformation matrix. Prove that it is, or is not, a rotation. If it is, then what is the angle of rotation? {$ \begin{pmatrix} 0 & -4 & 0 \\ 4 & 0 & 0 \\ 0 & 0 & 4 \end{pmatrix} $} Convert to a Cartesian 2x2 matrix. The determinant is -1, so it's not a rotation. Extra: It's a combo of a rotation and a reflection, which some people call an improper rotation.
- ________ What is the quaternion for a 90 degree rotation about the X axis?
- ________ What is the quaternion for a 180 degree rotation about the Z axis?
- ________ Assume that one rotation is expressed as the quaternion j and that a 2nd rotation is the quaternion k. What is the quaternion for those two rotations in order combined? q = jk = i
- ________ What is its axis and angle? Axis = X axis = (1,0,0). Angle = 180 degrees.
- ________ Suppose that you want to move a robot arm along a path that is a spline curve. What is wrong with using a piecewise quadratic spline? Saying, "the curve looks bad", is not informative enough. Each piece is a quadratic Bezier curve and is planar. So, at each joint, the robot would suddenly have to switch from moving smoothly in one place to moving in another plane. IOW, its velocity would not be continuous. That's impossible for physical objects (unless it slowed to a stop at the joint).
- _______ Write the equations for the following projection: The camera is at (0,0,0). The projection plane is x+y+z=3. Use cartesian coordinates.
- ________ Write the homogeneous 4x4 matrix for the above transformation.
- ________ When texture mapping for a scene with a perspective projection, it is usually not possible to create a single texture map whose texels will be the same size as pixels for all objects in the scene. Why?
- ________ Suppose that you are writing a flight simulator, where we are looking at the scene from outside the airplane. One obvious technique is to render the background before rendering the airplane. Name this technique.
- _______ Name the rendering technique where diffuse light bounces from object to object.
- _______ Name the type of mapping that can have a shiny doorknob reflect its surroundings.
- _______ Name the type of mapping that combines a diffuse object color with a light texture.
- ________ With view normalization,
- Do distances change? y / n
- Do angles change? y / n
- Do straight lines stay straight? y / n
- Do parallel lines stay parallel? y / n
- _______ It can happen that two objects appear to be the same color under incandescent light but differently colored under fluorescent light.
- What are these color pairs called?
- How can this happen?
- _______ Place these 3 steps in order from earliest to latest.
- fragment processing
- rasterizing
- vertex processing
- user-specified color at each vertex. n, n
- user-specified ambient lights with amfbient material colors. n, n
- user-specified diffuse lights with diffuse material colors. y, n
- user-specified specular lights with specular material colors. y, y
- ______ For each of those say whether the color changes when only the light moves, by circling y or n in the first y / n group above.
- ______ For each of those say whether the color changes when only the camera
moves, by marking the 2nd y / n group.
Look at this shader program:
uniform vec3 lightPos[3]; varying vec3 N, L[3]; void main(void) { // vertex MVP transform gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; vec4 V = gl_ModelViewMatrix * gl_Vertex; // eye-space normal N = gl_NormalMatrix * gl_Normal; // Light vectors for (int i = 0; i < 3; i++) L[i] = lightPos[i] - V.xyz; // Copy the primary color gl_FrontColor = gl_Color; }
- ________ Is this a vertex shader or a fragment shader? It's a vertex shader since it refers to gl_Vertex.
- ________ Where does the variable gl_Vertex get its value? It's input from OpenGL program, perhaps set by glVertex.
- ________ Where does the variable lightPos get its value? It's imput from the OpenGL program, in which it will have been linked to a user variable.
- ________ Who uses the value of variable N after this shader finishes? The next stage in the pipeline. The next stage is typically the rasterizer or the Tesselation Control Shader.
- ________ What is this code doing? What is lightPos?
uniformLoc = glGetUniformLocation(progObj, "lightPos"); if (uniformLoc != -1) glUniform3fv(uniformLoc, 1, lightPos0Eye);
- _______ In a shader, what is the difference between a uniform variable and a varying variable?
- _______ In a shader, what does this code do:
v.yxzw = v.xyzw
? It swizzles, that is, does a parallel assignment of 4 vector components. - ________ In the following code, the 2nd line clearly defines a NURBS curve.
gluBeginTrim(nurbsObject); gluNurbsCurve(nurbsObject, 10, curveKnots, 2, curvePoints[0], 4, GLU_MAP1_TRIM_2); gluEndTrim(nurbsObject);
- What is this curve being used for?
- The curve is being created from control points stored in curvePoints. In what coordinate space are those points defined?
- ______ Designers usually use Bezier curves, where the curve goes near (but not through) the interior control points. They do not usually use Catmull-Rom curves, where the curve goes through all the control points. Why?
- ______ Imagine a 2-D quadratric Cartesian Bezier curve with control points P0(0,0), P1(1,0), P2(0,1). What are the points on the curve with t=0, t=1/2, t=1? (0,0), (1/2, 1/4), (0,1)
- ______ Imagine a 2-D quadratric Cartesian Bezier curve with control points P0(0,0), P1(1,0), P2(0,1). Imagine that you are joining a 2nd Bezier curve to the end of this one, so that there is C1 continuity at the joint. What are the 1st and 2nd control points of this new curve? Q0(0,1), Q1(-1,2)
- ______ How many degrees of freedom would a 2-D quadratric Cartesian Bezier curve have?
- ______ What do these lines do:
- ______ glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, order, controlPoints[0]);
- ______ glEnable(GL_MAP1_VERTEX_3);
- ______ glMapGrid1f(100, 0.0, 1.0);
- ______ glEvalMesh1(GL_LINE, 0, 100);
- ______ glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 6, controlPoints[0][0]);
- ______ glMapGrid2f(20, 0.0, 1.0, 20, 0.0, 1.0);
- ______ glEvalMesh2(GL_LINE, 0, 20, 0, 20);
- ______ glEvalCoord1f(u);
- ______ glEnable(GL_MAP2_VERTEX_3);
- ______ What are the usually used conditions at the joint between 2 cubic Bezier curves so that the joint is invisible?
- ______ How many degrees of freedom would a 3D cubic homogeneous Bezier patch have? 16 points with 4 coords gives 48 d.f.
- ______ Give 3 reasons why we usually use a sequence of low-degree curves instead of one high degree curve. The high degree curve: does not have local control, does not have as much of an intuitive relation between the control points and the curve, is more subject to numerical instability (loss of significant digits, roundoff error), is not necessary to achieve visible smoothness.
- ______ Give 1 reason why we use parametric curves instead of explicit curves. An explicit curve is single valued. If you rotated it, you'd have to cut it into pieces. A parametric curve can bend back onto itself, so this is not a problem.
- ______ What do evaluators provide a way to do?
- ______ Give 1 reason why we use parametric curves instead of explicit curves.
- ______ What kind of curves can evaluators be used to draw?
- ______ What does the word Rational in NURBS mean? You compute cartesian coordinates as the ratio of homogeneous coords.
- ______ What does the phrase non uniform in NURBS mean?
- ______ When are 3D texture maps useful?
- ______ An evaluator is often used to generate vertex positions. Name 3 other things an evaluator might generate. Color, surface normal, texture coordinates.
- ______ What do the following lines do:
- ______ nurbsObject = gluNewNurbsRenderer();
- ______ gluNurbsProperty(nurbsObject, GLU_SAMPLING_METHOD, GLU_PATH_LENGTH);
- ______ gluNurbsProperty(nurbsObject, GLU_SAMPLING_TOLERANCE, 10.0);
- ______ gluBeginCurve(nurbsObject);
- ______ gluNurbsCurve(nurbsObject, 34, knots, 3, ctrlpoints[0], 4, GL_MAP1_VERTEX_3);
- ______ gluEndCurve(nurbsObject);
- ______ gluBeginSurface(nurbsObject);
- ______ gluNurbsSurface(nurbsObject, 19, uknots, 14, vknots, 30, 3, controlPoints[0][0], 4, 4, GL_MAP2_VERTEX_3);
- ______ gluNurbsSurface(nurbsObject, 4, uTextureknots, 4, vTextureknots, 4, 2, texturePoints[0][0], 2, 2, GL_MAP2_TEXTURE_COORD_2);
- ______ gluEndSurface(nurbsObject);
- ______ gluBeginTrim(nurbsObject);
- ______ gluNurbsCurve(nurbsObject, 10, curveKnots, 2, curvePoints[0], 4, GLU_MAP1_TRIM_2);
- ______ gluEndTrim(nurbsObject);
- ______ What is the tristimulus theory of color?
- ______ Why were experiments on people necessary to devise the CIE chromaticity diagram?
- ______ What did Philo T Farnsworth invent?
- ______ Define local control.
- ______ A material's color is represented by 10 numbers. Name them. 3 ambient color reflectivity components (R,G,B). 3 diffuse color components. 3 specular color components. Shininess exponent.
- ______ What coordinate system do you define a trim line in? In the parametric coordinate system of the patch that you're trimming.
- ______ What preprocessing technique handles a texel being much smaller (or much larger) than a pixel?
- ______ Aliasing becomes a problem when objects are what compared to a pixel's size?
- smaller
- larger
- the same
- The pixel size is irrelevant; aliasing happens when objects are all the same size.
- ______ The Bresenham line algorithm was devised to operate efficiently with (or without) what property of hardware? No floating point, and even multiplication was expensive.
- ______ What might clipping do to the number of vertices?
- The number of vertices might stay the same or reduce but not grow.
- The number of vertices might stay the same or grow but not reduce.
- The number of vertices might stay the same or grow or reduce.
- The number of vertices must stay the same.
- ______ In the 12 stage pipeline devised by Jim Clark, six stages are used for what operation?
- ______ What is the aliasing problem (in Computer Graphics)?
- ______ What are some solutions?
- ______ What is a mipmap?
- ______ What conditions are usually required when two cubic Bezier curves meet at a joint?
- ______ What happens if they're not met?
- ______ Define cubic Bezier curve.
- ______ What is a spline?
- ______ What is a bumpmap, and why is it useful?
- ______ What is a texture sampler, and how is it more powerful than an array? You input coordinates and output a color. More powerfully than an array, if the coordinates are not exactly at a texel, the sampler interpolates as necessary, using the rule that you specified, e.g., nearest, perhaps even between mipmap levels.
- ______ If you want to create a highlight in the middle of a triangle, can you do that by computing the color at each vertex and interpolating (rastering) the color across the triangle? Justify your answer. No because linear interpolation creates values inside the triangle that are never more than the brightest vertex.
- ______ In this code to compute diffuse lighting: float intensity = max(0.0, dot(N, normalize(L))); what's the point of max?
- ______ When I write C code to multiply a vector and a matrix, I probably write a for loop. However, in shaders you see simply this: gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; Why don't you write a loop there?
- ______ What is immediate mode?
- ______ What are the major advantages and disadvantages of immediate mode
- ______ Name a function that is immediate mode.
- ______ What happened to immediate mode in the current OpenGL? Why? It was removed. Repeatedly sending the data to the GPU is too slow, so now we store data in the GPU in buffer objects. Implementing immediate mode takes effort.
- ______ Name several things removed from the current (or recent) OpenGL.
- ______ Vertex buffer object:
- What is it?
- What are its major advantages and disadvantages?
- ______ What was the latest shader added to the OpenGL pipeline?
- ______ What does it do?
- ______ What does Primitive Assembly mean? Assembling groups of vertices into higher objects, e.g., lines, triangles, or patches.
- ______ What is Face Culling?
- ______ What new shader computes the positions, normals, etc of new vertices created in a tesselation?
- ______ Which shader outputs a depth value and color values that will potentially be written (without any more interpolation or other processing) to the frame buffer?
- ______ What does this do: glEnableClientState(GL_COLOR_ARRAY);
- ______ What does this do: glVertexPointer(3, GL_FLOAT, 0, vertices);
- ______ What does this do: glViewport (0, 0, (GLsizei)w, (GLsizei)h);
- ______ What does this do: glMatrixMode(GL_PROJECTION);
- ______ What does this do: glLoadIdentity();
- ______ What does this do: glArrayElement(i);
- ______ What does this do: bufferData = (float*)glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
- ______ What does this do: glGenBuffers(2, buffer);
- ______ What does this do: glBindBuffer(GL_ARRAY_BUFFER, buffer[VERTICES]); It binds the buffer object name buffer[VERTICES], which you got with glGenBuffers, so that it will contain vertex array data.
- ______ What does this do: glBufferData(GL_ARRAY_BUFFER, sizeof(vertices) + sizeof(colors), NULL, GL_STATIC_DRAW); It creates a buffer object, whose name you had reserved with glGenBuffers, with sizeof(vertices) + sizeof(colors) bytes reserved. The application will set the once data later, and the data will be used for drawing.
- ______ What does this do: glLinkProgram(programId); It links a program object (that runs on the GPU) incorporating any shaders that you have attached to it, to create an executable that will run on the shaders.
- ______ What does this do: glEnableClientState(GL_VERTEX_ARRAY); Sets a flag so that future calls to glDrawArrays etc will use the vertex position information that you earlier specified in a vertex array.
- ______ What does this do: glColorPointer(3, GL_FLOAT, 0, colors); It specifies an array of colors, called colors, which the system will use in the future. Each color is 3 floats. There is no other data interleaved between the colors.
- ______ What does this do: glMatrixMode(GL_MODELVIEW); Says that any future call that affects a matrix will affect only the modelview matrix.
- ______ What does this do: glClearColor(1.0, 1.0, 1.0, 0.0); Says that when you clear the color buffer in future, it will be cleared to white.
- ______ What does this do: glDrawElements(GL_TRIANGLE_STRIP, 10, GL_UNSIGNED_INT, stripIndices); Draws a triangle strip with 10 vertices whose numbers are listed in the stripIndices array, which is unsigned ints. The numbers are indexed into a vertex array earlier specified perhaps with glVertexPointer.
- ______ What does this do: programId = glCreateProgram(); It creates an empty program object, which you will later attach shaders to, link, etc.
- ______ Why is it inefficient to do computations in the display routine that could be done at initialization time. You're doing the computation many times instead of once.
- ______ What does this do: <body onload="webGLStart(); resizeCanvas(600); flipAnim()"> In an HTML page, it defines a javascript callback to be called when the page is loaded. The listed routines initialize webgl, set the canvas size and set a flag that the webgl program will use.
- ______ Look at the following block of code:
attribute vec2 aVertexPosition; attribute vec3 aPlotPosition; varying vec3 vPosition; void main(void) { gl_Position = vec4(aVertexPosition, 1.0, 1.0); vPosition = aPlotPosition; }
- In two words, what is this block of code?
- What does attribute mean?
- What does varying mean?
- What variable(s) are output to the next stage?
- What is the next stage?