Textures – Magnification and Minification Lecture 30 Mon, Nov 17, 2003.

Slides:



Advertisements
Similar presentations
Computer Graphics Inf4/MSc 1 Computer Graphics Lecture 7 Scanline algorithm and polygon clipping Taku Komura.
Advertisements

Texture Mapping. Texturing  process that modifies the appearance of each point on a surface using an image or function  any aspect of appearance can.
Lecture 6: 3D Rendering Pipeline (III) Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Institute of Technology.
Texture Mapping. Typical application: mapping images on geometry 3D geometry (quads mesh) + RGB texture 2D (color-map) =
Week 7 - Wednesday.  What did we talk about last time?  Transparency  Gamma correction  Started texturing.
Different types of Polygons Simple Convex Simple Concave Non-simple : self-intersecting With holes ConvexConcaveSelf-intersecting.
3D Graphics for Game Programming (J. Han) Chapter VIII Image Texturing.
1 Computer Graphics Chapter 4 2D Viewing Algorithms.
Graphics Programming: Polygon Filling
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.
Image processing Lecture 4.
1 Computer Graphics Week13 –Shading Models. Shading Models Flat Shading Model: In this technique, each surface is assumed to have one normal vector (usually.
Computer Graphics Inf4/MSc Computer Graphics Lecture 9 Antialiasing, Texture Mapping.
3D Computer Graphics: Textures. Textures: texels Texture is a way of assigning a diffuse color to a pixel – can be with 1, 2 or 3D- can use maps, interpolation.
CS 445 / 645 Introduction to Computer Graphics Lecture 18 Shading Shading.
Computer Graphics Texture Mapping Eriq Muhammad Adams
Computer Graphics Texture Mapping
Section 1.1 Graphs and Graphing Utilities. Points and Ordered Pairs.
1 Texture Mapping ©Anthony Steed Overview n Texture mapping Inverse and Forward Mapping Bilinear interpolation Perspective correction n Mipmapping.
CS 376 Introduction to Computer Graphics 04 / 11 / 2007 Instructor: Michael Eckmann.
Texture Mapping. Scope Buffers Buffers Various of graphics image Various of graphics image Texture mapping Texture mapping.
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)
REVIEW Math 1113 Precalculus Fall 2010 Instructor: Ayona Chatterjee.
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.
CS418 Computer Graphics John C. Hart
Histograms Lecture 14 Sec Tue, Sep 26, 2006.
Texture Mapping. 2 3 Loading Textures void glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border,
Lecture 6 Rasterisation, Antialiasing, Texture Mapping,
CS 325 Introduction to Computer Graphics 04 / 12 / 2010 Instructor: Michael Eckmann.
GAM666 – Introduction To Game Programming ● Textures are simply 2D images which are spread over the triangles of a 3D shape ● Each vertex has texture coordinates.
Textures – Basic Principles Lecture 29 Fri, Nov 14, 2003.
Objective – Students will be able to investigate graphs with different viewing windows or viewing screens. Therefore learning how important it is to choose.
Computer Graphics Through OpenGL: From Theory to Experiments, Second Edition Chapter 12.
Section 1.1 Graphs and Graphing Utilities
Week 7 - Wednesday CS361.
Chapter 1: Linear Functions, Equations, and Inequalities
OpenGL Texture Mapping
CS148: Introduction to Computer Graphics and Imaging
Chapters VIII Image Texturing
Computer Vision Lecture 4: Color
CSCE 441: Computer Graphics Image Warping
Chapter 1: Linear Functions, Equations, and Inequalities
Section 1.1 Graphs and Graphing Utilities
Introduction to Texture Mapping
Section 1.1 Graphs and Graphing Utilities
Rasterizing Lines 1 Lecture 32 Mon, Nov 12, 2007.
Mipmaps Lecture 16 Mon, Oct 1, 2007.
3D Game Programming Texture Mapping
Introduction to Meshes
2D Graphics Lecture 4 Fri, Aug 31, 2007.
Shading Polygons Lecture 36 Wed, Nov 28, 2007.
Rasterizing Polygons 2 Lecture 35 Mon, Nov 26, 2007.
Textures Lecture 11 Wed, Oct 5, 2005.
Rasterizing Polygons Lecture 29 Wed, Dec 7, 2005.
OpenGL Texture Mapping
Mipmaps Lecture 13 Wed, Oct 12, 2005.
Programming Textures Lecture 15 Fri, Sep 28, 2007.
3D Game Programming Texture Mapping
OpenGL Texture Mapping
Introduction to Meshes
Clipping Polygons Lecture 31 Fri, Nov 9, 2007.
Presentation transcript:

Textures – Magnification and Minification Lecture 30 Mon, Nov 17, 2003

Magnification and Minification Ideally, the mapping of texels to pixels would be one-to-one. Here we run into two problems. A small region of texels may be mapped to a large region of pixels (magnification). A large region of texels may be mapped to a small region of pixels (minification).

Magnification In magnification, one texel is mapped to many pixels. a few texels many pixels 1 to 16

Minification In minification, many texels are mapped to one pixel. many texels a few pixels 16 to 1

Calculating the Texel Suppose the polygon (rectangle) goes from (xmin, ymin) in the lower left to (xmax, ymax) in the upper right. Then pixel coordinates (x, y) correspond to texture coordinates s = (x – xmin)/(xmax – xmin). t = (y – ymni)/(ymax – ymin).

Calculating the Texel Then multiply s and t by the dimensions of the texture, e.g., 64  64. Typically, the results are not integers. So we have a choice. Round them to the nearest integers and use that single texel. Use the fractional values to interpolate among the nearest 2  2 array of texels.

Magnification and Minification Run Nate Robin’s tutorial by shrinking the texture region down to a small rectangle. Then expand the texture region and shrink the pixel region down to a small rectangle. Tutors

Magnification pixels texels The alignment is probably not exact.

Nearest Texel pixels texels Find the nearest texel.

Nearest Texel pixels texels Find the nearest texel.

Linear Interpolation OpenGL may also interpolate the colors of the nearest four texels.

Linear Interpolation pixels texels Find the nearest four texels.

Linear Interpolation pixels texels Find the nearest four texels.

Example: Interpolation Using the nearest texel, color the pixels x y s t

Example: Interpolation Compute the color of the pixel (2, 4). Assume the texture is 2  2. The center of the pixel is 25% of the way across the group of texels. Therefore, s = % of the way up the group of texels. Therefore, t = 0.50.

Example: Interpolation Interpolate horizontally. Top edge: 0.75(1, 0, 0) (0, 1, 0) = (0.75, 0.25, 0). Bottom edge: 0.75(0, 0, 1) (1, 1, 0) = (0.25, 0.25, 0.75).

Example: Interpolation Now interpolate those values vertically: 0.5(0.75, 0.25, 0) + 0.5(0.25, 0.25, 0.75) = (0.5, 0.25, 0.375).

Interpolation This is very similar to the interpolation used to shade a triangle except that The triangle used barycentric coordinates. The texture uses bilinear interpolation in rectangular coordinates.

Example TextureDemo.cppTextureDemo.cpp. RgbImage.cppRgbImage.cpp. Press ‘N’ to toggle between GL_NEAREST and GL_LINEAR.

Minification one pixel texels Again, the alignment is not exact.

Minification If 64 texels all map to the single pixel, what color should the pixel be? ?

Minification Again, we may choose between the nearest texel and interpolating among the nearest four texels.

Nearest Texel If we choose to use the nearest texel, then OpenGL uses the color of the texel whose center is nearest to the center of the pixel. This can lead to “shimmering” and other effects if adjacent pixels have very different colors, as in the checkerboard example.

Minification one pixel texels Choose the nearest texel.

Minification If we choose to interpolate, then OpenGL will compute the average of the four texels that whose centers are nearest to the center of the pixel. This will reduce, but not eliminate, the shimmering and other effects.

Minification one pixel texels Choose the four nearest texels.

Minification 64 texels one pixel