111/17/2015 03:24 UML Solution Involves Selection of Discrete Representation Values.

Slides:



Advertisements
Similar presentations
Texture Mapping. Texturing  process that modifies the appearance of each point on a surface using an image or function  any aspect of appearance can.
Advertisements

1 Understanding of OpenGL TA: Dong Hyun Jeong Instructor : Dr. Kalpathi Subramanian Texture Mapping.
TEXTURE MAPPING JEFF CHASTINE 1. TEXTURE MAPPING Applying an image (or a texture ) to geometry 2D images (rectangular) 3D images (volumetric – such as.
OpenGL Texture Mapping
Buffers Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
OpenGL Texture Mapping
OpenGL Texture Mapping Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
1 Lecture 12 Texture Mapping uploading of the texture to the video memory the application of the texture onto geometry.
CS 4731: Computer Graphics Lecture 21: Raster Graphics Part 2 Emmanuel Agu.
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.
OpenGL Pixel Operations, Bitmaps, Fonts and Images The Current Raster Position Current raster position: A position in window coordinates where the next.
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.
 Bitmap: A bitmap is a rectangular array of 0s and 1s that serves as a drawing mask for a corresponding rectangular portion of the window.  Applications:
Computer Graphics Texture Mapping Eriq Muhammad Adams
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Texture Mapping + Texture Object = Texture Mapped Object.
2IV60 Computer Graphics set 10: Texture mapping Jack van Wijk TU/e.
Texture Mapping. Scope Buffers Buffers Various of graphics image Various of graphics image Texture mapping Texture mapping.
Texture Mapping. Introduction What is Texture Mapping? Types of Texture Mapping –1D, 2D and 3D SDL and OpenGL.
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
CS 445 / 645 Introduction to Computer Graphics Lecture 19 Texture Maps Lecture 19 Texture Maps.
ECSE-4750 Computer Graphics Fall 2004 Prof. Michael Wozny TA. Abhishek Gattani TA. Stephen
Imaging and Raster Primitives Vicki Shreiner. 2 Jobs Andrew Giles Andrew Giles Chuck Fultz Chuck Fultz SIGGraph - SIGGraph.
2002 by Jim X. Chen: 1 So far, we only concerned with the rendering of geometric data. Two other important classes of data:
Texture Mapping Fall, Textures Describe color variation in interior of 3D polygon  When scan converting a polygon, vary pixel colors according.
And Some Extra Information From
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.
CS 480/680 Computer Graphics OpenGL Texture Mapping Dr. Frederick C Harris, Jr. Fall 2011.
Texture Mapping in OpenGL. Texture Mapping Imaging we are “pasting” a picture onto a model  Which part of the picture will be pasted onto which part.
Texture Mapping Drawing Pictures on Polygons. Texture Mapping.
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.
OpenGL Programming Guide : Texture Mapping Yoo jin wook Korea Univ. Computer Graphics Lab.
Computing & Information Sciences Kansas State University Lecture 12 of 42CIS 636/736: (Introduction to) Computer Graphics CIS 636/736 Computer Graphics.
Computer Graphics Bing-Yu Chen National Taiwan University.
1 Graphics CSCI 343, Fall 2015 Lecture 25 Texture Mapping.
Details of Texture Mapping Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, December 1, 2003.
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.
Buffers Ed Angel Professor Emeritus of Computer Science
Texture Mapping Fall, 2016.
Texture Mapping 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.
OpenGL Texture Mapping
OpenGL Texture Mapping
Introduction to Computer Graphics with WebGL
Computer Graphics, Lee Byung-Gook, Dongseo Univ.
Chapters VIII Image Texturing
Introduction to Texture Mapping
Geb Thomas Adapted from the OpenGL Programming Guide
Computer Graphics, Lee Byung-Gook, Dongseo Univ.
Class 26 more textures environmental textures Color ramps
Computer Graphics, Lee Byung-Gook, Dongseo Univ.
Computer Graphics Buffers
3D Game Programming Texture Mapping
Textures Lecture 11 Wed, Oct 5, 2005.
Computer Graphics Practical Lesson 6
Buffers Ed Angel Professor Emeritus of Computer Science
OpenGL Texture Mapping
Class 27 more textures environmental textures Color ramps
OpenGL Texture Mapping
Programming Textures Lecture 15 Fri, Sep 28, 2007.
3D Game Programming Texture Mapping
OpenGL Texture Mapping
Presentation transcript:

111/17/ :24 UML Solution Involves Selection of Discrete Representation Values

211/17/ :24 UML Antialiasing: An Example

311/17/ :24 UML Aliasing: Square Pixels

411/17/ :24 UML Antialiasing: Unweighted Area Sampling Pixel Intensity Proportional to Area of Intersection

511/17/ :24 UML Antialiasing: Unweighted Area Sampling

611/17/ :24 UML Antialiasing: Weighted Sampling Function (Conical) Desired Line Weighting Function Region of Overlap

711/17/ :24 UML Gupta-Sproull Antialiasing v 1+v 1-v

811/17/ :24 UML Write from Memory to Frame Buffer Main Memory

911/17/ :24 UML Read from Frame Buffer into Main Memory Main Memory

1011/17/ :24 UML Copy from One Part of Frame Buffer to Another

1111/17/ :24 UML OpenGL Functions for Reading, Writing, Copying Pixel Data glReadPixels( ) - Reads a rectangular array of pixels from the frame buffer and stores in main memory glDrawPixels( ) - Writes a rectangular array of pixels into the frame buffer from data in main memory glCopyPixels( ) - Copies a rectangular array of pixels from one part of the frame buffer to another Issues: Kind of frame buffer data How data is stored in main memory Data conversions performed during reading, writing, or copying

1211/17/ :24 UML Reading Pixel Data Frame Buffer -> Memory void glReadPixels(GLint x, Glint y, Glsizei width, GLsizei height, GLenum format, Glenum type, GLvoid *pixels); x - x coordinate of lower left corner of rectangular subimage y - y coordinate of lower left corner of rectangular subimage width - width of subimage in pixels height - height of subimage in pixels format - type of pixel data elements read type - storage data type for each element *pixels - array to receive the data

1311/17/ :24 UML Pixel Formats GL_COLOR_INDEX A single color index GL_RGB A red color component followed by a green followed by a blue GL_RGBA Red, green, blue, alpha components GL_RED A single red component GL_GREEN A single green component GL_BLUE A single blue component GL_ALPHA A single alpha component GL_LUMINANCE A single luminance component GL_LUMINANCE_ALPHA A luminance component followed by an alpha component GL_STENCIL_INDEX A single stencil index GL_DEPTH_COMPONENT A single depth component

1411/17/ :24 UML Data Types GL_UNSIGNED_BYTE unsigned 8-bit integer GL_BYTE signed 8-bit integer GL_BITMAP single bits in unsigned 8-bit integers GL_UNSIGNED_SHORT unsigned 16-bit integer GL_SHORT signed 16-bit integer GL_UNSIGNED_INT unsigned 32-bit integer GL_INT 32-bit integer GL_FLOAT single-precision float pt.

1511/17/ :24 UML Writing Pixel Data Memory -> Frame Buffer void glDrawPixels(Glsizei width, GLsizei height, GLenum format, Glenum type, GLvoid *pixels); width - width of subimage in pixels height - height of subimage in pixels format - type of pixel data elements read type - storage data type for each element *pixels - array holding the data to be drawn Lower left corner of the subimage is defined by the current raster position, defined by glRasterPos*().

1611/17/ :24 UML Copying Pixel Data void glCopyPixels(GLint x, Glint y, Glsizei width, GLsizei height,Glenum type); x - x coordinate of lower left corner of rectangular subimage y - y coordinate of lower left corner of rectangular subimage width - width of subimage in pixels height - height of subimage in pixels type - GL_COLOR, GL_DEPTH, or GL_STENCIL Copied data is drawn at the current raster position.

1711/17/ :24 UML Pixel Storage Mode Determination void glPixelStore{if} (GLenum pname, TYPE param); ParameterTypeDefault GL_UNPACK_SWAP_BYTESGLbooleanFALSE GL_PACK_SWAP_BYTES GL_UNPACK_LSB_FIRSTGLboolearFALSE GL_PACK_LSB_FIRST GL_UNPACK_ROW_LENGTHGLint0 GL_PACK_ROW_LENGTH GL_UNPACK_SKIP_ROWSGLint0 GL_PACK_SKIP_ROWS GL_UNPACK_SKIP_PIXELSGLint0 GL_PACK_SKIP_PIXELS GL_UNPACK_ALIGNMENTGLint4 GL_PACK_ALIGNMENT

1811/17/ :24 UML Reading a Subimage from Memory ROW_LENGTH subimage SKIP_PIXELS SKIP_ROWS image in memory

1911/17/ :24 UML Pixel Transfer Operations void glPixelTransfer{if}(GLenum pname, TYPE param); ParameterTypeDefault GL_RED_SCALEGLfloat1.0 GL_GREEN_SCALEGLfloat1.0 GL_BLUE_SCALEGLfloat1.0 GL_RED_BIASGLfloat0.0 GL_GREEN_SCALEGLfloat0.0 GL_BLUE_SCALEGLfloat and many more

2011/17/ :24 UML Graphics Files ModelRender Display ModelRender Display ModelRender Display Store Customary graphics data flow: Alternative graphics data flows:

2111/17/ :24 UML Graphics File Types “Vector”Bitmap

2211/17/ :24 UML Vector File Formats Advantages and…….. Disadvantages 0 Efficient representation 0 Work well for “line art” 0 Well suited to scaling (zoom) 0 Objects can have identity 0 Extensible to 3D 0 Limited set of objects that can be represented

2311/17/ :24 UML Bitmap File Formats Advantages and…….. Disadvantages 0 Represent images with complex variations in colors 0 Storage size -Mitigated by compression techniques 0 Costly to manipulate 0 Fixed resolution - problem with scaling 0 Inability to identify “objects”

2411/17/ :24 UML Graphics Metafiles Page Description Languages Graphics Metafile Attributes Vector Data Image Data

2511/17/ :24 UML Bitmap File Formats: Generic Structure Header Pixel Data [Optional Compression] [Color Table] Fixed File Offset

2611/17/ :24 UML Example Bitmap Format: Windows BMP (Device Independent Bitmap) File Header Bitmap Data Bitmap Header 0 14

2711/17/ :24 UML Example Bitmap Format: Windows BMP (Device Independent Bitmap) 0 Offset Size Name Description 02bfTypeASCII “BM” 24bfSizeSize of file in bytes 62bfReserved1Zero 82bfReserved2Zero 104bfOffBitsByte offset to image File Header

2811/17/ :24 UML Example Bitmap Format: Windows BMP (Device Independent Bitmap) 14 Offset Size Name Description 144biSizeSize of this header 184biWidthImage width (pixels) 224biHeightImage height 262biPlanes#planes (=1) 282biBitCountBits/pixel (1,4,8 or 24) 304biCompressionCompression type 344biSizeImageSize (bytes) of comp.img. 384biXPelsPerMeterx pixels/meter 424biYPelsPerMetery pixels/meter 464biClrUsedNumber of colors used 504biClrImportantNo. of important colors 544*NbmiColorsColor Map Bitmap Header

2911/17/ :24 UML Example Bitmap Format: Windows BMP (Device Independent Bitmap) 54 Offset Size Name Description 01rgbBlueBlue value 11rgbGreenGreen value 21rgbRedRed value 31rgbReservedZero Color Map

3011/17/ :24 UML Example Bitmap Format: Windows BMP (Device Independent Bitmap) 0 Bits are stored a row at a time starting from the bottom of the image to the top. 0 Each row is padded to a 4-byte boundary 0 Significance of bits depends upon the number of bits per pixel -In case of 1 bit per pixel each pixel is a single bit. High- order bit is the leftmost pixel -In case of 4 bit per pixel images are packed two pixels per byte, with the high nibble being the leftmost pixel

3111/17/ :24 UML Example Bitmap Format: Windows BMP (Device Independent Bitmap) Pixel 1 Pixel 2 Pixel 3 Pixel 4 Pixel 5 Pixel 6 Pixel 7 Pixel 8 Pixel 9 Pixel 10 Pixel 1 Pixel 2 8 bits/pixel (color index) 24 bits/pixel Pixel 3

3211/17/ :24 UML Windows Bitmap RLE Compression Repeating groups (2 bytes: count, repeated byte): Literal groups (zero byte, pixel count, literal pixels): A A Special group: 00 00end of row 00 01end of bitmap xx yycontinuation xx pixels to right and yy pixels down

3311/17/ :24 UML Texture Mapping Texture Map = image Polygon

3411/17/ :24 UML Texture Mapping: The Main Steps 0 Specify the texture -Usually a single, two dimensional, rectangular image =Can be one dimensional -Individual elements: texels -One to four elements per texel (RGBA) -OpenGL 1.x requires dimensions be powers of two 0 Define how the texture is to be applied to each pixel -Decal mode -Replace mode -Modulate mode -Blend mode -Add mode (new with OpenGL 2.0) 0 Enable texture mapping 0 Draw the scene, supplying both texture and geometric coordinates

3511/17/ :24 UML Texture Mapping: Specifying the Current Texture in OpenGL void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLvoid *texels); target - future use, must be GL_TEXTURE_2D level - 0 unless using multiple level of detail internalFormat - one of 38 symbolic constants width, height - height and width of texture map in texels border - size of border in texels format, type - storage parameters, same as glDrawPixels() *texels - storage location of the texture map

