DOC PREVIEW
UW-Madison CS 559 - Texture Anti-Aliasing

This preview shows page 1-2-3-24-25-26 out of 26 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Last TimeTodayTexture RecapTextures and AliasingPoint Sampled Texture AliasingMipmapping (Pre-filtering)Many Texels for Each PixelMipmapsMipmap MathPost-FilteringFiltering ExampleBoundariesRepeat BorderClamp BorderBorder ColorOther Texture StuffYet More Texture StuffProcedural Texture MappingOther Types of MappingThe Story So FarModeling OverviewIssues in ModelingChoosing a RepresentationCategorizing Modeling TechniquesParameterizationTechniques We Will Examine11/11/04 © University of Wisconsin, CS559 Fall 2004Last Time•Shading Interpolation•Texture mapping–Barycentric coordinates for triangles11/11/04 © University of Wisconsin, CS559 Fall 2004Today•Texture Anti-Aliasing•Texture boundaries•Modeling introduction11/11/04 © University of Wisconsin, CS559 Fall 2004Texture Recap•We must reconstruct the texture image at the point (s,t)•Time to apply the theory of sampling and reconstructionTriangle in 8x8 Texture Map, I(s,t)stTriangle in world spaceInterpolated (s,t) – we need a texture sample from I(s,t)I(s,t)11/11/04 © University of Wisconsin, CS559 Fall 2004Textures and Aliasing•Textures are subject to aliasing:–A polygon pixel maps into a texture image, essentially sampling the texture at a point–The situation is essentially an image warp, with the warp defined by the mapping and projection•Standard approaches:–Pre-filtering: Filter the texture down before applying it•Useful when the texture has multiple texels per output image pixel–Post-filtering: Take multiple pixels from the texture and filter them before applying to the polygon fragment•Useful in all situations11/11/04 © University of Wisconsin, CS559 Fall 2004Point Sampled Texture Aliasing•Note that the back row is a very poor representation of the true imageTexture mapPolygon far from the viewer in perspective projectionRasterized and textured11/11/04 © University of Wisconsin, CS559 Fall 2004Mipmapping (Pre-filtering)•If a textured object is far away, one screen pixel (on an object) may map to many texture pixels–The problem is: how to combine them•A mipmap is a low resolution version of a texture–Texture is filtered down as a pre-processing step:•gluBuild2DMipmaps(…)–When the textured object is far away, use the mipmap chosen so that one image pixel maps to at most four mipmap pixels–Full set of mipmaps requires at most 1.3333 the storage of the original texture (in the limit)•1+0.25+.25*.25+0.25*0.25*0.25+…11/11/04 © University of Wisconsin, CS559 Fall 2004Many Texels for Each PixelTexture map with pixels drawn on it.Some pixels cover many texture elements (texels)Polygon far from the viewer in perspective projection11/11/04 © University of Wisconsin, CS559 Fall 2004MipmapsFor near objectsFor far objectsFor middle objects11/11/04 © University of Wisconsin, CS559 Fall 2004Mipmap Math•Define a scale factor,  =texels/pixel–A texel is a pixel from a texture is actually the maximum from x and y–The scale factor may vary over a polygon–It can be derived from the transformation matrices•Define =log2  tells you which mipmap level to use–Level 0 is the original texture, level 1 is the next smallest texture, and so on–If <0, then multiple pixels map to one texel: magnification11/11/04 © University of Wisconsin, CS559 Fall 2004Post-Filtering•You tell OpenGL what sort of post-filtering to do•Magnification: When <0 the image pixel is smaller than the texel:–glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, type)–Type is GL_LINEAR or GL_NEAREST•Minification: When >0 the image pixel is bigger than the texel:–GL_TEX_MIN_FILTER–Can choose to:•Take nearest point in base texture, GL_NEAREST•Linearly interpolate nearest 4 pixels in base texture, GL_LINEAR•Take the nearest mipmap and then take nearest or interpolate in that mipmap, GL_NEAREST_MIPMAP_LINEAR•Interpolate between the two nearest mipmaps using nearest or interpolated points from each, GL_LINEAR_MIPMAP_LINEAR11/11/04 © University of Wisconsin, CS559 Fall 2004Filtering ExampleLevel 0Level 2Level 1s=0.12,t=0.1=1.4=0.49NEAREST_MIPMAP_NEAREST:level 0, pixel (0,0)LINEAR_MIPMAP_NEAREST:level 0, pixel (0,0) * 0.51+ level 1, pixel (0,0) * 0.49NEAREST_MIPMAP_LINEAR:level 0, combination ofpixels (0,0), (1,0), (1,1), (0,1)LINEAR_MIPMAP_LINEAR:Combination of level 0 and level 1, 4 pixels from each level, using 8 pixels in all11/11/04 © University of Wisconsin, CS559 Fall 2004Boundaries•You can control what happens if a point maps to a texture coordinate outside of the texture image–All texture images are assumed to go from (0,0) to (1,1) in texture space – means that the mapping is independent of the texture size–The problem is how to extend the image to make an infinite space•Repeat: Assume the texture is tiled–glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT)•Clamp to Edge: the texture coordinates are truncated to valid values, and then used –glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP)•Can specify a special border color:–glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, R,G,B,A)11/11/04 © University of Wisconsin, CS559 Fall 2004Repeat Border(0,0)(1,1)11/11/04 © University of Wisconsin, CS559 Fall 2004Clamp Border(0,0)(1,1)11/11/04 © University of Wisconsin, CS559 Fall 2004Border Color(0,0)(1,1)11/11/04 © University of Wisconsin, CS559 Fall 2004Other Texture Stuff•Texture must be in fast memory - it is accessed for every pixel drawn–If you exceed it, performance will degrade horribly–Skilled artists can pack textures for different objects into one image•Texture memory is typically limited, so a range of functions are available to manage it•Specifying texture coordinates can be annoying, so there are functions to automate it•Sometimes you want to apply multiple textures to the same point: Multitexturing is now in most new hardware11/11/04 © University of Wisconsin, CS559 Fall 2004Yet More Texture Stuff•There is a texture matrix: apply a matrix transformation to texture coordinates before indexing texture•There are “image processing” operations that can be applied to the pixels coming out of the texture•There are 1D and 3D textures–Mapping works essentially the same–3D textures are very memory intensive, and how they are used is very application dependent–1D saves memory if the texture is inherently 1D, like stripes11/11/04 © University of Wisconsin, CS559 Fall


View Full Document

UW-Madison CS 559 - Texture Anti-Aliasing

Documents in this Course
Filters

Filters

14 pages

Lecture 2

Lecture 2

24 pages

Clipping

Clipping

22 pages

Modeling

Modeling

33 pages

Filters

Filters

26 pages

Dithering

Dithering

33 pages

Lecture 4

Lecture 4

20 pages

Load more
Download Texture Anti-Aliasing
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Texture Anti-Aliasing and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Texture Anti-Aliasing 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?