Mapping method Texture Mapping Environmental mapping (sphere mapping) (cube mapping)

Slides:



Advertisements
Similar presentations
Hofstra University1 Texture Motivation: to model realistic objects need surface detail: wood grain, stone roughness, scratches that affect shininess, grass,
Advertisements

Graphics Pipeline.
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.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Textures II Week 8, Wed.
Texture Mapping CPSC /24/03 Abhijeet Ghosh.
Hofstra University1 Texture Motivation: to model realistic objects need surface detail: wood grain, stone roughness, scratches that affect shininess, grass,
CSC345: Advanced Graphics & Virtual Environments
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.
Texture Mapping A way of adding surface details Two ways can achieve the goal:  Surface detail polygons: create extra polygons to model object details.
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
Introduction to Texture Mapping CSE 470/598 Introduction to Computer Graphics Arizona State University Dianne Hansford.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Fundamentals of Computer Graphics Part 9 Discrete Techniques prof.ing.Václav Skala, CSc. University of West Bohemia Plzeň, Czech Republic ©2002 Prepared.
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,
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.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 Going-through.
ECSE-4750 Computer Graphics Fall 2004 Prof. Michael Wozny TA. Abhishek Gattani TA. Stephen
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.
OpenGL Texture Mapping. 2 Objectives Introduce the OpenGL texture functions and options.
Texture Mapping Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
CS 480/680 Computer Graphics OpenGL Texture Mapping Dr. Frederick C Harris, Jr. Fall 2011.
1 Texture Mapping. 2 Texture Aliasing MIPmaps Environment Mapping Bump Mapping Displacement Mapping Shadow Maps Solid Textures Antialiasing.
Texture Mapping Software College, Shandong University Instructor: Zhou Yuanfeng
Texture Mapping Drawing Pictures on Polygons. Texture Mapping.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Discrete Techniques Chapter 7 Begun February 22, 2005 Finished April 26, 2005.
CHAPTER 8 Color and Texture Mapping © 2008 Cengage Learning EMEA.
2 COEN Computer Graphics I Evening’s Goals n Discuss displaying and reading image primitives n Describe texture mapping n Discuss OpenGL modes and.
Texture Mapping. 2 3 Loading Textures void glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border,
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CS 325 Introduction to Computer Graphics 04 / 12 / 2010 Instructor: Michael Eckmann.
Details of Texture Mapping Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, December 1, 2003.
第三课. Overview of this Section Concept of Texture Mapping ( 纹理映射 ) 2D Texture 3D Texture Environment Mapping Bump Mapping Others OpenGL Implementation.
Texture Mapping. For Further Reading Angel 7 th Ed: ­Chapter 7: 7.3 ~ 7.9 Beginning WebGL: ­Chapter 3 2.
CSc4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Texture Mapping.
1 Chapter 7 Texture Mapping. 2 The Limits of Geometric Modeling Although graphics cards can render over 10 million polygons per second, that number is.
CS425 © 2003 Ray S. Babcock Pixels and Bitmaps ● OpenGL allows us to work directly with bits and groups of bits, or pixels, which flow down a parallel.
Texture Mapping CEng 477 Introduction to Computer Graphics.
Madhulika (18010), Assistant Professor, LPU.
Texture Mapping 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.
Texture Mapping We can improve the realism of graphics models by mapping a texture pattern (image) onto the modeled object surface. We refer to this technique.
OpenGL Texture Mapping
Graphics, Fall 2017 Lecture 24: Texture Mapping
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009
OpenGL Texture Mapping
Introduction to Computer Graphics with WebGL
Interactive Graphics Algorithms Ying Zhu Georgia State University
Introduction to Computer Graphics with WebGL
Introduction to Texture Mapping
Texture Motivation: to model realistic objects need surface detail: wood grain, stone roughness, scratches that affect shininess, grass, wall paper. Use.
(c) University of Wisconsin, CS 559
3D Game Programming Texture Mapping
OpenGL Texture Mapping
OpenGL Texture Mapping
Advanced Computer Graphics: Texture
Programming Textures Lecture 15 Fri, Sep 28, 2007.
Texture Mapping Ed Angel Professor Emeritus of Computer Science
3D Game Programming Texture Mapping
OpenGL Texture Mapping
Presentation transcript:

Mapping method Texture Mapping Environmental mapping (sphere mapping) (cube mapping)

Introduction When we deal with texture When we deal with texture 2D image may use as texture for surface 2D image may use as texture for surface

