Magnification and Minification Lecture 30 Robb T. Koether Hampden-Sydney College Fri, Nov 6, 2015 Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 1 / 17
Outline 1 Applying Textures 2 Magnification 3 Minification 4 Filters 5 Assignment Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 2 / 17
Outline 1 Applying Textures 2 Magnification 3 Minification 4 Filters 5 Assignment Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 3 / 17
Applying Textures When a texture is applied to a primitive, the texels are mapped to the pixels of the rasterized primitive (usually a triangle). There is rarely a one-to-one match, leading to one of two situations. One texel maps to several pixels. Several texels map to one pixel. Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 4 / 17
Applying Textures Definition (Magnification) Magnification is the mapping of one texel to several pixels (because the texel is magnified). Definition (Minification) Minification is the mapping of several texels to one pixel (because the texels are reduced). Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 5 / 17
Applying Textures When mapping texels to pixels, we may choose between Applying the nearest texel to the pixel. Or linear interpolation among the four nearest texels. Interpolation uses a 2-dimensional weighted average of the 4 nearest texels, called bilinear interpolation. Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 6 / 17
Outline 1 Applying Textures 2 Magnification 3 Minification 4 Filters 5 Assignment Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 7 / 17
Magnification of Texels (Nearest) 1 texel mapped to 512 512 pixels Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 8 / 17
Magnification of Texels (Nearest) 1 texel mapped to 256 256 pixels Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 8 / 17
Magnification of Texels (Nearest) 1 texel mapped to 128 128 pixels Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 8 / 17
Magnification of Texels (Nearest) 1 texel mapped to 64 64 pixels Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 8 / 17
Magnification of Texels (Nearest) 1 texel mapped to 32 32 pixels Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 8 / 17
Magnification of Texels (Nearest) 1 texel mapped to 16 16 pixels Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 8 / 17
Magnification of Texels (Nearest) 1 texel mapped to 8 8 pixels Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 8 / 17
Magnification of Texels (Nearest) 1 texel mapped to 4 4 pixels Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 8 / 17
Outline 1 Applying Textures 2 Magnification 3 Minification 4 Filters 5 Assignment Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 9 / 17
Minification of Texels (Nearest) Texels Pixels Minification at a 2 : 1 ratio Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 10 / 17
Minification of Texels (Nearest) Texels Pixels Minification at a 2 : 1 ratio Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 10 / 17
Minification of Texels (Nearest) Texels Pixels Minification at a 2 : 1 ratio Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 10 / 17
Minification of Texels (Nearest) Texels Pixels Minification at a 2 : 1 ratio Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 10 / 17
Minification of Texels (Nearest) Texels Pixels Minification at a 5 : 2 ratio Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 11 / 17
Minification of Texels (Nearest) Texels Pixels Minification at a 5 : 2 ratio Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 11 / 17
Minification of Texels (Nearest) Texels Pixels Minification at a 5 : 2 ratio Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 11 / 17
Minification of Texels (Nearest) Texels Pixels Minification at a 5 : 2 ratio Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 11 / 17
Other Problems 64 Texels 36 Pixels Undesirable effects Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 12 / 17
Other Problems 64 Texels 36 Pixels Undesirable effects Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 12 / 17
Other Problems 64 Texels 36 Pixels Undesirable effects (nearest) Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 12 / 17
Other Problems 64 Texels 36 Pixels Undesirable effects (interpolated) Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 12 / 17
Other Problems Texture Nearest Undesirable effects (nearest) Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 12 / 17
Other Problems Texture Interpolated Undesirable effects (interpolated) Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 12 / 17
Outline 1 Applying Textures 2 Magnification 3 Minification 4 Filters 5 Assignment Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 13 / 17
Filters Filters gltexparameteri(gl_texture_2d, GL_TEXTURE_MAG_FILTER, GL_NEAREST); gltexparameteri(gl_texture_2d, GL_TEXTURE_MIN_FILTER, GL_NEAREST); We can specify filters for magnification and for minification. GL_NEAREST will use the nearest texel. Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 14 / 17
Filters Filters gltexparameteri(gl_texture_2d, GL_TEXTURE_MAG_FILTER, GL_LINEAR); gltexparameteri(gl_texture_2d, GL_TEXTURE_MIN_FILTER, GL_LINEAR); We can specify filters for magnification and for minification. GL_LINEAR will interpolate texels. Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 15 / 17
Outline 1 Applying Textures 2 Magnification 3 Minification 4 Filters 5 Assignment Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 16 / 17
Homework Homework Read pages 259-263: Texture Mapping & Basic Texture Types Read pages 270-277: Texture Formats Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 17 / 17