Columbia COMS 4160 - Texture Mapping

Unformatted text preview:

Computer Graphics (Fall 2005)To DoThis Lecture: Texture MappingAdding Visual DetailParameterizationOption: Varieties of projectionsOption: unfold the surfaceOption: make an atlasOption: it’s the artist’s problemOutlineHow to map object to texture?Idea: Use Map ShapePlanar mappingCylindrical MappingSpherical MappingCube MappingSlide 17Slide 181st idea: Gouraud interp. of texcoordsArtifactsInterpolating ParametersTexture MappingSlide 23Perspective-Correct InterpolationTexture Map FilteringMip MapsMIP-map ExampleSlide 28Texture Mapping ApplicationsModulation texturesBump MappingDisplacement MappingIllumination MapsEnvironment MapsSolid texturesProcedural Texture GallerySlide 37Slide 38Slide 39Slide 40Slide 41Where we’re going with courseComputer Graphics (Fall 2005)Computer Graphics (Fall 2005)COMS 4160, Lecture 20: Texture Mappinghttp://www.cs.columbia.edu/~cs4160Many slides from Greg Humphreys, UVA andRosalee Wolfe, DePaul tutorial teaching texture mapping visuallyTo DoTo DoWork on HW4 milestonePrepare for final push on HW 4No final exam. HW 4, written ass 2 Issues with OpenGL/coding? Some people difficulties with HW 3 Some issues with skeleton codeThis Lecture: Texture MappingThis Lecture: Texture MappingImportant topic: nearly all objects texturedWood grain, faces, bricks and so onAdds visual detail to scenesMeant as a fun and practically useful lectureBut not tested specifically on itPolygonal modelWith surface textureAdding Visual DetailAdding Visual DetailBasic idea: use images instead of more polygons to represent fine scale color variationParameterizationParameterizationgeometrygeometry++==imageimagetexture maptexture map•Q: How do we decide where on the geometryeach color from the image should go?Option: Varieties of projectionsOption: Varieties of projections[Paul Bourke][Paul Bourke]Option: unfold the surfaceOption: unfold the surface[Piponi2000]Option: make an atlasOption: make an atlas[Sander2001]charts atlas surfaceOption: it’s the artist’s problemOption: it’s the artist’s problemOutlineOutlineTypes of projectionsInterpolating texture coordinates Broader use of texturesHow to map object to texture?How to map object to texture?To each vertex (x,y,z in object coordinates), must associate 2D texture coordinates (s,t)So texture fits “nicely” over objectIdea: Use Map ShapeIdea: Use Map ShapeMap shapes correspond to various projectionsPlanar, Cylindrical, SphericalFirst, map (square) texture to basic map shapeThen, map basic map shape to objectOr vice versa: Object to map shape, map shape to squareUsually, this is straightforwardMaps from square to cylinder, plane, sphere well definedMaps from object to these are simply spherical, cylindrical, cartesian coordinate systemsPlanar mappingPlanar mappingLike projections, drop z coord (s,t) = (x,y)Problems: what happens near z = 0?Cylindrical MappingCylindrical MappingCylinder: r, θ, z with (s,t) = (θ/(2π),z)Note seams when wrapping around (θ = 0 or 2π)Spherical MappingSpherical MappingConvert to spherical coordinates: use latitude/long.Singularities at north and south polesCube MappingCube MappingCube MappingCube MappingOutlineOutlineTypes of projectionsInterpolating texture coordinates Broader use of textures11stst idea: Gouraud interp. of texcoords idea: Gouraud interp. of texcoordsScan line1I2I3I1y2y3ysyaIbI1 2 2 11 2( ) ( )s saI y y I y yIy y- + -=-1 3 3 11 3( ) ( )s saI y y I y yIy y- + -=-( ) ( )a b p b p aab aI x x I x xIx x- + -=-pIActual implementation efficient: difference equations while scan convertingArtifactsArtifactsMcMillan’s demo of this is at http://graphics.lcs.mit.edu/classes/6.837/F98/Lecture21/Slide05.htmlAnother example http://graphics.lcs.mit.edu/classes/6.837/F98/Lecture21/Slide06.htmlWhat artifacts do you see?Why?Why not in standard Gouraud shading?Hint: problem is in interpolating parametersInterpolating ParametersInterpolating ParametersThe problem turns out to be fundamental to interpolating parameters in screen-spaceUniform steps in screen space  uniform steps in world spaceTexture MappingTexture MappingLinear interpolationof texture coordinatesCorrect interpolationwith perspective divideHill Figure 8.42Interpolating ParametersInterpolating ParametersPerspective foreshortening is not getting applied to our interpolated parametersParameters should be compressed with distanceLinearly interpolating them in screen-space doesn’t do thisPerspective-Correct InterpolationPerspective-Correct InterpolationSkipping a bit of math to make a long story short…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http://graphics.lcs.mit.edu/classes/6.837/F98/Lecture21/Slide14.htmlTexture Map FilteringTexture Map FilteringNaive texture mapping aliases badly Look familiar?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|PIX| < |TEX| Easy: interpolate (bilinear) between texel values |PIX| > |TEX|Hard: average the contribution from multiple texels|PIX| ~ |TEX|Still need interpolation!Mip MapsMip MapsKeep textures prefiltered at multiple resolutionsFor each pixel, linearly interpolate between two closest levels (e.g., trilinear filtering) Fast, easy for hardwareWhy “Mip” maps?MIP-map ExampleMIP-map ExampleNo filtering:MIP-map texturing:AAAAAAAGHMY EYES ARE BURNINGWhere are my glasses?OutlineOutlineTypes of projectionsInterpolating texture coordinates Broader use of texturesTexture Mapping ApplicationsTexture Mapping ApplicationsModulation, light mapsBump mappingDisplacement mappingIllumination or Environment MappingProcedural texturingAnd many moreModulation texturesModulation textures)))()(((),(SSTTLLLnSDAAEIKIKISRVKLNKIKItsTI --)))()(((),(SSTTLLLnSDAAEIKIKISRVKLNKIKItsTI --Map texture values to scale factorWood textureTexturevalueBump MappingBump MappingTexture = change in surface normal!Sphere


View Full Document

Columbia COMS 4160 - Texture Mapping

Download Texture Mapping
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 Mapping 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 Mapping 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?