Assignment 8 in Introduction to Computer Graphics for Fall 2004 - Prof. Christopher Wyman, Assignments of Computer Graphics

Assignment 8 for the introduction to computer graphics course offered in fall 2004. Students are required to add mipmapping, projective textures, and shadows to their program. The assignment consists of several problems, including changing the interpolation constants for mipmapping, adding a projective shadow to a complex object, texturing an object with a projective texture, and rendering a depth map as a texture. Extra credit involves automatically generating texture coordinates for shadows using a shadow map.

Typology: Assignments

Pre 2010

Uploaded on 09/17/2009

koofers-user-zyj
koofers-user-zyj 🇺🇸

9 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Fall 2004
22C:151 Introduction to Computer Graphics
Assignment 8
Due: Tuesday November 2th at 12:01am (Monday at midnight)
Goal: Add mipmapping while texturing and observe the difference between various texture interpolation schemes.
Add projective textures and get a basic idea how to incorporate shadow maps to your program.
Problem 1 (5 points): Change Homework 7 to add mipmapping on the “infinite” plane. You should only need to
change (literally) 2 lines of code. Also add a keyboard callback (or menu entries) which allows you to change between
the various minification interpolation constants (GL NEAREST MIPMAP NEAREST, GL NEAREST MIPMAP LINEAR,
GL LINEAR MIPMAP NEAREST, and GL LINEAR MIPMAP LINEAR).
Problem 2 (10 points): Replace the textured cone and cube from Homework 7 with one of the complex illuminated
objects from Homework 6. Also add this object’s projective shadow onto the floor of your scene. Make sure you can
still move the light via the trackball and have the shadow behave appropriately. Keep the texture on the floor (at least
in the unshadowed regions).
Hint: You may not want to project your shadow exactly onto the floor plane, but rather a plane slightly offset,
so that there is no z-tearing (conflicts between the floor and the shadow in the z-buffer).
Problem 3 (5 points): Use a projective texture to texture your object with one of the PPMs from the class web page.
Make sure you modulate the texture (GL MODULATE in glTexEnvi) so that you can see both the lighting and the
texture. Note: as you rotate your object, the texture should remain fixed on the object’ssurface.
Problem 4 (10 points): Render a depth map (a.k.a shadow map) from the light’s point of view. Copy this into a
texture (use glCopyTexImage2D()) and render it onto a square in the lower right hand corner of the viewport. Make
sure the depth map updates as you rotate your light or object.
Hint: Use two different projection matrices, the usual gluPerspective() for the 3D geometry and a gluOrtho2D()
for the a quad containing the texture.
Hint: Aternatively, you can use glDrawPixels() to draw the texture to the screen.
Extra Credit (8 points): Automatically generate texture coordinates (i.e., a projective texture) to add shadows via the
shadow map. With these shadows enabled you should see shadows on both the floor and the object! Add a keyboard
toggle or menu option to allow switching between projective shadows and shadow maps. Make sure you still display
the shadow map in the lower right corner of the window as per Problem 4. See p. 446 for more information.
NOTE: A “README” file is required in order to get full credit! It is worth the 2 or 3 minutes it takes to write such a
file, as it guarantees we know how to compile and run your program, and you can make note of any odd behavior or
strange bugs (which may mask required functionality).
NOTE: An example program showing most of the functionality will be posted online. The extra credit is a lot harder
than it sounds.

Partial preview of the text

Download Assignment 8 in Introduction to Computer Graphics for Fall 2004 - Prof. Christopher Wyman and more Assignments Computer Graphics in PDF only on Docsity!

Fall 2004

22C:151 Introduction to Computer Graphics

Assignment 8

Due: Tuesday November 2th at 12:01am (Monday at midnight)

Goal: Add mipmapping while texturing and observe the difference between various texture interpolation schemes. Add projective textures and get a basic idea how to incorporate shadow maps to your program.

Problem 1 (5 points): Change Homework 7 to add mipmapping on the “infinite” plane. You should only need to change (literally) 2 lines of code. Also add a keyboard callback (or menu entries) which allows you to change between the various minification interpolation constants (GL NEAREST MIPMAP NEAREST, GL NEAREST MIPMAP LINEAR, GL LINEAR MIPMAP NEAREST, and GL LINEAR MIPMAP LINEAR).

Problem 2 (10 points): Replace the textured cone and cube from Homework 7 with one of the complex illuminated objects from Homework 6. Also add this object’s projective shadow onto the floor of your scene. Make sure you can still move the light via the trackball and have the shadow behave appropriately. Keep the texture on the floor (at least in the unshadowed regions).

Hint: You may not want to project your shadow exactly onto the floor plane, but rather a plane slightly offset, so that there is no z-tearing (conflicts between the floor and the shadow in the z-buffer).

Problem 3 (5 points): Use a projective texture to texture your object with one of the PPMs from the class web page. Make sure you modulate the texture (GL MODULATE in glTexEnvi) so that you can see both the lighting and the texture. Note: as you rotate your object, the texture should remain fixed on the object’s surface.

Problem 4 (10 points): Render a depth map (a.k.a shadow map ) from the light’s point of view. Copy this into a texture (use glCopyTexImage2D()) and render it onto a square in the lower right hand corner of the viewport. Make sure the depth map updates as you rotate your light or object. Hint: Use two different projection matrices, the usual gluPerspective() for the 3D geometry and a gluOrtho2D() for the a quad containing the texture.

Hint: Aternatively, you can use glDrawPixels() to draw the texture to the screen.

Extra Credit (8 points): Automatically generate texture coordinates (i.e., a projective texture) to add shadows via the shadow map. With these shadows enabled you should see shadows on both the floor and the object! Add a keyboard toggle or menu option to allow switching between projective shadows and shadow maps. Make sure you still display the shadow map in the lower right corner of the window as per Problem 4. See p. 446 for more information.

NOTE: A “README” file is required in order to get full credit! It is worth the 2 or 3 minutes it takes to write such a file, as it guarantees we know how to compile and run your program, and you can make note of any odd behavior or strange bugs (which may mask required functionality).

NOTE: An example program showing most of the functionality will be posted online. The extra credit is a lot harder than it sounds.