Texture Mapping - · PDF fileSteps in Texture Mapping (OpenGL) 1. Create a texture object and...

Click here to load reader

  • date post

    17-Feb-2019
  • Category

    Documents

  • view

    221
  • download

    0

Embed Size (px)

Transcript of Texture Mapping - · PDF fileSteps in Texture Mapping (OpenGL) 1. Create a texture object and...

TextureMapping

AdaptedfromslidesbyRichRiesenfeld

http://www.cs.utah.edu/classes/cs5600/

2

TextureMapping

Mapsapattern(texture)ontoasurface Texelsfilleachpixel Texelsselectedfromsamplepattern

(texturemap) Patternisoftenrepeated

3

TextureMappingCharacteristics

Toomuchdetailtomodel

geometrically,likegrass,etc

Patternisrepeated(periodic)

4

TextureMaps

5

Tilingtextures

6

Tilingtextures

http://www.decoratetoday.com/products/wallpaper/product_detail_large.asp?ptn=DZ359A6&gensearchby=1&flagback=False&largequantity=2&si=4http://www.decoratetoday.com/products/wallpaper/product_detail_large.asp?ptn=DZ359A6&gensearchby=1&flagback=False&largequantity=2&si=4http://www.decoratetoday.com/products/wallpaper/product_detail_large.asp?ptn=DZ359A6&gensearchby=1&flagback=False&largequantity=2&si=4

7

ExamplesExamplesofMappedofMappedTextureTexture

8

BasicConcept(2DTexturemaps)

Relatea2Dimagetoa3Dmodel Texturecoordinates

2Dcoordinate(u,v)thatcorrespondstoalocationinthetextureimage

usuallyinrange[0,1]

9

ElementsofTextureMapping

Texturesourcefunction(1D,2Dor3D) Inversemap:

texturelocation surfacelocation Typicaltexturesources

Procedure Tabulardata(textureimage)

10

TextureMappingTechniques

2Dtexturemapping:paint2Dpatternontothesurface

Environmental(reflection)mapping Bumpmapping:perturbsurface

normalstofoolshadingalgorithms Proceduraltexturemapping

11

NeedtoImposeParametrization

(0,0,0) (0,1,0)

(0,0,1)

(1,0,0)

(1,1,1)

h(0,0)

(0.5,0)

(0,0.5)

(1,1)

(0,1)

(1,0)(1,0.5)

(h,)

(0.5,1)

(0,0.5)

(,1)

(,0)

(,)

(1,0.5)

(x,y,z)

12

Usingaplanarprojection

13

MoreExamples

http://astronomy.swin.edu.au/~pbourke/texture/texturemapping

TextureMapping,PaulBourke(1987)

Planar Cubic Cylindrical

14

TextureMappedTeapot

15

Examples

16

StepsinTextureMapping(OpenGL)

1. Createatextureobjectandspecifyatextureforthatobject

2. Indicatehowthetextureistobeappliedtoeachpixel

3. Renderthescene,supplyingbothtextureandgeometriccoordinates

17

Mappingthe2DTexturetoSurface

Themap:2Dtexture(s,t)3Dobject(x,y,z) Mappingontotriangleisnotdifficult

Mappingontotriangularmeshismoredifficult(havetohandletexturediscontinuity)

Mappingontoparametricsurfaceiseasier

Alternative:useanintermediateparametricsurface(cylinder,sphere)

18

TextureMappingforMeshes

Assignpervertextexturecoordinate Duringrasterization:interpolate

texturecoordinatesateachpixel(similartoproject1)

Lookuptexturecolorviatexturecoordinate

19

s

t(1,1)

(0,1)

(0,0) (1,0)

(s,t)=(0.2,0.8)

(0.4,0.2)

(0.8,0.4)

A

B C

aa

bbcc

TextureSpace ObjectSpace

MappingTexture

20

MappingTextureontoParametricSurface

Parametricsurface:S(u,v)=(x(u,v),y(u,v),z(u,v))

Use(u,v)astexturecoordinates

21

Usinganintermediatesurface

Twostepmapping: Mapthetexturetoasimpleintermediate

surface(sphere,cylinder,cube) Maptheintermediatesurface(withthe

texture)ontothesurfacebeingrendered

22

23

24

sphericalprojection,cont'd startingwithpointponthesurface projecttopointp'onunitsphere:

p'=(pc)/|pc| nowuse(x,y,z)coordinatesofp'to

compute(u,v)coordinatesviathenaturalparameterizationofthesphere

25

sphericalprojection,cont'd detailsoflaststepexplainedinproject2

26

MIPMapping(multuminparvo)Manythingsinasmallplace

27

MipmappedTextures Mipmapping:

prefilteredtexturemaps

decreasingresolutions

usedtocombataliasing

OpenGLsupportsmipmapping

28

Aliasing

aliasing(left);antialiased(middle,right)(fromwikipedia)

29

BumpMapping

smoothsilhouettes

30

Bumpmapping 2Dtexturemapsdon'tinteractw/lighting Bumpmapping:usetexturemaptodefine

perturbedsurfacenormals Computelightingusingperturbednormals

31

32

33

OkinoCom

puterGraphics

www.okino.com/slidshow/bowling2.htm

34

MoreExamples

Contoursindicateequidistancefromreferenceplane

TextureMappingasaFundamentalDrawingPrimitivePaulHaeberliandMarkSegal(1993)www.sgi.com/misc/grafica/texmap/

EnvironmentMapping

35

ProjectiveTextureMapping