## CPSC 424, Spring 2012 Information About the Second Test

The second test will be given in class on Monday, April 23. It will concentrate on material that we have covered since the first test; earlier material will only be tested to the extent that it serves as the foundation for the new material.

Material for the test includes class notes starting with the March2 notes, and it covers labs 6 through 10. The format of the test will be the usual: some essay questions and definitions; reading some code and explaining its purpose; writing some code.

Because of the very technical character of a lot of the programming, there will be less code writing on the test than usual. However, there will probably be some, and there will certainly be questions that ask you to read and interpret code. I will not ask you to write POV-Ray code, but you should be able to read scene descriptions using the basic POV-Ray commands listed below. Also, I will not ask you to write shader code. I could give you a scene graph API and ask you to write JavaScript code that uses it or implements it, including the mat4 functions listed below. You do not have to memorize WebGL commands or their parameters, except for the most basic ones; if you need them, I will give you a WebGL reference.

Here are some terms and ideas that you should be familiar with:

```Computer graphics

OpenGL history
why drawArrays and drawElements?

Basic elements of 3D Graphics:
geometric modeling
geometric transformations
viewing and projection
lighting
textures
animation

gl-matrix.js:
mat4.translate(matrix,[a,b,c])
mat4.scale(matrix,[a,b,c])
mat4.identity()
mat4.lookAt( [eyeX,eyeY,eyeZ], [centerX,centerY,centerZ], [upX,upY,upZ] )
mat4.ortho(left,right,bottom,top,near,far)
mat4.frustum(left,right,bottom,top,near,far)

the "camera" analogy for viewing
default camera is at (0,0,0), looking towards negative z, with y axis pointing up
the equivalence between modeling and viewing
the modelview transformation
implementing hierarchical modeling with the gl-matrix.js mat4 object

the projection transformation
perspective versus orthographic projection
the view volume for perspective and orthographic projections
creating projection transforms with mat4.ortho and mat4.frustum

using projection and modelview transforms in a vertexShader:
gl_Position = projection * modelview * vec4(vertexCoords,1.0);

homogeneous coordinates
the meaning of (x,y,z,w) as a point in 3D in homogeneous coordinates
homogeneous coordinates and light positions in the standard lighting model

the viewport (set by default to be the entire canvas)
setting the viewport with gl.viewport(x,y,width,height)
why you might want to set the viewport

materials and light: the standard OpenGL model
this model is NOT built into WebGL; it can be implemented in shaders
material properties:
diffuse color
specular color
ambient color
emissive color
shininess
the effect of the shininess property on specular highlights
representation of color as red/green/blue components
the meaning of the ambient, diffuse, and specular colors,
in terms of reflection of light in the environment

lights
positional lights versus directional lights
light properties
position (x,y,z,w) -- w = 0 for directional lights
diffuse color (intensity is a better term)
specular color (intensity is a better term)
ambient color (intensity is a better term)
attenuation, given by three constants

the lighting equation: determining visible color based on light
and material properties, the normal vector to the surface, the
position of the viewer, and the position of light sources;
how all of these properties enter into the computation

scene graphs
traversing a scene graph to render a scene
transformations in scene graphs
material properties in scene graphs
hierarchical graphics and "complex objects" in scene graphs

scene description languages
constructive solid geometry
the POV-Ray scene description language; reading knowledge of:
camera { location <a,b,c>  look_at <d,e,f> }
light_source { <a,b,c>, color <d,e,f> }
sky_sphere { pigment { ... } }
sphere { <a,b,c>, radius  texture { ... } }
box { <a,b,c>, <d,e,f>  texture { ... } }
cylinder { <a,b,c>, <d,e,f>, radius  texture { ... } }
union { ... }
difference { ... }
intersection { ... }
basic idea of raytracing and how it differs from WebGL rendering

framebuffers
reading pixels from a framebuffer
creating new framebuffers
using a framebuffer to write directly to a texture

keyframe animation; key frames and interpolation
particle systems
particle system physics (controlling particle motion)
particle system rendering (halo material / duplicated object)
path animation in Blender
parenting one object to another in Blender
tracking in Blender
animating the camera in Blender
the Blender sequencer; combining animation sequences

```