Image format Bitmap (bmp) Bitmap (bmp) TIFF TIFF 2 forms: uncompress and compressed 2 forms: uncompress and compressed JPG JPG Compressed image Compressed image Post Script (PS) Post Script (PS) used in printer control used in printer control Coded in 7 bit of ASCII character set Coded in 7 bit of ASCII character set Understood by a large class of printer Understood by a large class of printer Large in size Large in size Encapsulated Post Script (EPS) Encapsulated Post Script (EPS) PS similar but add additional information for previewing images. GIF GIF For index images with color table and an array of image indices.

Mapping Methods Texture mapping Texture mapping Pattern (texture) determined the color of fragment Pattern (texture) determined the color of fragment Map on smooth surface Map on smooth surface Bump mapping Bump mapping Distort the normal vector Distort the normal vector Make some bump on surface Make some bump on surface Environmental mapping Environmental mapping Image that have the appearance of ray trace Image that have the appearance of ray trace

Texture Mapping Some patterns Some patterns Regardless of pattern Regardless of pattern 1D for stripe, curve etc 1D for stripe, curve etc 2D use to map on surface 2D use to map on surface 3D map on solid box 3D map on solid box

Two-Dimensional Texture Mapping Mapping involved among 3 or 4 different coordinate systems. Mapping involved among 3 or 4 different coordinate systems. Screen coordinate at first, Final at world coordinate system Screen coordinate at first, Final at world coordinate system World coordinate: object is described here World coordinate: object is described here Texture coordinate: describe texture Texture coordinate: describe texture Parametric coordinate: for the relation of curve or surface Parametric coordinate: for the relation of curve or surface Texture process Texture process Start out with 2D image may come from Start out with 2D image may come from Photo scanning Photo scanning Form by application Form by application Brought into the memory array Brought into the memory array Smallest element called texel (texture element) Smallest element called texel (texture element) texel is represented by T(s,t) (texel coordinate) texel is represented by T(s,t) (texel coordinate) where s and t are texture coordinate. where s and t are texture coordinate. Often range between 0 and 1 Often range between 0 and 1

Mapping approach

Method of texture mapping Texture maps on a parametric surface. Map texture together with parametric on to geometric coordinate Last project onto the screen coordinate

Map the texture coordinate to geometric coordinate Map the texture coordinate to geometric coordinate Texture to screen coordinate Texture to screen coordinate We interested in mapping area to area We interested in mapping area to area Aliasing problem may happen Aliasing problem may happen

Direct mapping between texel coordinate to parametric coordinate

Two-part mapping Use for map on curve surface Use for map on curve surface 2 steps 2 steps Map texture on intermediate surface Map texture on intermediate surface Map intermediate surface to surface being rendered Map intermediate surface to surface being rendered Useable both parametric and geometric coordinate Useable both parametric and geometric coordinate

Suppose that map on the cylinder surface Texture mapping with a cylinder

Mapping texture on the intermediate object to the desire surface 3 possible strategies 3 possible strategies a. Place the texture at the finding point of intersection of normal from object edge a. Place the texture at the finding point of intersection of normal from object edge b. place the texture at the interaction point of normal intersect the intermediate surface b. place the texture at the interaction point of normal intersect the intermediate surface c. draw a line from the center of the object to edge c. draw a line from the center of the object to edge

Texture Mapping in OpenGL OpenGL pipelines merge at rendering (rasterization) stage process: maps 3D points to pixels on the display. visibility is test (with the z-buffer) and is shaded if visible. Vertices are mapped to texture coordinates in object defined stage, values can then be obtained by interpolation like color to polygons

Creating a texture process Define texel array Define texel array GLubyte my_texels[512][512]; // monochrome image or GLubyte my_texels[512][512][3]; // rgb image Assign image to texture memory Assign image to texture memory glTexImage2D(GL_TEXTURE_2D, 0, 3, 512, 512, 0, GL_RGB, GL_UNSIGNED_BYTE, my_texels); Enable texture Enable textureglEnable(GL_TEXTURE_2D);

Defining texture to object. t and s have value between 0 and 1 correspond to texel array (mytexels) t and s have value between 0 and 1 correspond to texel array (mytexels) Mapping can happened at object definition stage in glBegin and glEnd loop Mapping can happened at object definition stage in glBegin and glEnd loop Correspond of texel to image coordinate. Opengl use interpolate to match the image. glBegin(GL_QUAD); glTexCoord2f(0.0,0.0); glVertex2f(x1, y1); glTexCoord2f(1.0,0.0); glVertex2f(x2, y2); glTexCoord2f(1.0,1.0); glVertex2f(x3, y3); glTexCoord2f(0.0,1.0); glVertex2f(x4, y4); glEnd(); Map texture using glTexCoord

Mapping condition Texture map condition (a) 100% (b) 50% of texture Mapping of texture to polygons. (a and b) Mapping of a checkerboard texture to a triangle. (c) Mapping of a checkerboard texture to a trapezoid.

