From CS559 Computer Graphics Fall 2007

Main: P3-Written-Lighting-Texturing-key

Project 3 Written Assignment 1 - Lighting, Texturing and Projection

due Monday, November 19th at 11:59pm

Answer Key

The answers to Questions 1 and 4 are wrong. I will update these at somepoint soon.

1. Lighting

A single polygon at the origin is viewed from above (0,10,0). A single point light source is placed at (10,10,0). The light has intensity 1, and the polygon has diffuse and specular reflectance of 1. The specular exponent is 5.

For the 3 points on the polygon (0,0,0) (5,0,0) (10,0,0), compute the amount of specular and diffuse lighting.

For point (0, 0, 0)
Diffuse light = (Normal dot Light) = 1 / sqrt(2)
Half Angle = norm((E+L)/2) = (1/sqrt(5),2/sqrt(5),0)
Specular light = (Normal dot Half Angle)^5 = (2 / sqrt(5))^5

For point (5, 0, 0)
Diffuse light = 2 / sqrt(5)
Half Angle = (0,1,0)
Specular light = (Normal dot Half Angle)^5 = 1

For point (10, 0, 0)
Diffuse light = 1
Half Angle = (-1/sqrt(5),2/sqrt(5),0)
Specular light = (2 / sqrt(5))^5

2. Texture Map Coordinates

Consider a square pyramid (the base of the pyramid is a square) as shown in the picture. Texture coordinates are given for each point.

2A: Sketch what this pyramid would look like if the 2x2 checkerboard (texture 1) is applied.

answer:

2B: Suppose that you want to texture the pyramid with 4 horizontal stipes, but the only texture you had was the 4x4 checkerboard (Texture2). Give textue coordinates for the 5 vertices that would produce this. (note: every vertex only gets one texture coordinate).

Tip of the pyramid gets (0.375,1)
The 4 corners of the pyramid get (0.5,0), (0.25,0), (0.5,0), (0.25,0) in rotating order

2C: If mip-mapping is used, there are reasons why using the checkerboard texture might not be as good as using the more "obvious" texture (Texture3). Explain this.

If you use a stripe from the checkerboard, mip-mapping might cause some of the neighboring stripes to blend in (since the mip-map area is always square), whereas the stripe texture wouldn't have that problem.

3. Getting triangles to hardware

Tesselate the 3 squares (8 vertices) below. Make sure that your triangles are consistent. Also, choose the tesselation so that the fewest number of vertices can be drawn (using a triangle strip or fan). Your answer should give both the 6 triangles as well as how they would be drawn using OpenGL.

using a triangle fan, here is an ok solution.
(note that this doesn't work if the squares aren't on the same plane)
Vertex (3)
Vertex (1)
Vertex (0)
Vertex (5)
Vertex (7)
Vertex (4)

a better solution:
Vertex (3)
Vertex (1)
Vertex (0)
Vertex (2)
Vertex (5)
Vertex (6)
Vertex (7)
Vertex (4)

4. Projection Matrices

The reflection in a planar mirror can be created by placing the eye point on the other side of the mirror. If you draw the picture from the "virtual eyepoint" as if the mirror were a window, then you would create the image that you would see looking at the mirror from the real eyepoint.

Suppose that the viewer is at 0,5,5, and that the XY plane (Z=0) is a mirror. Write the 4x4 projection matrix that would project points from their world space positions to where they would appear in the mirror. Make your projection place things totally on the wall (Z=0).

(yes, you can use this as a hack to fake reflections, much like we use projection to create hack shadows. there's a slight catch in that you need to get the drawing order correct so occlusions work - but don't worry about it for this question.)

the matrix below is wrong. i believe that the right answer reverses the orders of the rows and columsn (i.e. this matrix is right if your variables are orders wzyx), but I have not checked yet)

the required matrix is:

5 1 0 0
0 0 0 0
0 5 5 0
0 0 0 5

Advanced Texturing

OK, this is just to make sure that you've done the required readings in the Real-Time Rendering Book (the Texture Readings.

        tile
        terrain texturing
        handles non-uniform stretching better, less overblurring
        a sphere
        page 172 textbook
page 49 6_texture_gleicher.pdf
Retrieved from http://www.cs.wisc.edu/graphics/Courses/559-f2007/Main/P3-Written-Lighting-Texturing-key
Page last modified on December 14, 2007, at 03:19 PM