cs6500 adv. computer graphics © chun-fa chang, spring 2003 texture mapping ii april 10, 2003
Post on 19-Dec-2015
219 views
TRANSCRIPT
CS6500 Adv. Computer Graphics© Chun-Fa Chang, Spring 2003
Texture Mapping II
April 10, 2003
CS6500 Adv. Computer Graphics© Chun-Fa Chang, Spring 2003
Today’s Short Film
Geri’s Gameby
Pixar
CS6500 Adv. Computer Graphics© Chun-Fa Chang, Spring 2003
Announcement• Remaining paper presentations
on and after April 29:– Please pick a date and select a topic
from the reading list before April 17.
• Project proposal also due on April 17.
CS6500 Adv. Computer Graphics© Chun-Fa Chang, Spring 2003
Today’s Topics
• Mip Mapping
• Projective Texture
• Shadow Map
CS6500 Adv. Computer Graphics© Chun-Fa Chang, Spring 2003
Texture Resolution
• One size does not fit all:– For example: an NxN texture may be OK
for a polygon about the same size on screen, but not for a much smaller or much larger polygon.
– Polygon too large blurry texture– Polygon too small wasted texture
memory.
CS6500 Adv. Computer Graphics© Chun-Fa Chang, Spring 2003
Mip Map
• For an NxN texture, also build textures of N/2 x N/2, N/4 x N/4, … etc.
• Total memory required: 4/3 NxN– 1+1/4+1/16+… = 4/3
CS6500 Adv. Computer Graphics© Chun-Fa Chang, Spring 2003
Which Level to Use?
• Naïve answer: pick the closest size.
• Note that we don’t pick a fixed mip-map level for the whole polygon. We will pick a different level for each drawn pixel.
• Also, the level does not need to be an integer In-between levels.
CS6500 Adv. Computer Graphics© Chun-Fa Chang, Spring 2003
Filtering
• Here, we only consider individual pixels of a scan-converted polygon (on the screen)
• Texture coords=(u, v); u, v: real number.• Bi-linear: Find the closest mip-map level,
fetch (u, v ), (u, v ), (u ,v ), (u , v ).
• Tri-linear: Also interpolated between two mip-map levels.
CS6500 Adv. Computer Graphics© Chun-Fa Chang, Spring 2003
Anisotropic Filtering
• Bilinear (and tri-linear) filtering assumes that a screen picture is mapped to a circle on the texture, which is actually incorrect.
• An ellipse (not necessary axis aligned) should be used instead.
• Next slide: EWA = Ellipse Weighted Average.
CS6500 Adv. Computer Graphics© Chun-Fa Chang, Spring 2003
EWA for Texture Mapping
• Paul Heckbert, “Survey of Texture Mapping” IEEE CG&A, Nov. 1986. (Figures)
• Green & Heckbert, “Creating Raster Omnimax Images from Multiple Perspective Views Using The Elliptical Weighted Average Filter” IEEE CG&A, 6(6), pp. 21-27, June 1986.
CS6500 Adv. Computer Graphics© Chun-Fa Chang, Spring 2003
Projective Texture• Mark Segal, et al., “
Fast shadows and lighting effects using texture mapping”. SIGGRAPH 92
• Cass Everitt, “Projective Texture Mapping” NVIDIA SDK White Paper.
Figure 1. Two different views of a smiley face texture projected onto the scene.
CS6500 Adv. Computer Graphics© Chun-Fa Chang, Spring 2003
Assigning Texture Coordinates to Vertices
• The basic idea:1. Move the camera to the projector location.
2. Overlay the produced photo on top of the texture.
(i.e. the pixel location becomes the texture coordinates)
• “Projective Texture Mapping” by Cass Everitt describes how to use OpenGL texgen to achieve that.
CS6500 Adv. Computer Graphics© Chun-Fa Chang, Spring 2003
Shadow Map
• Similar to projective texture:– But this time, we will project the depth,
instead of the slide image.
With Shadows Without Shadows
CS6500 Adv. Computer Graphics© Chun-Fa Chang, Spring 2003
Basic Steps of Shadow Maps
• Render the scene from the light’s point of view,
• Use the light’s depth buffer as a texture (shadow map),
• Projectively texture the shadow map onto the scene,
• Use “texture color” (comparison result) in fragment shading.
CS6500 Adv. Computer Graphics© Chun-Fa Chang, Spring 2003
Image Source: Cass Everitt et al., “Hardware Shadow Mapping” NVIDIA SDK White Paper
Eye’s View Light’s View Depth/Shadow Map
CS6500 Adv. Computer Graphics© Chun-Fa Chang, Spring 2003
Food for Thought
• Why is texture mapping so powerful, useful, magical, …etc.?
(Hint: a lot of hardware design effort)