University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Textures II Week 8, Wed.

Slides:



Advertisements
Similar presentations
Graphics Pipeline.
Advertisements

03/16/2009Dinesh Manocha, COMP770 Texturing Surface’s texture: its look & feel Graphics: a process that takes a surface and modifies its appearance using.
Texture Mapping. Texturing  process that modifies the appearance of each point on a surface using an image or function  any aspect of appearance can.
Texture Mapping. Typical application: mapping images on geometry 3D geometry (quads mesh) + RGB texture 2D (color-map) =
Computer Graphics Bing-Yu Chen National Taiwan University.
Texture Visual detail without geometry. Texture Mapping desire for heightened realism.
Week 7 - Wednesday.  What did we talk about last time?  Transparency  Gamma correction  Started texturing.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Textures I Week 8, Mon.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Transformations II Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Textures I Week 9, Wed.
Texture Mapping CPSC /24/03 Abhijeet Ghosh.
Texturing, Clipping Week 9, Mon 27 Oct 2003
Texture mapping. Adds realism to computer graphics Texture mapping applies a pattern of color Bump mapping alters the surface Mapping is cheaper than.
OpenGL Texture Mapping
OpenGL Texture Mapping Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
OpenGL Texture Mapping April 16, Angel: Interactive Computer Graphics 3E © Addison-Wesley 2002 Basic Stragegy Three steps to applying a texture.
CS 4731: Computer Graphics Lecture 17: Texturing Emmanuel Agu.
Computer Graphics Inf4/MSc Computer Graphics Lecture 11 Texture Mapping.
Texture Mapping A way of adding surface details Two ways can achieve the goal:  Surface detail polygons: create extra polygons to model object details.
1 Computer Graphics Week13 –Shading Models. Shading Models Flat Shading Model: In this technique, each surface is assumed to have one normal vector (usually.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Hidden Surfaces III Week.
Week 8 - Monday.  What did we talk about last time?  Workday  Before that:  Image texturing ▪ Magnification ▪ Minification  Mipmapping  Summed area.
Texture Mapping. To add surface details… World of Warcraft, Blizzard Inc. More polygons (slow and hard to handle small details) Less polygons but with.
Computer Graphics Texture Mapping Eriq Muhammad Adams
11/11/04© University of Wisconsin, CS559 Fall 2004 Last Time Shading Interpolation Texture mapping –Barycentric coordinates for triangles.
1 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Textures and shadows  Generation  Mipmap  Texture coordinates,
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Textures III Week 10,
Texture Mapping. Scope Buffers Buffers Various of graphics image Various of graphics image Texture mapping Texture mapping.
Texture Mapping. Example Mappings Mapping Techniques Consider the problem of rendering a sphere in the examples The geometry is very simple - a sphere.
Texture Mapping Course: Computer Graphics Presented by Fan Chen
Computer Graphics Ben-Gurion University of the Negev Fall 2012.
Mapping method Texture Mapping Environmental mapping (sphere mapping) (cube mapping)
An Interactive Introduction to OpenGL Programming Ed Angel
UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS Textures.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
CS 445 / 645 Introduction to Computer Graphics Lecture 19 Texture Maps Lecture 19 Texture Maps.
Texture Mapping. 2 Motivation A typical modern graphics card can handle 10s of millions of polygons a second. How many individual blades of grass are.
CS-378: Game Technology Lecture #4: Texture and Other Maps Prof. Okan Arikan University of Texas, Austin V Lecture #4: Texture and Other Maps.
OpenGL Texture Mapping. 2 Objectives Introduce the OpenGL texture functions and options.
CS 480/680 Computer Graphics OpenGL Texture Mapping Dr. Frederick C Harris, Jr. Fall 2011.
Texture Mapping Drawing Pictures on Polygons. Texture Mapping.
TEXTURES & OTHER GOODIES Computer Graphics. glTexCoord2f(...); + =
Computer Graphics 2 Lecture 7: Texture Mapping Benjamin Mora 1 University of Wales Swansea Pr. Min Chen Dr. Benjamin Mora.
CHAPTER 8 Color and Texture Mapping © 2008 Cengage Learning EMEA.
Texture Mapping CAP4730: Computational Structures in Computer Graphics.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Textures II Week 9, Fri.
11/5/2002 (c) University of Wisconsin, CS 559 Last Time Local Shading –Diffuse term –Specular term –All together –OpenGL brief overview.
11/24/ :45 Graphics II Shadow Maps Reflections Session 5.
第三课. Overview of this Section Concept of Texture Mapping ( 纹理映射 ) 2D Texture 3D Texture Environment Mapping Bump Mapping Others OpenGL Implementation.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Textures I Week 9, Fri.
Module 05 –Bump mapping Module 05 – Bump mapping Module 05 Advanced mapping techniques: Bump mapping.
CPSC 314 TEXTURE MAPPING UGRAD.CS.UBC.CA/~cs314 Glen Berseth (Based of Mikhail Bessmeltsev and Dinesh Pai)
Texture Mapping CEng 477 Introduction to Computer Graphics.
Recap Last lecture we looked at local shading models –Diffuse and Phong specular terms –Flat and smooth shading Some things were glossed over –Light source.
Texture Mapping Sung-Eui Yoon (윤성의) CS380: Computer Graphics
© University of Wisconsin, CS559 Spring 2004
OpenGL Texture Mapping
OpenGL Texture Mapping
© University of Wisconsin, CS559 Fall 2004
Introduction to Texture Mapping
(c) University of Wisconsin, CS 559
3D Game Programming Texture Mapping
Textures II Week 10, Mon Mar 22
CS-378: Game Technology Lecture #4: Texture and Other Maps
OpenGL Texture Mapping
OpenGL Texture Mapping
Advanced Computer Graphics: Texture
3D Game Programming Texture Mapping
Texture Mapping Jung Lee.
OpenGL Texture Mapping
Presentation transcript:

University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Textures II Week 8, Wed Mar 2

2 Correction & Review: Surface Texture define texture pattern over (s,t) domain image – 2D array of “texels” assign (s,t) coordinates to each point on object surface s t

3 Correction & Review: Example Texture Map glTexCoord2d(0,0); glVertex3d (-x, -y, -z); glTexCoord2d(1,1); glVertex3d (-x, y, z);

4 glTexCoord2d(4, 4); glVertex3d (x, y, z); glTexCoord2d(1, 1); glVertex3d (x, y, z); (4,4)(4,0) (0,4)(0,0) (1,0) (0,0)(0,1) (1,1) Correction & Review: Example Texture Map

5 Review: Texture action when s or t is outside [0…1] interval tiling clamping texture matrix stack glMatrixMode( GL_TEXTURE );

6 Texture Functions once have value from the texture map, can: directly use as surface color: GL_REPLACE throw away old color, lose lighting effects modulate surface color: GL_MODULATE multiply old color by new value, keep lighting info texturing happens after lighting, not relit use as surface color, modulate alpha: GL_DECAL like replace, but supports texture transparency blend surface color with another: GL_BLEND new value controls which of 2 colors to use indirection, new value not used directly for coloring

7 Texture Pipeline Compute object space location Use projector function to find (s, t) Use corresponder function to find texels Apply value transform function (scale, trans, rot) Modify value (color, normal,...)

8 Texture Pipeline t s eye Texel color (0.9,0.8,0.7) (x, y, z) Object position (-2.3, 7.1, 17.7) (s, t) Parameter space (0.32, 0.29) Texture Image space (81, 74)

9 Texture Mapping s t (s 0,t 0 ) (s 1,t 1 ) (s 2,t 2 )

10 Texture Objects and Binding texture object an OpenGL data type that keeps textures resident in memory and provides identifiers to easily access them provides efficiency gains over having to repeatedly load and reload a texture you can prioritize textures to keep in memory OpenGL uses least recently used (LRU) if no priority is assigned texture binding which texture to use right now switch between preloaded textures

11 Basic OpenGL Texturing create a texture object and fill it with texture data: glGenTextures(num, &indices) to get identifiers for the objects glBindTexture(GL_TEXTURE_2D, identifier) to bind following texture commands refer to the bound texture glTexParameteri(GL_TEXTURE_2D, …, …) to specify parameters for use when applying the texture glTexImage2D(GL_TEXTURE_2D, ….) to specify the texture data (the image itself) enable texturing: glEnable(GL_TEXTURE_2D) state how the texture will be used: glTexEnvf(…) specify texture coordinates for the polygon: use glTexCoord2f(s,t) before each vertex: glTexCoord2f(0,0); glVertex3f(x,y,z);

12 Low-Level Details there are a large range of functions for controlling the layout of texture data: state how the data in your image is arranged e.g.: glPixelStorei(GL_UNPACK_ALIGNMENT, 1) tells OpenGL not to skip bytes at the end of a row you must state how you want the texture to be put in memory: how many bits per “pixel”, which channels,… you will be given texture template sample code for project 3 textures must be square and size a power of 2 common sizes are 32x32, 64x64, 256x256 smaller uses less memory, and there is a finite amount of texture memory on graphics cards

13 Texture Mapping texture coordinates specified at vertices glTexCoord2f(s,t); glVertexf(x,y,z); interpolated across triangle (like R,G,B,Z) …well not quite!

14 Texture Mapping texture coordinate interpolation perspective foreshortening problem also problematic for color interpolation, etc.

15 Interpolation: Screen vs. World Space screen space interpolation incorrect problem ignored with shading, but artifacts more visible with texturing P 1 (x,y,z) V 0 (x’,y’) V 1 (x’,y’) P 0 (x,y,z)

16 Texture Coordinate Interpolation perspective correct interpolation , ,  : barycentric coordinates of a point P in a triangle s0, s1, s2 : texture coordinates of vertices w0, w1,w2 : homogeneous coordinates of vertices

17 Reconstruction (image courtesy of Kiriakos Kutulakos, U Rochester)

18 Reconstruction how to deal with: pixels that are much larger than texels? apply filtering, “averaging” pixels that are much smaller than texels ? interpolate

19 MIPmapping Without MIP-mapping With MIP-mapping use “image pyramid” to precompute averaged versions of the texture store whole pyramid in single block of memory

20 MIPmaps multum in parvo -- many things in a small place prespecify a series of prefiltered texture maps of decreasing resolutions requires more texture storage avoid shimmering and flashing as objects move gluBuild2DMipmaps automatically constructs a family of textures from original texture size down to 1x1 withoutwith

21 Texture Parameters in addition to color can control other material/object properties surface normal (bump mapping) reflected color (environment mapping)

22 Bump Mapping: Normals As Texture object surface often not smooth – to recreate correctly need complex geometry model can control shape “effect” by locally perturbing surface normal random perturbation directional change over region

23 Bump Mapping

24 Bump Mapping

25 Embossing at transitions rotate point’s surface normal by θ or - θ

26 Displacement Mapping bump mapped normals are inconsistent with actual geometry silhouettes wrong shadows wrong displacement mapping actually affects the surface geometry

27 Environment Mapping cheap way to achieve reflective effect generate image of surrounding map to object as texture

28 Environment Mapping used to model object that reflects surrounding textures to the eye movie example: cyborg in Terminator 2 different approaches sphere, cube most popular OpenGL support GL_SPHERE_MAP, GL_CUBE_MAP others possible too

29 Sphere Mapping texture is distorted fish-eye view point camera at mirrored sphere spherical texture mapping creates texture coordinates that correctly index into this texture map

30 Cube Mapping 6 planar textures, sides of cube point camera in 6 different directions, facing out from origin

31 Cube Mapping A B C E F D

32 Cube Mapping direction of reflection vector r selects the face of the cube to be indexed co-ordinate with largest magnitude e.g., the vector (-0.2, 0.5, -0.84) selects the –Z face remaining two coordinates (normalized by the 3 rd coordinate) selects the pixel from the face. e.g., (-0.2, 0.5) gets mapped to (0.38, 0.80). difficulty in interpolating across faces

33 Blinn/Newell Latitude Mapping