When (s,t) outside (0,1) We can set for repeat or clamp when value is out of bound We can set for repeat or clamp when value is out of bound For clamping use GL_CLAMP instead of GL_REPEAT For clamping use GL_CLAMP instead of GL_REPEAT glTexParameteri(GL_TEXTURE_WRAP_S, GL_REPEAT); // for s glTexParameteri(GL_TEXTURE_WRAP_T, GL_CLAMP); // clamp t

Problem : Alias Texel is rarely get the center Texel is rarely get the center Use point sampling Use point sampling Closet texel is use for interpolate Closet texel is use for interpolate Weighted average of a group of texel Weighted average of a group of texel Linear filtering Linear filtering Problem may occur at the edge Problem may occur at the edge Add more texel row and colum Add more texel row and colum (2 m +1)x(2 n +1) (2 m +1)x(2 n +1)

Most of texel doesn’t math the pixel Mapping texels to pixels condition (a) Magnification. (b) Minification. In both cases, use the value of the nearest point sampling. glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); More smooth use GL_LINEAR instead of GL_NEAREST

When texel is larger than pixel ? Use mipmapping technique for minification Use mipmapping technique for minification We can reduce size of texel to match the image by let OpenGL interpolate for a small one We can reduce size of texel to match the image by let OpenGL interpolate for a small one gluBuild2DMipmaps(GL_TEXTURE_2D,3,64,64,GL_RGB,GL_UNSIGNED_BYTE, my_texels); Or control parameter level of glTexImage2D() instead glTexImage2D(GL_TEXTURE_2D, level, components, width, height, border, format, type, tarray);

Texture and shading 2 options 2 options Multiply the shading and texture by control Multiply the shading and texture by control glTexEnvi(GL_TEX_ENV,GL_TEX_ENV_MODE, GL_MODULATE); Decal the texture to object Decal the texture to object glTexEnvi(GL_TEX_ENV,GL_TEX_ENV_MODE, GL_DECAL);

Projection correction No need for orthogonal projection if linear interpolation is use No need for orthogonal projection if linear interpolation is use For perspective projection For perspective projection due to non linear depth scaling due to non linear depth scaling a better interpolation is apply by use a better interpolation is apply by use glHint(GL_PERSPECTIVE_CORRECTION, GL_NICEST);

Texture transformation As vertices definition As vertices definition Transformation such as scaling, rotating, move etc Transformation such as scaling, rotating, move etc Texture coordinate store in the form of 4D matrix call texture matrix Texture coordinate store in the form of 4D matrix call texture matrix Initially matrix is identical Initially matrix is identical Manipulate by glMatrixMode() Manipulate by glMatrixMode() glMatrixMode(GL_TEXTURE);

Texture object An OpenGL technique to deal with multitexture An OpenGL technique to deal with multitexture Former : Former : Load texture every time texture is change with glTexture2D() Load texture every time texture is change with glTexture2D() Inefficient Inefficient Using texture object Using texture object Load all textures that need to texture memory Load all textures that need to texture memory Only change the texture handle to switch between texture Only change the texture handle to switch between texture

Multitexturing

Environmental / Reflection Maps appear on highly specular surface eg. mirror appear on highly specular surface eg. mirror use physically base rendering method such as ray tracer use physically base rendering method such as ray tracer basic idea basic idea follow the r = 2(v.n)n-v until intersect the environment follow the r = 2(v.n)n-v until intersect the environment shad the reflect to the object shad the reflect to the object approximate using step 2 approximate using step 2

Cubemapping A subtechnique of environmental mapping A subtechnique of environmental mapping OpenGL support which is called by OpenGL support which is called by glTexImage2D(GL_CUBE_MAP_dir_axis, 0, 3, 512, 512, 0, GL_RGB, GL_UNSIGNED_BYTE, my_texels); dir : POSITIVE / NEGATIVE axis : X, Y or Z The object will be surrounded by environt with cube map The object will be surrounded by environt with cube map

Sphere map

Bump mapping

Bump (cont)

Compositing techniques Opacity and blending Opacity and blending Image compositing Image compositing Image compositing in OpenGL Image compositing in OpenGL Antialiasing Antialiasing Back to front and front to back rendering Back to front and front to back rendering Depth cue and fog Depth cue and fog

Multirendering and Accumulation buffer Scene antialising Scene antialising Bump Mapping and Embossing Bump Mapping and Embossing Image Processing Image Processing Image Extensions Image Extensions Other multipass method Other multipass method

Sampling and Aliasing sampling theory sampling theory reconstruction reconstruction quantization quantization