Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Texture Mapping - Lecture Slides | CS 5501, Study notes of Computer Science

Material Type: Notes; Professor: Luebke; Subject: Computer Science; University: University of Virginia; Term: Spring 2000;

Typology: Study notes

Pre 2010

Uploaded on 03/19/2009

koofers-user-07m
koofers-user-07m ๐Ÿ‡บ๐Ÿ‡ธ

10 documents

1 / 5

Toggle sidebar

Related documents


Partial preview of the text

Download Texture Mapping - Lecture Slides | CS 5501 and more Study notes Computer Science in PDF only on Docsity! 1 David Luebke 5/6/2000 CS 551 / 645: Introductory Computer Graphics Texture Mapping II David Luebke 5/6/2000 Administrivia โ— Assignment 5: just kidding David Luebke 5/6/2000 Recap: Texture Mapping โ— Adding surface detail helps keep CG images from looking simple and sterile โ— Explicitly modeling this detail in geometry can be very expensive โ€“ Zebra stripes, wood grain, writing on a whiteboard โ— Texture mapping pastes images onto the surfaces in the scene, adding realistic fine detail without exploding the geometry David Luebke 5/6/2000 Recap: Texture Mapping Recap: Texture Mapping David Luebke 5/6/2000 Recap: Texture Coordinates โ— Give each vertex of the triangle a texture coordinate (u, v) โ— For other points on the triangle, interpolate texture coordinate from the vertices โ— Problem: interpolating in screen-space (a la Gouraud shading) is incorrect โ€“ Perspective foreshortening should compress the texture image on distant regions of the surface โ€“ Demo at http://graphics.lcs.mit.edu/classes/6.837/F98/Lecture21/Slide06.html 2 David Luebke 5/6/2000 Recap: Perspective-Correct Interpolation โ— Skipping some mathโ€ฆ โ€“ Rather than interpolating u and v directly, interpolate u/z and v/z โ–  These do interpolate correctly in screen space โ–  Also need to interpolate z and multiply per-pixel โ€“ Problem: we donโ€™t know z anymore โ€“ Solution: we do know w โ‰ˆ 1/z โ€“ Soโ€ฆinterpolate uw and vw and w, and compute u = uw/w and v = vw/w for each pixel โ–  This unfortunately involves a divide per pixel David Luebke 5/6/2000 Recap: Texture Map Aliasing โ— Naive texture mapping looks blocky, pixelated โ€“ Problem: using a single texel to color each pixel: int uval = (int) (u * denom + 0.5f); int vval = (int) (v * denom + 0.5f); int pix = texture.getPixel(uval, vval); โ€“ Actually, each pixel maps to a region in texture โ–  If the pixel is larger than a texel, we should average the contribution from multiple texels somehow โ–  If the pixel is smaller than a texel, we should interpolate between texel values somehow โ–  Even if pixel size โ‰ˆ texel size, a pixel will in general fall between four texels โ€“ An example of a general problem called aliasing David Luebke 5/6/2000 Recap: Texture Map Antialiasing โ— Use bilinear interpolation to average nearby texel values into a single pixel value (Draw it) โ€“ Find 4 nearest texture samples โ–  Round u & v up and down โ€“ Interpolate texel values in u โ€“ Interpolate resulting values in v โ— Also addresses the problem of many pixels projecting to a single texel (Why?) David Luebke 5/6/2000 Recap: Texture Map Antialiasing โ— What if a single pixel covers many texels? โ€“ Problem: sampling those texels at a single point (the center of the pixel): โ–  Produces Moire patterns in coherent texture (checkers) โ–  Leads to flicker or texture crawling as the texture moves โ€“ Approach: blur the image under the pixel, averaging the contributions of the covered texels โ–  But calculating which texels every pixel covers is way too expensive, especially as the texture is compressed โ€“ Solution: pre-calculate lower-resolution versions of the texture that incorporate this averaging David Luebke 5/6/2000 MIP-maps โ— For a texture of 2n x 2n pixels, compute n-1 textures, each at ยฝ the resolution of previous: โ— This multiresolution texture is called a MIP-map Original Texture Lower Resolution Versions David Luebke 5/6/2000 Generating MIP-maps โ— Generating a MIP-map from a texture is easy โ€“ For each texel in level i, average the values of the four corresponding texels in level i-1 โ— If a texture requires n bytes of storage, how much storage will a MIP-map require? โ— Answer: 4n/3
Docsity logo



Copyright ยฉ 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved