Mipmaps. Lecture 23 Subsection Fri, Oct 30, Hampden-Sydney College. Mipmaps. Robb T. Koether. Discrete Sampling.

Similar documents
Mipmaps. Lecture 35. Robb T. Koether. Hampden-Sydney College. Wed, Nov 18, 2015

Lecture 22 Sections 8.8, 8.9, Wed, Oct 28, 2009

Overview. Goals. MipMapping. P5 MipMap Texturing. What are MipMaps. MipMapping in OpenGL. Generating MipMaps Filtering.

Magnification and Minification

CT5510: Computer Graphics. Texture Mapping

Discussion 3. PPM loading Texture rendering in OpenGL

CS212. OpenGL Texture Mapping and Related

Applying Textures. Lecture 27. Robb T. Koether. Hampden-Sydney College. Fri, Nov 3, 2017

Texture Mapping CSCI 4229/5229 Computer Graphics Fall 2016

CSE 167: Introduction to Computer Graphics Lecture #9: Textures. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

CSE 167: Lecture 11: Textures 2. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

CSE 167: Introduction to Computer Graphics Lecture #8: Textures. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016

CSE 167: Introduction to Computer Graphics Lecture #7: Textures. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2018

Steiner- Wallner- Podaras

CS GPU and GPGPU Programming Lecture 12: GPU Texturing 1. Markus Hadwiger, KAUST

Texture Mapping 1/34

Texture mapping. Computer Graphics CSE 167 Lecture 9

Lecture 19: OpenGL Texture Mapping. CITS3003 Graphics & Animation

OpenGL Texture Mapping. Objectives Introduce the OpenGL texture functions and options

CS GPU and GPGPU Programming Lecture 16+17: GPU Texturing 1+2. Markus Hadwiger, KAUST

Cap. 3 Textures. Mestrado em Engenharia Informática (6931) 1º ano, 1º semestre

三維繪圖程式設計 3D Graphics Programming Design 第七章基礎材質張貼技術嘉大資工系盧天麒

Graphics. Texture Mapping 고려대학교컴퓨터그래픽스연구실.

CSE 167: Introduction to Computer Graphics Lecture #8: Textures. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017

Texture and other Mappings

ก ก ก.

Today. Texture mapping in OpenGL. Texture mapping. Basic shaders for texturing. Today. Computergrafik

Texture Mapping 1/34

Computergrafik. Matthias Zwicker Universität Bern Herbst 2016

CS452/552; EE465/505. Texture Mapping in WebGL

CS 432 Interactive Computer Graphics

Texture Mapping. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Textures. Texture Mapping. Bitmap Textures. Basic Texture Techniques

Computer Graphics. Lecture 8 Antialiasing, Texture Mapping

CMSC 425: Lecture 12 Texture Mapping Thursday, Mar 14, 2013

Texture Mapping. Mike Bailey.

GRAFIKA KOMPUTER. ~ M. Ali Fauzi

Objectives. Texture Mapping and NURBS Week 7. The Limits of Geometric Modeling. Modeling an Orange. Three Types of Mapping. Modeling an Orange (2)

OUTLINE. Implementing Texturing What Can Go Wrong and How to Fix It Mipmapping Filtering Perspective Correction

CISC 3620 Lecture 7 Lighting and shading. Topics: Exam results Buffers Texture mapping intro Texture mapping basics WebGL texture mapping

TSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY

Lecture 07: Buffers and Textures

The Projection Matrix

Minimal Spanning Trees

Texturas. Objectives. ! Introduce Mapping Methods. ! Consider two basic strategies. Computação Gráfica

Computergraphics Exercise 15/ Shading & Texturing

CS 130 Final. Fall 2015

Buffers. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Shading Triangles. Lecture 37. Robb T. Koether. Hampden-Sydney College. Mon, Nov 30, 2015

Texture Mapping. Texture (images) lecture 16. Texture mapping Aliasing (and anti-aliasing) Adding texture improves realism.

lecture 16 Texture mapping Aliasing (and anti-aliasing)

Chapter 3. Texture mapping. Learning Goals: Assignment Lab 3: Implement a single program, which fulfills the requirements:

CS GPU and GPGPU Programming Lecture 11: GPU Texturing 1. Markus Hadwiger, KAUST

Texturing. Slides done bytomas Akenine-Möller and Ulf Assarsson Department of Computer Engineering Chalmers University of Technology

