1 9. Textures v Create the illusion of detail by wraping a complex image (texture) around a simple...

19
9. Textures 9. Textures Create the illusion of detail by Create the illusion of detail by wraping a complex image wraping a complex image (texture) around a simple (texture) around a simple geometry geometry realism is increased without the realism is increased without the need for a complex shape need for a complex shape Texture Mapping continued

Transcript of 1 9. Textures v Create the illusion of detail by wraping a complex image (texture) around a simple...

Page 1: 1 9. Textures v Create the illusion of detail by wraping a complex image (texture) around a simple geometry –realism is increased without the need for.

1

9. Textures9. Textures Create the illusion of detail by wraping a Create the illusion of detail by wraping a

complex image (texture) around a simple complex image (texture) around a simple geometrygeometry– realism is increased without the need for a realism is increased without the need for a

complex shapecomplex shape

Texture Mapping

continued

Page 2: 1 9. Textures v Create the illusion of detail by wraping a complex image (texture) around a simple geometry –realism is increased without the need for.

2

TexturesTextures

Page 3: 1 9. Textures v Create the illusion of detail by wraping a complex image (texture) around a simple geometry –realism is increased without the need for.

3

OpenGL PipelineOpenGL Pipeline

OpenGL Pipeline Overview DiagramOpenGL Reference Manual (Addison-Wesley Publishing Company)

Page 4: 1 9. Textures v Create the illusion of detail by wraping a complex image (texture) around a simple geometry –realism is increased without the need for.

4

TexturesTextures

Express a image or complex objectsExpress a image or complex objects How to present wall or treeHow to present wall or tree

– Geometry and color??Geometry and color??

– Texture!!Texture!!

Page 5: 1 9. Textures v Create the illusion of detail by wraping a complex image (texture) around a simple geometry –realism is increased without the need for.

5

TexturesTextures

Basic PrinciplesBasic Principles Create a Simple TextureCreate a Simple Texture

Page 6: 1 9. Textures v Create the illusion of detail by wraping a complex image (texture) around a simple geometry –realism is increased without the need for.

6

TexturesTextures

ObjectivesObjectives

Know what a texture is and why we need it. Know what a texture is and why we need it. Be able to program simple textures. Be able to program simple textures.

Page 7: 1 9. Textures v Create the illusion of detail by wraping a complex image (texture) around a simple geometry –realism is increased without the need for.

7

TexturesTextures

Basic PrinciplesBasic Principles

Detailed surface structures are hard and Detailed surface structures are hard and expensive to build in 3D -> Texture!expensive to build in 3D -> Texture!

„„Texel“ is „texture element“ -> one pixel of Texel“ is „texture element“ -> one pixel of a texture.a texture.

Texture mapping: Fit image to a given Texture mapping: Fit image to a given geometry.geometry.

Page 8: 1 9. Textures v Create the illusion of detail by wraping a complex image (texture) around a simple geometry –realism is increased without the need for.

8

TexturesTextures

Create a Simple TextureCreate a Simple Texture

Load an imageLoad an image

Create a textureCreate a texture

Create 3D-Create 3D-object with appearanceobject with appearance

String filename = "earth.jpg"; TextureLoader loader = new TextureLoader(filename, this);ImageComponent2D image = loader.getImage();

Texture2D texture = new Texture2D(Texture.BASE_LEVEL, Texture.RGBA, image.getWidth(), image.getHeight());texture.setImage(0, image);

Appearance appear = new Appearance(); appear.setTexture(texture);

Sphere earth = new Sphere(1.0f, Primitive.GENERATE_TEXTURE_COORDS, appear));

Page 9: 1 9. Textures v Create the illusion of detail by wraping a complex image (texture) around a simple geometry –realism is increased without the need for.

9

Java3D TexturesJava3D Textures

TextureLoader classTextureLoader class TexCoordGeneration classTexCoordGeneration class Texture2D classTexture2D class Texture3D classTexture3D class

Page 10: 1 9. Textures v Create the illusion of detail by wraping a complex image (texture) around a simple geometry –realism is increased without the need for.

10

Adding TextureAdding Texture

Adds high-frequency detail that would be Adds high-frequency detail that would be unreasonable to achieve through polygons unreasonable to achieve through polygons and colorand color

Page 11: 1 9. Textures v Create the illusion of detail by wraping a complex image (texture) around a simple geometry –realism is increased without the need for.

11

Page 12: 1 9. Textures v Create the illusion of detail by wraping a complex image (texture) around a simple geometry –realism is increased without the need for.

12

Page 13: 1 9. Textures v Create the illusion of detail by wraping a complex image (texture) around a simple geometry –realism is increased without the need for.

13

Page 14: 1 9. Textures v Create the illusion of detail by wraping a complex image (texture) around a simple geometry –realism is increased without the need for.

14

TexturesTextures

ArtistArtist creates creates BitmapsBitmaps

““wrap the wrap the bitmap around bitmap around the model” via the model” via UV MappingUV Mapping

Page 15: 1 9. Textures v Create the illusion of detail by wraping a complex image (texture) around a simple geometry –realism is increased without the need for.

15

UV MappingUV Mapping

Cutting, Stretching, Rotating a flat texture Cutting, Stretching, Rotating a flat texture to project on a 3D surfaceto project on a 3D surface

Texture Exists in (u,v) spaceTexture Exists in (u,v) space Model’s polygons carry (u,v) coordinates in Model’s polygons carry (u,v) coordinates in

addition to (xyz)addition to (xyz) Use tools to assign the proper (u,v) pairs to Use tools to assign the proper (u,v) pairs to

each polygoneach polygon

Page 16: 1 9. Textures v Create the illusion of detail by wraping a complex image (texture) around a simple geometry –realism is increased without the need for.

16

u

v

1.0, 0.5

0,0

0.5, 1.0 0,0

1.0, 0.5 0.5, 1.0

Page 17: 1 9. Textures v Create the illusion of detail by wraping a complex image (texture) around a simple geometry –realism is increased without the need for.

17

2D and 3D textures are supported2D and 3D textures are supported

Textures an be attached to shapes in a varietTextures an be attached to shapes in a variety of predefined ways, or linked to specific cy of predefined ways, or linked to specific coordinates in the shape.oordinates in the shape.

Page 18: 1 9. Textures v Create the illusion of detail by wraping a complex image (texture) around a simple geometry –realism is increased without the need for.

18

Texture MappingTexture Mapping Wrap and ClampWrap and Clamp

FilteringFiltering– Texel to pixelTexel to pixel– MagnificationMagnification– MinificationMinification– MIPmapsMIPmaps

Page 19: 1 9. Textures v Create the illusion of detail by wraping a complex image (texture) around a simple geometry –realism is increased without the need for.

19

Texture Coordinate GenerationTexture Coordinate Generation

TexCoordGeneration classTexCoordGeneration class– Automatically generate texture coordinates.Automatically generate texture coordinates.– Linear ProjectionLinear Projection– Sphere MapSphere Map