3611/17/ :24 UML Binding Texture Objects void glBindTexture(GLenum target, GLuint textureName); target: GL_TEXTURE_1D or GL_TEXTURE_2D textureName: unique unsigned int identifier When initially called, binds the default texture state to the identifier. Subsequent calls to texture functions modify the state of the texture object. When binding to a previously created texture object, that object becomes active. Unique texture names can be generated by: glGenTextures()

3711/17/ :24 UML Texture Mapping: Assigning Texture Coordinates void glTexCoord2d(GLdouble s, GLdouble t); s t Values outside [0.0, 1.0] can be made to either wrap or clamp to boundary values Texture Image

3811/17/ :24 UML Boundary Wrapping/Clamping void glTexParameteri(GLenum target, GLenum pname, TYPE param); target: GL_TEXTURE_2D pname: GL_TEXTURE_WRAP_S or GL_TEXTURE_WRAP_T param: GL_CLAMP uses the last pixel value in the s or t direction for s,t outside [0,1] GL_REPEAT repeats the texture pattern for s, t outside [0,1]

3911/17/ :24 UML Texture Mapping: Magnification and Minification TexturePolygon Texture MagnificationMinification

4011/17/ :24 UML Texture Mapping: Specifying Filtering for Mag./Min. glTexParameteri(GL_TEXTURE_2D, filter type, filter)’ filter type - GL_TEXTURE_MAG_FILTER for magnification, GL_TEXTURE_MIN_FILTER for minification filter - GL_NEAREST selects the texel mapping nearest to the target pixel GL_LINEAR performs a linear average of the 2x2 array of texels around the mapped point

4111/17/ :24 UML Texture Mapping: How the Texture is Applied void glTexEnv*(GLenum target, GLenum pname, GLenum param); target - must be GL_TEXTURE_ENV pname - GL_TEXTURE_ENV_MODE param - one of GL_DECAL, GL_REPLACE, GL_MODULATE, GL_BLEND, GL_ADD

4211/17/ :24 UML Texture Mapping: Interpreting glTexEnv() Parameters From OpenGL 2.0 Specification, J. Leech & P. Brown, ed., Oct. 22, 2004

4311/17/ :24 UML Texture Mapping: Interpreting glTexEnv() Parameters From OpenGL 2.0 SpecificationFrom OpenGL 2.0 Specification, J. Leech & P. Brown, ed., Oct. 22, 2004