-=Catmull's Texturing=1974. Part I of Texturing

Rotations and Translations

3D Programming. 3D Programming Concepts. Outline. 3D Concepts. 3D Concepts -- Coordinate Systems. 3D Concepts Displaying 3D Models

Fog example. Fog is atmospheric effect. Better realism, helps determine distances

Lecture 25 Sections 8.4, 8.6. Fri, Apr 24, 2009

Texturing Theory. Overview. All it takes is for the rendered image to look right. -Jim Blinn 11/10/2018

Texture Mapping. Computer Graphics, 2015 Lecture 9. Johan Nysjö Centre for Image analysis Uppsala University

Shading/Texturing. Dr. Scott Schaefer

The Traveling Salesman Problem Brute Force Method

Lecture 3 Sections 2.2, 4.4. Mon, Aug 31, 2009

Texture Mapping. Texture Mapping. Map textures to surfaces. Trompe L Oeil ( Deceive the Eye ) The texture. Texture map

Computer Graphics Fundamentals. Jon Macey

The Graphics Pipeline

Mattan Erez. The University of Texas at Austin

Practical Texturing (WebGL) CS559 Fall 2016 Lecture 20 November 7th 2016

Discrete Techniques. 11 th Week, Define a buffer by its spatial resolution (n m) and its depth (or precision) k, the number of

Total Orders. Lecture 41 Section 8.5. Robb T. Koether. Hampden-Sydney College. Mon, Apr 8, 2013

The Traveling Salesman Problem Nearest-Neighbor Algorithm

Density Curves Sections

+ = Texturing: Glue n-dimensional images onto geometrical objects. Texturing. Texture magnification. Texture coordinates. Bilinear interpolation

The Class Construct Part 1

Recursive Sequences. Lecture 24 Section 5.6. Robb T. Koether. Hampden-Sydney College. Wed, Feb 27, 2013

The CYK Parsing Algorithm

Grafica Computazionale

521493S Computer Graphics. Exercise 3

Lecture 5 3D graphics part 3

Texture Mapping II. Light maps Environment Maps Projective Textures Bump Maps Displacement Maps Solid Textures Mipmaps Shadows 1. 7.

CS 431/636 Advanced Rendering Techniques

Scope and Parameter Passing

Textures. Texture coordinates. Introduce one more component to geometry

Solving Recursive Sequences by Iteration

Texture Mapping and Sampling

Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

Recursive Linked Lists

11494 Interactive and GPU Computing Lab. 6-06/05/2015. Textures

Boxplots. Lecture 17 Section Robb T. Koether. Hampden-Sydney College. Wed, Feb 10, 2010

Soft shadows. Steve Marschner Cornell University CS 569 Spring 2008, 21 February

Abstract Data Types. Lecture 23 Section 7.1. Robb T. Koether. Hampden-Sydney College. Wed, Oct 24, 2012

Inheritance: The Fundamental Functions

Sampling, Aliasing, & Mipmaps

The Plurality-with-Elimination Method

Street-Routing Problems

Sampling, Aliasing, & Mipmaps

The Critical-Path Algorithm

Boolean Expressions. Lecture 31 Sections 6.6, 6.7. Robb T. Koether. Hampden-Sydney College. Wed, Apr 8, 2015

LR Parsing - Conflicts

Transcription:

Lecture 23 Subsection 8.8.2 Hampden-Sydney College Fri, Oct 30, 2009

Outline 1 2 3 4 5 dumay.info

Outline 1 2 3 4 5 dumay.info

Suppose we are drawing a 2-dimensional black-and-white checkerboard pattern. Suppose that the surface is close enough to the camera and oriented just right that each texel matches exactly one pixel. dumay.info

Consider one row of pixels and texels, where the pixels and texels are the same size. dumay.info

Using the nearest texel, the pixels will be colored alternately black and white.

Using the nearest texel, the pixels will be colored alternately black and white.

What if the texels were somewhat smaller than the pixels?

What if the texels were somewhat smaller than the pixels?

What if the texels were somewhat smaller than the pixels?

What if the texels are almost half the size of the pixels?

What if the texels are almost half the size of the pixels?

Uh oh.

What will happen when the texels are exactly half the width of a pixel? Exactly one fourth? Exactly one third?

Outline 1 2 3 4 5

