Docsity

Slides on Texture Aliasing - Interactive Computer Graphics | CS 418, Study notes of Computer Graphics

Toggle sidebar
bg1
Texture Aliasing
Recall the simple texture application method we discussed
• at each pixel we interpolate the correct texture coordinate
• and we retrieve the corresponding texel
• can lead to nasty aliasing
Why is this?
Consider mapping of pixel to texture
• may be mapped to several (fractional) texels
• but we’re only selecting one of them to use in the pixel
• this kind of point sampling results in aliasing
Pixel Texture
Texture Antialiasing
The antidote is to average (filter) all covered texels together
• need to choose appropriate averaging method
Removes objectionable artifacts
• but it’s not magic
• very high frequency details just
get smoothed over completely
(e.g., gray on horizon)
Unfortunately, there’s a significant drawback here
• averaging covered texels can be very expensive
• for every pixel, might have to visit O(n) texels
• this would really hurt rendering performance
Texture Antialiasing
For efficiency, we can use an image pyramid (mip–map)
• base of pyramid is the original image (level = 0)
• level 1 is the image down-sampled by a factor of 2
• level 2 is down-sampled by a factor of 4, and so on
• requires that original dimensions be a power of 2
• and it’s not too big: 4/3 the size of the original image
256x256 128x128 64x64 32x32
Antialiasing with Image Pyramids
Image pyramids let us efficiently average large regions
• each texel in upper levels covers many base texels
– at level kthey are the average of 2kx2ktexels
• can quickly assemble appropriate texels for averaging
Fortunately, OpenGL can take care of most details
• gluBuild2DMipmaps() — automatically generate
pyramid from base image
• control behavior with glTexParameter()
• OpenGL handles all filtering details during rasterization
pf3
pf4

Partial preview of the text

Download Slides on Texture Aliasing - Interactive Computer Graphics | CS 418 and more Study notes Computer Graphics in PDF only on Docsity!

Texture Aliasing Recall the simple texture application method we discussed

  • at each pixel we interpolate the correct texture coordinate• and we retrieve the corresponding texel• can lead to nasty aliasing

Why is this?Consider mapping of pixel to texture

  • may be mapped to several (fractional) texels• but we’re only selecting one of them to use in the pixel• this kind of point sampling results in aliasing

Pixel

Texture

Texture Antialiasing The antidote is to average (filter) all covered texels together

  • need to choose appropriate averaging method

Removes objectionable artifacts

  • but it’s not magic• very high frequency details just

get smoothed over completely(e.g., gray on horizon)

Unfortunately, there’s a significant drawback here

  • averaging covered texels can be very expensive• for every pixel, might have to visit

O

n

) texels

  • this would really hurt rendering performance

Texture Antialiasing For efficiency, we can use an image pyramid (mip–map)

  • base of pyramid is the original image (level = 0)• level 1 is the image down-sampled by a factor of 2• level 2 is down-sampled by a factor of 4, and so on• requires that original dimensions be a power of 2• and it’s not too big: 4/3 the size of the original image

256x

128x

64x

32x

Antialiasing with Image Pyramids Image pyramids let us efficiently average large regions

  • each texel in upper levels covers many base texels
    • at level

k

they are the average of

2

k

x

2

k

texels

  • can quickly assemble appropriate texels for averaging

Fortunately, OpenGL can take care of most details

  • gluBuild2DMipmaps() — automatically generate

pyramid from base image

  • control behavior with glTexParameter()• OpenGL handles all filtering details during rasterization

Mapping More than Color Basic texture mapping applies colors to surfaces

  • but the method is much more general than this• can be used to map wide range of data onto surfaces• although not necessarily supported by OpenGL

We’ll look at a couple of examples today

  • bump mapping• normal mapping• displacement mapping

Bump Mapping This is a method of playing a dirty trick on the human viewer

  • perception of shape is determined by shading• which is determined by surface normal

We want to add surface texture to an object

  • start with a smooth surface (with few polygons)• interpret the 3 channels of each texel as a vector• use this vector to perturb the surface normal

This is

not

directly supported by OpenGL

P

N

original normal

from bump map

n

n

n

Bump Mapping Here are 3 geometric spheres, with bump mapping

  • note the tell-tale sign of bump mapping• “rough” surfaces with perfectly smooth silhouettes

Variations/Relatives of Bump Mapping Normal mapping

  • interpret each texel as a normal vector (rather than offset)• essentially a hard-coded bump map

Displacement mapping

  • interpret texels as offset vectors and apply to

surface position

  • unlike bump mapping, this actually modifies the geometry

Not All Images Are Photos Photorealism is the traditional goal of computer graphics

  • try to reproduce reality• essentially, synthesize “photographs” of virtual scenes

But what if we don’t want things to look completely realistic?

  • cartoons, watercolors, impressionist paintings

Just at with animation, don’t want to slavishly imitate nature

  • cartoon physics is not real physics• cartoon appearance not necessarily based on light transport

Humans like artistic freedom and expressiveness

  • may be artistic or usability reasons to forgo photorealism• may want to create unique look-and-feel (e.g., Disney)

Non-Photorealistic Lighting Models

Standard OpenGL lighting

(Phong model)

A Non-Photorealistic Lighting Model For Automatic Technical Illustration. Gooch, Gooch, Shirley, and Cohen. SIGGRAPH 98.

Non-photorealistic Lighting Model

(with silhouette outlines)

Texture Shading: Gooch

et al

Shade model with a linear blend of “warm” and “cool” colors

  • cool/warm are blue/yellow

mixed with surface color

cool

warm

I

k

k

L n

L n

cool

blue

d

blue

warm

yellow

d

yellow

k

k

k

k

b

k

k

k

k

y y

α

β

.

.

.

.

b

y

α

β

= 0 4

= 0 4

= 0 2

= 0 6