CPSC 424, Fall 2013
Information About the Second Test

The second test will be given in class on Monday, November 4. The test will cover Section 9 through 15 of the notes. The test will also cover Labs 6 through 10. Earlier material will be covered only to the extent that it is required for the more recent material. In particular, you should certainly remember how to use glBegin, glEnd, glVertex, and glNormal.

The format of the test will be the usual: some essay questions and definitions; reading some code and explaining its purpose; writing some code. If I ask you to write any three.js code, I will give you some kind of listing of the API for the classes/methods that you will need, so you do not need to memorize all the syntax; however, you should how the important classes and methods work and how they relate to concepts from OpenGL and Blender.


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


Lighting and Material in OpenGL 1.0
diffuse reflection and specular reflection
specular highlights
color gives the fraction of incident light that is reflected
OpenGL material properties:  
   diffuse color, ambient color, specular color, emission color, shininess
color components: red, green, blue, alpha
   (alpha component has no effect in OpenGL, by default)
OpenGL light properties:
   diffuse intensity, specular intensity, ambient intensity
directional lights and point lights
the position of a light given by a 4-vector:
    light position (x,y,z,1) gives a point light at (x,y,z)
    light position (x,y,z,0) gives a directional light from the direction (x,y,z)
the position of a light is transformed by the modelview matrix
ambient light as an approximation for light that has reflected many times
the lighting equation combines:
    (global ambient light) times (material's ambient color)
    for each light that shines on the surface:
        material emission color
        (light's ambient intensity) times (material's ambient color)
        (light's diffuse intensity) times (material's diffuse color) times 
                    (a factor that depends on the angle to the light)
        (light's specular intensity) times (material's specular color) times
                 (a factor depending on angle to light, angle to viewer, shininess)

textures and image textures
texture coordinates
mipmaps and why they are used
minification and magnification filters
texture repeat modes
texture transformations, and how they affect the texture on a surface

the client/server nature of OpenGL
typically, the client is the CPU and the server is the GPU
the importance of limiting data transfer between client and server
the idea of texture objects and vertex buffer objects
the idea of a fixed function pipeline versus a programmable pipeline

OpenGL 1.0 functions and constants:
    glEnable(gl_LIGHTING), glEnable(GL_LIGHT0), glEnable(GL_LIGHT1), ...
    glMaterialfv( side, property, value )
         side is GL_FRONT_AND_BACK, GL_FRONT, GL_BACK
         property is GL_AMBIENT, GL_DIFFUSE, GL_AMBIENT_AND_DIFFUSE, GL_SPECULAR, GL_EMISSION
         value is an array of 4 numbers (or a pointer)
         in JOGL, there is an extra integer parameter, usually 0
    glMateriali( side, property, value )
         property is GL_SHININESS, value is 0 to 128
    glLightfv( light, property, value )
         light is GL_LIGHT0, GL_LIGHT1, ...
         property is gl_POSITION, gl_DIFFUSE, gl_SPECULAR, gl_AMBIENT
         value is an array of 4 numbers (or a pointer)
         in JOGL, there is an extra integer parameter, usually 0
    glTexCoords2d(x,y);

some basic ideas from Blender
    edit mode
    keyframes and keyframe animation
    video file formats
    procedural textures
    parenting
    tracking
    modifiers: subsurface modifier / displace modifier
    extruding a mesh object
    particle systems: forces and velocities / halo materials
    path animation
    
the three.js JavaScript library for 3D Web graphics
    needed to render an image:  scene, renderer, camera
    basic rendering command:   renderer.render(scene, camera)
    three.js as a scene graph API
    scene graph nodes are defined by the class Object3D
    a visible object consists of a geometry and a material
    mesh objects
    basic, Lambert, and Phong mesh materials
    a texture image is a property of the material
    texture images are loaded asynchronously
    
important three.js classes with constructors, optional params in italic:
    new THREE.WebGLRenderer()
    new THREE.Scene()
    new THREE.PerspectiveCamera(fovy,aspect,near,far)
    new THREE.DirectionalLight(color, intensity)
    new THREE.PointLight(color, intensity, cutoff)
    new THREE.Object3D()
    new THREE.Mesh(geometry,material)
    new THREE.PlaneGeometry(sizeX,sizeY)
    new THREE.CubeGeometry(sizeX,sizeY,sizeZ)
    new THREE.SphereGeometry(radius, slices, stacks)
    new THREE.CylinderGeometry(radiusTop, radiusBottom, height, slices, stacks, openEnded)
    new THREE.MeshBasicMaterial(properties)
    new THREE.MeshLambertMaterial(properties)
    new THREE.MeshPhongMaterial(properties)
          (properties include: visible, color, side, shading, map, specular)

more three.js features
    creating a texture with:  tex = THREE.ImageUtils.loadTexture(url)
    scene.add(object) for adding objects to a THREE.Scene
    object.add(subobject) for adding subjects to a THREE.Object3D
    transforming an object using object.position, object.rotation, object.scale