Definition (Mipmap) A mipmap is a reduced copy of a texture, with the colors averaged. mip = multum in parvo = many things in a small place. Rather than use the nearest texels or the average of the four texels that happen to be nearest to the pixel, we can create smaller and smaller copies of the entire texture and use their texels.

If the original texture is 64 64, then we should create copies at the scales of 32 32, 16 16, 8 8, 4 4, 2 2, and 1 1. If the original texture is 64 16, then we should create copies at the scales of 32 8, 16 4, 8 2, 4 1, 2 1, and 1 1.

Mipmap Levels The original texture is level 0. The next level is level 1. And so on.

Level 0 Mipmap - 64 64 One texel

Level 1 Mipmap - 32 32 One texel

Level 2 Mipmap - 16 16 One texel

Level 3 Mipmap - 8 8 One texel

Level 4 Mipmap - 4 4 One texel

Level 5 Mipmap - 2 2 One texel

Level 6 Mipmap - 1 1 One texel

Level 0 Mipmap - 64 64 One texel

Level 0 Mipmap - 64 64 One texel

Level 1 Mipmap - 32 32 One texel

Level 2 Mipmap - 16 16 One texel

Level 3 Mipmap - 8 8 One texel

Level 4 Mipmap - 4 4 One texel

Level 5 Mipmap - 2 2 One texel

Level 6 Mipmap - 1 1 One texel

Outline 1 2 3 4 5

are implemented using the same function glteximage2d() that we used to set the original texture. The second parameter is the level.

Example () The code. The executable.

Close-up of Level 0

Close-up of Level 1

Close-up of Level 2

Close-up of Level 3

Close-up of Levels 4, 5, and 6

Using When using mipmaps, we have two separate choices. Whether to use the nearest texel in a mipmap or to interpolate among the 4 nearest texels. Whether to use the nearest mipmap or to interpolate the two nearest mipmaps.

Using Thus, the combinations of choices are Nearest texel and nearest mipmap Nearest texel and interpolate mipmaps Interpolate texels and nearest mipmap Interpolate texels and interpolate mipmaps Which is the most expensive? Which gives the best results?

Outline 1 2 3 4 5

Between Assume that a single color has been selected from each of the two nearest mipmaps (from either the nearest texel or an average of texels). Compute the scale factor r the level 0 (original) mipmap and the polygon. Then compute λ = log 2 r.

Between The value of λ tells us which mipmap to use. If λ = 0, use level 0. If λ = 1, use level 1. If λ = 2, use level 2, etc. What if λ = 1.5? Then we interpolate level 1 and level 2. Different scale factors may be used for different regions of a single polygon.

Example Suppose λ = 1.3 and the level 1 mipmap color is yellow (1, 1, 0) and the level 2 mipmap color is cyan (0, 1, 1). Then the interpolated color is 0.7(1, 1, 0) + 0.3(0, 1, 1) = (0.7, 1.0, 0.3).

Trilinear Interpolation If we interpolate bilinearly within mipmaps and then interpolate those values mipmaps, we get trilinear interpolation.

Trilinear Interpolation How many individual interpolations are required?

Trilinear Interpolation 0.20 0.80 0.20 0.80 Four in the s direction.

Trilinear Interpolation 0.20 0.80 0.20 0.80 Four in the s direction.

Trilinear Interpolation 0.60 0.60 0.40 0.40 Two more in the t direction.

Trilinear Interpolation 0.60 0.60 0.40 0.40 Two more in the t direction.

Trilinear Interpolation 0.40 0.60 One more the mipmap levels.

Trilinear Interpolation 0.40 0.60 One more the mipmap levels.

Trilinear Interpolation A total of 7 interpolations are required.

Use the gltexparameter*() function to set the method of applying mipmap filters. gltexparameteri(gl_texture_2d, filter, method); The third parameter is one of GL_NEAREST_MIPMAP_NEAREST GL_NEAREST_MIPMAP_LINEAR GL_LINEAR_MIPMAP_NEAREST GL_LINEAR_MIPMAP_LINEAR

Mipmap Example Example () The code. The executable.

Generated OpenGL is capable of generating the mipmaps, given the original texture. This is very handy when the original texture is read from a bitmap file. Use the function glubuild2d(). glubuild2d(gl_texture_2d, GL_RGB, width, height, GL_RGB, GL_UNSIGNED_BYTE, image data);

Generated Example (Generated ) The code. The executable.

Outline 1 2 3 4 5

Homework Homework Read Subsection 8.8.2 mipmaps.