Cs 551 645 introductory computer graphics
Download
1 / 27

CS 551 / 645: Introductory Computer Graphics - PowerPoint PPT Presentation


  • 64 Views
  • Uploaded on

CS 551 / 645: Introductory Computer Graphics. David Luebke [email protected] http://www.cs.virginia.edu/~cs551. Administrivia. Next semester: Intro Graphics again Look for Brogan’s animation seminar. Recap: Texture Mapping.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' CS 551 / 645: Introductory Computer Graphics' - wolfe


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Cs 551 645 introductory computer graphics

CS 551 / 645: Introductory Computer Graphics

David Luebke

[email protected]

http://www.cs.virginia.edu/~cs551

David Luebke 8/20/2014


Administrivia
Administrivia

  • Next semester: Intro Graphics again

    • Look for Brogan’s animation seminar

David Luebke 8/20/2014


Recap texture mapping
Recap: Texture Mapping

  • Problem: it is impractical to explicitly model fine surface detail with geometry

  • Solution: use images to capture the “texture” of surfaces

David Luebke 8/20/2014



Recap texture coordinates
Recap: Texture Coordinates

  • Give each vertex of the triangle a texture coordinate(u, v)

  • For other points on the triangle, interpolate texture coordinate from the vertices

  • Problem: interpolating u & v in screen-space (a la Gouraud shading) is incorrect

    • Instead, interpolate uw, vw, and w, and calculate uw/w and vw/w for each pixel

    • Known as perspective-correcttexture mapping

David Luebke 8/20/2014


Recap texture map aliasing
Recap: Texture Map Aliasing

  • Naïve texturing looks blocky and pixelated

    • Problem: using only one texel to color each pixel

    • Actually, each pixel maps to a region in texture

      • Pixel is smaller than a texel, we should interpolate between texel values somehow

      • Pixel is larger than a texel, we should average the contribution from multiple texels somehow

      • Even if pixel size  texel size, a pixel will in general fall between four texels

    • An example of a general problem called aliasing

David Luebke 8/20/2014


Texture map antialiasing
Texture Map Antialiasing

  • Use bilinear interpolation to average nearby texel values into a single pixel value

    • Find 4 nearest texels

      • Round u & v up and down

    • Interpolate texel values in u

      •  = u - u

      • A = (1-)T4 + T1, B = (1-)T3 + T2

    • Interpolate resulting values in v

      •  = v - v

      • P = (1- )A + B

    • Also addresses the problem of many pixels projecting to a single texel (oversampling)

T1

T2

A

P

B

T4

T3

David Luebke 8/20/2014


Texture map antialiasing1
Texture Map Antialiasing

  • What about undersampling, when a single pixel covers many texels?

    • Problem: sampling those texels at a single point

      • Produces Moire patterns in coherent texture (checkers)

      • Leads to flicker or texture crawling as the texture moves

    • Approach: blur the image under the pixel, averaging the contributions of the covered texels

      • But calculating which texels each pixel covers is expensive, especially as the texture is very compressed

    • Solution: pre-calculate lower-resolution versions of the texture that incorporate this averaging

David Luebke 8/20/2014


Mip maps

Original Texture

Lower Resolution Versions

MIP-maps

  • For a texture of 2n x 2n pixels, compute n-1 textures, each at ½ the resolution of previous:

  • This multiresolution texture is called a MIP-map

David Luebke 8/20/2014


Generating mip maps
Generating MIP-maps

  • Generating a MIP-map from a texture is easy

    • For each texel in level i, average the values of the four corresponding texels in level i-1

  • If a texture requires n bytes of storage, how much storage will a MIP-map require?

  • Answer: 4n/3

David Luebke 8/20/2014


Representing mip maps

R

G

R

G

B

R

G

B

R

G

B

B

Representing MIP-maps

Trivia: MIP = Multim In Parvo(many things in a small place)

David Luebke 8/20/2014


Using mip maps
Using MIP-maps

  • Each level of the MIP-map represents a pre-blurred version of multiple texels

    • A texel at level n represents 2n original texels

  • When rendering:

    • Figure out the texture coverage of the pixel (i.e., the size of the pixel in texels of the original map)

    • Find the level of the MIP map in which texels average approximately that many original texels

    • Interpolate the value of the four nearest texels

