CS 520 Advanced Computer Graphics


Homework 3
Due March 11, 2009 ( Wed )

  1. ( 20 points ) Use whatever method you prefer, write a program that creates a scene consisting of a cube and a teapot sitting on a flat surface near each other; a fixed light source is shining from the direction ( 1, 1, 1, 0 ). Form shadows of the cube on the teapot and on the flat surface. The program allows you to rotate the objects around the axis while keeping the light source fixed by pressing keys, 'x', 'X', 'y', 'Y', 'z' and 'Z'.

  2. (20 points ) Write a program that maps a texture of checkerboard image ( refer to lecture notes ) onto a sphere and a torus.

  3. ( 20 points ) Suppose you want to create bump mapping for a unit sphere which can be described by
      p( θ , φ ) = ( r sin &theta cos φ, r sin θ sin φ, r cos θ )
    where
    • r = radius = 1,
    • θ = angle from z-axis ( 0 ≤ &theta ≤ π ),
    • φ = angle from x-axis ( 0 ≤ φ ≤ 2π )
    Suppose
    • u = φ/2π
    • v = θ/π

    Find the following for a point p(u, v) in terms of u and v.

    • unit normal n(u,v) at p(u, v).
    • pu and pv,
    • If the surface is perturbed by a small amount d(u,v) in the normal direction, with d(u,v) = au + bv, find the new normal n'(u,v).

  4. ( 20 points )Write a program that uses a vertex shader to morph one object into another. Besides morphing the vertices, morph other variables such as the colors of the vertices.

  5. ( 20 points )Write a vertex program that will bounce a ball whose initial velocity and position are provided by the application program. Hint: You can use the reflect() function to compute the new direction of the ball after it hits the floor. Its vertical speed should be reduced by a constant value, the coefficient of restitutions, each time that it hits the floor.

    Extra Credit ( 10 points ) Use blender to create a short animated movie ( > 15 seconds ) that shows a 3-D chess piece moving around a chess board. Besides the demo, turn in a copy of the steps you have used to create it.

Make a demo to the instructor before or after a class or during the office hours. Progams must be able to be compiled and run in the machines of the lab.