DREXEL CS 480 - Texture Mapping and NURBS

Unformatted text preview:

1Texture Mapping and NURBSWeek 7David BreenDepartment of Computer ScienceDrexel UniversityBased on material from Ed Angel, University of New MexicoCS 480/680INTERACTIVE COMPUTER GRAPHICSAngel: Interactive Computer Graphics 3E© Addison-Wesley 20022Objectives• Introduce Mapping Methods– Texture Mapping– Environmental Mapping– Bump Mapping• Consider basic strategies– Forward vs backward mapping– Point sampling vs area averagingAngel: Interactive Computer Graphics 3E© Addison-Wesley 20023The Limits of Geometric Modeling• Although graphics cards can render over100 million polygons per second, thatnumber is insufficient for manyphenomena– Clouds – Bark– Grass – Scales– Terrain – Marble– Skin – FabricAngel: Interactive Computer Graphics 3E© Addison-Wesley 20024Modeling an Orange• Consider the problem of modeling anorange (the fruit)• Start with an orange-colored sphere– Too simple• Replace sphere with a more complexshape– Does not capture surface characteristics(small dimples)– Takes too many polygons to model all thedimplesAngel: Interactive Computer Graphics 3E© Addison-Wesley 20025Modeling an Orange (2)• Take a picture of a real orange, scan it,and “paste” onto simple geometricmodel– This process is texture mapping• Still might not be sufficient becauseresulting surface will be smooth– Need to change local shape– Bump mappingAngel: Interactive Computer Graphics 3E© Addison-Wesley 20026Three Types of Mapping• Texture Mapping– Uses images to fill inside of polygons• Environmental (reflection mapping)– Uses a picture of the environment for texture maps– Allows simulation of highly specular surfaces• Bump mapping– Emulates altering normal vectors during therendering process2Angel: Interactive Computer Graphics 3E© Addison-Wesley 20027Texture Mappinggeometric model texture mappedAngel: Interactive Computer Graphics 3E© Addison-Wesley 20028Environment MappingAngel: Interactive Computer Graphics 3E© Addison-Wesley 20029Bump MappingAngel: Interactive Computer Graphics 3E© Addison-Wesley 200210Where does mapping take place?• Mapping techniques are implemented at theend of the rendering pipeline– Very efficient because few polygons passdown the geometric pipelineAngel: Interactive Computer Graphics 3E© Addison-Wesley 200211Is it simple?• Although the idea is simple---map animage to a surface---there are 3 or 4coordinate systems involved2D image3D surfaceAngel: Interactive Computer Graphics 3E© Addison-Wesley 200212Coordinate Systems• Parametric coordinates– May be used to model curved surfaces• Texture coordinates– Used to identify points in the image to bemapped• World Coordinates– Conceptually, where the mapping takes place• Screen Coordinates– Where the final image is really produced3Angel: Interactive Computer Graphics 3E© Addison-Wesley 200213Texture Mappingparametriccoordinatestexture coordinates &Image coordinatesworld coordinatesscreen coordinatesAngel: Interactive Computer Graphics 3E© Addison-Wesley 200214Mapping Functions• Basic problem is how to find the maps• Consider mapping from texture coordinates toa point a surface• Appear to need three functionsx = x(s,t)y = y(s,t)z = z(s,t)• But we really want to go the other wayst(x,y,z)Angel: Interactive Computer Graphics 3E© Addison-Wesley 200215Backward Mapping• We really want to go backwards– Given a pixel, we want to know to which point onan object it corresponds– Given a point on an object, we want to know towhich point in the texture it corresponds• Need a map of the form s = s(x,y,z) t = t(x,y,z)• Such functions are difficult to find in generalAngel: Interactive Computer Graphics 3E© Addison-Wesley 200216Two-part mapping• One solution to the mapping problem isto first map the texture to a simpleintermediate surface• Example: map to cylinderAngel: Interactive Computer Graphics 3E© Addison-Wesley 200217Cylindrical Mappingparametric cylinderx = r cos (2πu)y = r sin (2πu)z = v•hmaps rectangle in u,v space to cylinderof radius r and height h in world coordinatess = ut = vmaps from texture spaceAngel: Interactive Computer Graphics 3E© Addison-Wesley 200218Spherical MapWe can use a parametric spherex = r cos (2πu)y = r sin (2πu) cos (2πv)z = r sin (2πu) sin (2πv)in a similar manner to the cylinderbut have to decide where to putthe distortionSpheres are used in environmental maps4Angel: Interactive Computer Graphics 3E© Addison-Wesley 200219Box Mapping• Easy to use with simple orthographicprojection• Also used in environmental mapsAngel: Interactive Computer Graphics 3E© Addison-Wesley 200220Second Mapping• Map from intermediate object to actual object– Normals from intermediate to actual– Normals from actual to intermediate– Vectors from center of intermediateintermediateactualAngel: Interactive Computer Graphics 3E© Addison-Wesley 200221Aliasing• Point sampling of the texture can leadto aliasing errorspoint samples in u,v (or x,y,z) spacepoint samples in texture spacemiss blue stripesAngel: Interactive Computer Graphics 3E© Addison-Wesley 200222Area AveragingA better but slower option is to use area averagingNote that preimage of pixel is curvedpixelpreimageOpenGL Texture MappingAngel: Interactive Computer Graphics 3E© Addison-Wesley 200224Objectives• Introduce the OpenGL texture functionsand options5Angel: Interactive Computer Graphics 3E© Addison-Wesley 200225Basic Stragegy• Three steps to applying a texture1. specify the texture• read or generate image• assign to texture• enable texturing2. assign texture coordinates to vertices• Proper mapping function is left to application3. specify texture parameters• wrapping, filteringAngel: Interactive Computer Graphics 3E© Addison-Wesley 200226Texture MappingstxyzimagegeometryscreenAngel: Interactive Computer Graphics 3E© Addison-Wesley 200227Texture Example• The texture (below) is a256 x 256 image thathas been mapped to arectangular polygonwhich is viewed inperspectiveAngel: Interactive Computer Graphics 3E© Addison-Wesley 200228Texture Mapping and the OpenGLPipelinegeometry pipelineverticespixel pipelineimagerasterizer• Images and geometry flow throughseparate pipelines that join at therasterizer– “complex” textures do not affect geometriccomplexityAngel: Interactive Computer Graphics 3E© Addison-Wesley 200229• Define a texture image from an array of texels (texture elements) in CPU memory Glubyte


View Full Document

DREXEL CS 480 - Texture Mapping and NURBS

Documents in this Course
Lecture6

Lecture6

71 pages

Lecture6

Lecture6

71 pages

Lecture7

Lecture7

57 pages

Load more
Download Texture Mapping and NURBS
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 NURBS 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 and NURBS 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?