David Luebke 8/20/2014


Using mip maps1
Using MIP-maps

  • Even better:

    • Likely, the coverage of the pixel will fall somewhere between the coverage of texels in two adjacent levels of the MIP map

    • Find the pixel’s value in each of the two textures using two bilinear interpolations

    • Using a third interpolation, find a value in between these two values, based on the coverage of the pixel versus each of the MIP-map levels

    • This is (misleadingly?) called trilinear interpolation

David Luebke 8/20/2014


Using mip maps2
Using MIP-maps

  • How many interpolations does a texture lookup using trilinear interpolation in a MIP-mapped texture involve?

  • How many texel values from the MIP-map must be fetched for such a lookup?

David Luebke 8/20/2014


Mip map example
MIP-map Example

  • No filtering:

  • MIP-map texturing:

David Luebke 8/20/2014


Can we do better
Can We Do Better?

  • What assumption does MIP-mapping implicitly make?

  • A: The pixel covers a square region of the texture

    • More exactly, the compression or oversampling rate is the same in uandv

  • Is this a valid assumption? Why or why not?

David Luebke 8/20/2014


Mip maps and signal processing
MIP-maps and Signal Processing

  • An aside: aliasing and antialiasing are properly topics in sampling theory

    • Nyquist theorem, convolution and reconstruction, filters and filter widths

    • Textures are particularly difficult because a tiled texture can easily generate infinite frequencies

      • E.g., a checkered plane receding to an infinite horizon

    • Using a MIP-map amounts to prefiltering the texture image to reduce artifacts caused by sampling at too low a rate

David Luebke 8/20/2014


Summed area tables
Summed-Area Tables

  • A technique called summed-area tableslets us integrate texels covered by the pixel more exactly (but still quickly)

    • Details in the book

  • Example:

MIP-map texturing

Summed-area table texturing

David Luebke 8/20/2014


Texture mapping variations
Texture Mapping Variations

  • A texture can modulate any parameter in the rendering process:

Texture asdiffuse lightingcoefficients:

Texture asR,G,B:

David Luebke 8/20/2014


Bump mapping
Bump Mapping

  • The texture map can even modulate the surface normal used for shading

Sphere w/ diffuse textureand swirly bump map

Sphere w/ diffuse texture

Swirly bump map

David Luebke 8/20/2014


More bump mapping
More Bump Mapping

  • How can you tell a bumped-mapped object from an object in which the geometry is explicitly modeled?

+

=


Last bump mapping example
Last Bump Mapping Example

David Luebke 8/20/2014


Displacement map
Displacement Map

  • A displacement map actually displaces the geometry

    • Treats the texture as a height field to be applied to the surface

    • Hard to do in interactive graphics pipeline

    • But doable in ray tracing

David Luebke 8/20/2014


Displacement map example
Displacement Map Example

  • What is the fundamental difference between displacement mapping and bump mapping?

David Luebke 8/20/2014


Illumination maps
Illumination Maps

  • Quake uses illumination mapsor light maps to capture lighting effects:

Texture map:

Light map

Texture map+ light map:

David Luebke 8/20/2014


Illumination maps1
Illumination Maps

  • Illumination maps differ from texture maps in that they:

    • Usually apply to only a single surface

    • Are usually fairly low resolution

    • Usually capture just intensity (1 value) rather than color (3 values)

  • Illumination maps can be:

    • Painted by hand: Disney’s Aladdin ride

    • Calculated by a global illumination process: Nintendo64 demo

  • Origin of the idea

David Luebke 8/20/2014


Other texture applications
Other Texture Applications

  • Lots of other interesting applications of the texture-map concept:

    • Shadow maps

    • 3-D textures (marble, wood, clouds)

    • Chrome maps

    • Procedural textures

  • For a neat explanation of the first two (with cool applets, as usual) check out:

    http://graphics.lcs.mit.edu/classes/6.837/F98/Lecture22/Slide21.html

David Luebke 8/20/2014


ad