CSE 781 Anti-aliasing for Texture Mapping. Quality considerations So far we just mapped one point – results in bad aliasing (resampling problems) We really.

Slides:



Advertisements
Similar presentations
Advanced Computer Graphics CSE 190 [Spring 2015], Lecture 4 Ravi Ramamoorthi
Advertisements

03/16/2009Dinesh Manocha, COMP770 Texturing Surface’s texture: its look & feel Graphics: a process that takes a surface and modifies its appearance using.
Texture Mapping. Texturing  process that modifies the appearance of each point on a surface using an image or function  any aspect of appearance can.
Week 7 - Monday.  What did we talk about last time?  Specular shading  Aliasing and antialiasing.
David Luebke1/19/99 CS 551/651: Antialiasing David Luebke
Ted Adelson’s checkerboard illusion. Motion illusion, rotating snakes.
Anti-Aliasing Jian Huang, CS594, Fall 2008 This set of slides references our text book and the slides used at Ohio State by Prof. Roger Crawfis.
Real-Time Rendering TEXTURING Lecture 02 Marina Gavrilova.
Week 7 - Wednesday.  What did we talk about last time?  Transparency  Gamma correction  Started texturing.
Computer Graphics Visible Surface Determination. Goal of Visible Surface Determination To draw only the surfaces (triangles) that are visible, given a.
Computational Photography CSE 590 Tamara Berg Filtering & Pyramids.
Sampling, Aliasing, & Mipmaps
Advanced Computer Graphics (Spring 2006) COMS 4162, Lecture 5: Image Processing 2: Warping Ravi Ramamoorthi
Advanced Computer Graphics (Spring 2005) COMS 4162, Lecture 5: Image Processing 2: Warping Ravi Ramamoorthi
16 MULTIPLE INTEGRALS.
Advanced Texture Mapping May 10, Today’s Topics Mip Mapping Projective Texture Shadow Map.
Computer Graphics Inf4/MSc Computer Graphics Lecture 11 Texture Mapping.
© Chun-Fa Chang Sampling Theorem & Antialiasing. © Chun-Fa Chang Motivations “ My ray traced images have a lot more pixels than the TV screen. Why do.
1 Computer Graphics Week13 –Shading Models. Shading Models Flat Shading Model: In this technique, each surface is assumed to have one normal vector (usually.
CS 376b Introduction to Computer Vision 02 / 26 / 2008 Instructor: Michael Eckmann.
David Luebke 1 9/4/2015 CS 551/651: Advanced Computer Graphics Antialiasing Continued: Prefiltering and Supersampling.
Computer Graphics Inf4/MSc Computer Graphics Lecture 9 Antialiasing, Texture Mapping.
COMP 175: Computer Graphics March 24, 2015
Review 2: Illumination, Shading, Texturing and Anti-aliasing
Mitsubishi Electric Research Laboratory Feline: Fast, Elliptical Lines for Anisotropic Texture Mapping Joel McCormack, Ronald.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Texture Mapping 고려대학교 컴퓨터 그래픽스 연구실.
COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 1 Shading (Shading) & Smooth Shading Graphics.
UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS Textures.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
1 Lesson 8: Basic Monte Carlo integration We begin the 2 nd phase of our course: Study of general mathematics of MC We begin the 2 nd phase of our course:
Parallel Algorithms Patrick Cozzi University of Pennsylvania CIS Spring 2012.
CHAPTER 8 Color and Texture Mapping © 2008 Cengage Learning EMEA.
CS418 Computer Graphics John C. Hart
Lecture Fall 2001 From S. Zeki, Inner Vision.
Antialiasing Miniaturized Textures
CSC508 Convolution Operators. CSC508 Convolution Arguably the most fundamental operation of computer vision It’s a neighborhood operator –Similar to the.
CS 325 Introduction to Computer Graphics 04 / 12 / 2010 Instructor: Michael Eckmann.
Sampling Pixel is an area!! – Square, Rectangular, or Circular? How do we approximate the area? – Why bother? Color of one pixel Image Plane Areas represented.
Krivljenje slike - warping. Princip 2D krivljenja Demo.
CSCI 440.  So far we have learned how to  build shapes  create movement  change views  add simple lights  But, our objects still look very cartoonish.
: Chapter 5: Image Filtering 1 Montri Karnjanadecha ac.th/~montri Image Processing.
Instructor: Mircea Nicolescu Lecture 5 CS 485 / 685 Computer Vision.
Projects Project 1a due this Friday Project 1b will go out on Friday to be done in pairs start looking for a partner now.
David Luebke 3/17/2016 Advanced Computer Graphics Antialiasing David Luebke
Greg Humphreys CS445: Intro Graphics University of Virginia, Fall 2003 Texture Mapping Greg Humphreys University of Virginia CS 445, Fall 2003.
IS502:M ULTIMEDIA D ESIGN FOR I NFORMATION S YSTEM D IGITAL S TILL I MAGES Presenter Name: Mahmood A.Moneim Supervised By: Prof. Hesham A.Hefny Winter.
Texturing Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
Antialiasing. What is alias? Alias - A false signal in telecommunication links from beats between signal frequency and sampling frequency (from dictionary.com)
IS502:M ULTIMEDIA D ESIGN FOR I NFORMATION S YSTEM D IGITAL S TILL I MAGES Presenter Name: Mahmood A.Moneim Supervised By: Prof. Hesham A.Hefny Winter.
Week 7 - Wednesday CS361.
Texture Mapping cgvr.korea.ac.kr.
ATCM 3310 Procedural Animation
Sampling Theorem & Antialiasing
Anti-aliasing for Texture Mapping
Digital Media Dr. Jim Rowan ITEC 2110.
More Image Manipulation
Image Processing Today’s readings For Monday
Mipmaps Lecture 16 Mon, Oct 1, 2007.
Linear filtering.
Procedural Animation Lecture 6: Mapping
ATCM 6317 Procedural Animation
Anti-Aliasing Jian Huang, CS594, Fall 2003
Patrick Cozzi University of Pennsylvania CIS Spring 2011
Resampling.
Patrick Cozzi University of Pennsylvania CIS Spring 2011
Filtering Images Work in the spatial domain
Texture mapping - other methods
Mipmaps Lecture 13 Wed, Oct 12, 2005.
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Presentation transcript:

CSE 781 Anti-aliasing for Texture Mapping

Quality considerations So far we just mapped one point – results in bad aliasing (resampling problems) We really need to integrate over polygon Super-sampling is not a very good solution – Dependent on area of integration. – Can be quit large for texture maps. Most popular (easiest) - mipmaps

Quality considerations Pixel area maps to “weird” (warped) shape in texture space pixel u v xsxs ysys

Quality Considerations We need to: – Calculate (or approximate) the integral of the texture function under this area – Approximate: Convolve with a wide filter around the center of this area Calculate the integral for a similar (but simpler) area.

Quality Considerations The area is typically approximated by a rectangular region (found to be good enough for most applications) Filter is typically a box/averaging filter - other possibilities How can we pre-compute this?

Mip-maps Mipmapping was invented in 1983 by Lance Williams – Multi in parvo “many things in a small place”

Mip-maps An image-pyramid is built. 256 pixels Note: This only requires an additional 1/3 amount of texture memory: 1/4 + 1/16 + 1/64 +…

Mip-maps Find level of the mip-map where the area of each mip-map pixel is closest to the area of the mapped pixel. pixel u v xsxs ysys 2 i x2 i pixel level selected

Mip-maps Mip-maps are thus indexed by u, v, and the level, or amount of compression, d. The compression amount, d, will change according to the compression of the texels to the pixels, and for mip-maps can be approximated by: – d = sqrt( Area of pixel in uv-space ) – The sqrt is due to the assumption of uniform compression in mip-maps.

Review: Polygon Area Recall how to calculate the area of a 2D polygon (in this case, the quadrilateral of the mapped pixel corners). A =

Mip-maps William’s algorithm – Take the difference between neighboring u and v coordinates to approximate derivatives across a screen step in x or y – Derive a mipmap level from them by taking the maximum distortion Over-blurring

Mip-maps The texel location can be determined to be either: 1. The uv-mapping of the pixel center. 2.The average u and v values from the projected pixel corners (the centroid). 3.The diagonal crossing of the projected quadrilateral. However, there are only so many mip-map centers

Mip-maps Pros – Easy to calculate: Calculate pixels area in texture space Determine mip-map level Sample or interpolate to get color Cons – Area not very close – restricted to square shapes (64x64 is far away from 128x128). – Location of area is not very tight - shifted.

Note on Alpha Alpha can be averaged just like rgb for texels Watch out for borders though if you interpolate

Specifying Mip-map levels OpenGL allows you to specify each level individually (see glTexImage2D function). The GLU routine gluBuild2Dmipmaps() routine offers an easy interface to averaging the original image down into its mip-map levels. You can (and probably should) recalculate the texture for each level. Warning: By default, the filtering assumes mip- mapping. If you do not specify all of the mip-map levels, your image will probably be black.

Higher-levels of the Mip-map Two considerations should be made in the construction of the higher-levels of the mip- map. 1.Filtering – simple averaging using a box filter, apply a better low-pass filter. 2.Gamma correction – by taking into account the perceived brightness, you can maintain a more consistent effect as the object moves further away.

Anisotropic Filtering A pixel may rarely project onto texture space affinely. There may be large distortions in one direction. isotropic

Anisotropic Filtering Multiple mip-maps or Ripmaps Summed Area Tables (SAT) Multi-sampling for anisotropic texture filtering. EWA filter

Ripmaps Scale by half by x across a row. Scale by half in y going down a column. The diagonal has the equivalent mip-map. Four times the amount of storage is required.

Ripmaps To use a ripmap, we use the pixel’s extents to determine the appropriate compression ratios. This gives us the four neighboring maps from which to sample and interpolate from.

Ripmaps Compression in u is 1.7 Compression in v is 6.8 Determine weights from each sample pixel

Summed Area Table (SAT) Use an axis aligned rectangle, rather than a square Pre-compute the sum of all texels to the left and below for each texel location – For texel (u,v), replace it with: sum (texels(i=0…u,j=0…v))

Summed Area Table (SAT) Determining the rectangle: – Find bounding box and calculate its aspect ratio pixel u v xsxs ysys

Summed Area Table (SAT) Determine the rectangle with the same aspect ratio as the bounding box and the same area as the pixel mapping. pixel u v xsxs ysys

Summed Area Table (SAT) Center this rectangle around the bounding box center. Formula: Area = aspect_ratio*x*x Solve for x – the width of the rectangle Other derivations are also possible using the aspects of the diagonals, …

Summed Area Table (SAT) Calculating the color – We want the average of the texel colors within this rectangle u v (u3,v3) (u2,v2) (u1,v1) (u4,v4)

Summed Area Table (SAT) To get the average, we need to divide by the number of texels falling in the rectangle. – Color = SAT(u3,v3)-SAT(u4,v4)-SAT(u2,v2)+SAT(u1,v1) – Color = Color / ( (u3-u1)*(v3-v1) ) This implies that the values for each texel may be very large: – For 8-bit colors, we could have a maximum SAT value of 255*nx*ny – 32-bit integers would handle a 4kx4k texture with 8-bit values. – RGB images imply 12-bytes per pixel.

Summed Area Table (SAT) Pros – Still relatively simple Calculate four corners of rectangle 4 look-ups, 5 additions, 1 multiply and 1 divide. – Better fit to area shape – Better overlap Cons – Large texel SAT values needed. – Still not a perfect fit to the mapped pixel. – The divide is expensive in hardware.

Anisotropic Mip-mapping Uses parallel hardware to obtain multiple mip- map samples for a fragment. A lower-level (higher-res level) of the mip-map is used. Calculate d as the minimum length, rather than the maximum.

Anisotropic Mip-mapping

Elliptical Weighted Average (EWA) Filter Treat each pixel as circular, rather than square. Mapping of a circle is elliptical in texel space. pixel u v xsxs ysys The gold standard. Used to compare all other techniques against.

EWA Filter Precompute? Can use a better filter than a box filter. Heckbert chooses a Gaussian filter.

EWA Filter Calculating the Ellipse Scan converting the Ellipse Determining the final color (normalizing the value or dividing by the weighted area).

EWA Filter Calculating the ellipse – We have a circular function defined in (x,y). – Filtering that in texture space h(u,v). – (u,v) = T(x,y) – Filter: h(T(x,y))

EWA Filter Ellipse: –  (u,v) = Au 2 + Buv + Cv 2 = F – (u,v) = (0,0) at center of the ellipse A = v x 2 +v y 2 B = -2(u x v y + u y v x ) C = u x 2 +u y 2 F = u x v y + u y v x

EWA Filter Scan converting the ellipse: – Determine the bounding box – Scan convert the pixels within it, calculating  (u,v). – If  (u,v) < F, weight the underlying texture value by the filter kernel and add to the sum. – Also, sum up the filter kernel values within the ellipse.

EWA Filter Determining the final color – Divide the weighted sum of texture values by the sum of the filter weights.

EWA Filter What about large areas? – If m pixels fall within the bounding box of the ellipse, then we have O(n 2 m) algorithm for an nxn image. – m maybe rather large. We can apply this on a mip-map pyramid,rather than the full detailed image. – Tighter-fit of the mapped pixel – Cross between a box filter and gaussian filter. – Constant complexity - O(n 2 )