Antialiasing Miniaturized Textures

Slides:



Advertisements
Similar presentations
Technische Universität München Fakultät für Informatik Computer Graphics SS 2014 Sampling Rüdiger Westermann Lehrstuhl für Computer Graphik und Visualisierung.
Advertisements

CSE 781 Anti-aliasing for Texture Mapping. Quality considerations So far we just mapped one point – results in bad aliasing (resampling problems) We really.
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.
Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.
David Luebke1/19/99 CS 551/651: Antialiasing David Luebke
MIT EECS 6.837, Durand and Cutler Sampling, Aliasing, & Mipmaps.
Real-Time Rendering TEXTURING Lecture 02 Marina Gavrilova.
ATEC Procedural Animation Introduction to Procedural Methods in 3D Computer Animation Dr. Midori Kitagawa.
Week 7 - Wednesday.  What did we talk about last time?  Transparency  Gamma correction  Started texturing.
Computer Graphics Inf4/MSc Computer Graphics Lecture 13 Illumination I – Local Models.
CS 551 / CS 645 Antialiasing. What is a pixel? A pixel is not… –A box –A disk –A teeny tiny little light A pixel is a point –It has no dimension –It occupies.
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
Sampling, Aliasing, & Mipmaps
CSCE 641 Computer Graphics: Image Sampling and Reconstruction Jinxiang Chai.
CSCE 641 Computer Graphics: Image Sampling and Reconstruction Jinxiang Chai.
(conventional Cartesian reference system)
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
Computer Graphics Inf4/MSc Computer Graphics Lecture 11 Texture Mapping.
CSC418 Computer Graphics n Aliasing n Texture mapping.
Erdem Alpay Ala Nawaiseh. Why Shadows? Real world has shadows More control of the game’s feel  dramatic effects  spooky effects Without shadows the.
1 Texturing. 2 What is Texturing? 3 Texture Mapping Definition: mapping a function onto a surface; function can be:  1, 2, or 3D  sampled (image) or.
Filtering theory: Battling Aliasing with Antialiasing Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
© 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.
Computer Graphics Inf4/MSc Computer Graphics Lecture 9 Antialiasing, Texture Mapping.
Computer Graphics Inf4/MSc Computer Graphics Lecture 7 Texture Mapping, Bump-mapping, Transparency.
COMP 175: Computer Graphics March 24, 2015
Image Formation. Input - Digital Images Intensity Images – encoding of light intensity Range Images – encoding of shape and distance They are both a 2-D.
Antialiasing CAP4730: Computational Structures in Computer Graphics.
3/4/04© University of Wisconsin, CS559 Spring 2004 Last Time Clipping Lines –Cohen-Sutherland: The use of outcodes and early reject/accept tests –Liang-Barsky:
Computer Graphics Texture Mapping
11/11/04© University of Wisconsin, CS559 Fall 2004 Last Time Shading Interpolation Texture mapping –Barycentric coordinates for triangles.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Texture Mapping 고려대학교 컴퓨터 그래픽스 연구실.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
09/11/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Graphics Pipeline Texturing Overview Cubic Environment Mapping.
1 Rendering Geometry with Relief Textures L.Baboud X.Décoret ARTIS-GRAVIR/IMAG-INRIA.
CS 450: COMPUTER GRAPHICS ANTIALIASING SPRING 2015 DR. MICHAEL J. REALE.
1 Texture Mapping. 2 Texture Aliasing MIPmaps Environment Mapping Bump Mapping Displacement Mapping Shadow Maps Solid Textures Antialiasing.
CHAPTER 8 Color and Texture Mapping © 2008 Cengage Learning EMEA.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
CS418 Computer Graphics John C. Hart
Vector Graphics Digital Multimedia Chap 이병희
Lecture Fall 2001 From S. Zeki, Inner Vision.
Computer Graphics Rendering 2D Geometry CO2409 Computer Graphics Week 2.
Duy & Piotr. How to reconstruct a high quality image with the least amount of samples per pixel the least amount of resources And preserving the image.
MIT EECS Sampling, Aliasing, & Mipmaps. MIT EECS Last Time? Global illumination “physically accurate light transport” The rendering equation.
Attributes of Graphics Primitives Hearn & Baker Chapter 4 Some slides are taken from Robert Thomsons notes.
Lecture 6 Rasterisation, Antialiasing, Texture Mapping,
CS 325 Introduction to Computer Graphics 04 / 12 / 2010 Instructor: Michael Eckmann.
CS 450: COMPUTER GRAPHICS TEXTURE MAPPING SPRING 2015 DR. MICHAEL J. REALE.
Real-Time Relief Mapping on Arbitrary Polygonal Surfaces Fabio Policarpo Manuel M. Oliveira Joao L. D. Comba.
Computer Graphics Through OpenGL: From Theory to Experiments, Second Edition Chapter 13.
1 Dr. Scott Schaefer Antialiasing. 2/70 What is aliasing?
Greg Humphreys CS445: Intro Graphics University of Virginia, Fall 2003 Texture Mapping Greg Humphreys University of Virginia CS 445, Fall 2003.
CSc4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Texture Mapping.
Texturing CMSC 435/ What is Texturing? 2 Texture Mapping Definition: mapping a function onto a surface; function can be: – 1, 2, or 3D – sampled.
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)
Attributes of Graphics Primitives Hearn & Baker Chapter 4
Week 7 - Wednesday CS361.
Week 7 - Monday CS361.
Texture Mapping cgvr.korea.ac.kr.
Sampling Theorem & Antialiasing
Anti-aliasing for Texture Mapping
Filtering Images Work in the spatial domain
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
CSC418 Computer Graphics Aliasing Texture mapping.
Presentation transcript:

Antialiasing Miniaturized Textures CSS 552 – Prof. Sung Daniel R. Lewis June 3, 2013

Texels and Pixels (1) Textures are composed of discrete texels: Pixels are projected onto texture: Textured Geometry Eye Image Plane - Projection is both scene- and view-dependent. - Two grids: the texel grid, which is composed of squares containing a color; and the pixel grid, composed of irregular quadrilaterals which need to be assigned a color. Our task is to map between these grids.

Texels and Pixels (2) Image credit: Heckbert

Texture Magnification Image resolution higher than texture resolution Pixel grid “denser” than texel grid - Magnification is a.k.a. upsampling

Texture Minification Image resolution lower than texture resolution Texel grid “denser” than pixel grid Pixel Footprint Texel Grid - Minification is a.k.a. downsampling

Point Sampling Color comes from texel that happens to be at the intersection position Poor representation of pixel area Temporal aliasing e.g. “blinking” At right: How would the pixel coloration change as the camera or geometry moved? Improved by supersampling to a degree—becomes expensive as the texel:pixel ratio increases - a.k.a. nearest neighbor - this is the approach used by our MPs

Aliasing from point sampling Image credit: Angel

Prefiltered Texel Averaging (1b) camera moves back How many? What shape? Reminder: pixel coverage is view- and scene-dependent (1a, 1b) Pixels cover various numbers of texels even within the same frame (2) Cannot know a priori what to average All methods prefilter the texture to generate approximations of all possible pixel footprints (2)

Mipmapping Invented by Lance Williams, seminal paper published in 1983 MIP an acronym for multum in parvo, meaning “many things in a small place” Well-supported in hardware point sampling mipmapping detail Image credit: Williams

Mipmapping: How It Works (1) Start with 2n×2n texture Create n downsampled texture maps, where each map Mi is 25% of the size of map Mi-1 Average four pixels into one How should pixels be “averaged”? Hold that thought... Mipmaps require only 33.3% of the memory of the original texture Image credit: Wikipedia(a) - 21 / 64 = 32.8

Mipmapping: How It Works (2) Pixel color derived from (u, v, d) triple, where d is the level of detail Image credit: Akenine-Moller et al.

Finding d (a) d ∝ || longest_pixel_edge || (b) lpe = || longest_pixel_edge || d = 1 - ( lpe / texture_width ) (b) dx = sqrt((Δu / Δx)2 + (Δv / Δx)2) dy = sqrt((Δu / Δy)2 + (Δv / Δy)2) d ∝ max(dx, dy) e.g.: d = (1 / sqrt(2)) × max(dx, dy, sqrt(2)) Challenge: in ray tracing, all we have is a point–not enough to reconstruct the red quadrilateral or find dx/dy

Using d Derive two maps from d Sample both at (u, v) and interpolate between the samples Common to add/subtract a level of detail bias from d to tweak results. Specified by user.

Filtering Algorithms When downsampling, want to eliminate high frequency information that cannot be reproduced, before it causes aliasing Low-pass filter (LPF) Pixel averaging, a.k.a. box filtering, is a bad LPF Ideal LPF is sinc sin(πx)/(πx) Infinitely wide Approximate sinc by multiplying it by a windowing function and cutting it off Purple: Ideal filter Yellow: Box filter Green: Kaiser filter Blue: Point sampling Image credit: Blow(a)

Brightness and Gamma Correction (1) Human eye is more sensitive to darker shades than brighter ones Linear encoding of color wastes space on bright shades that are indistinguishable Hence, images store color non-linearly, which is then scaled exponentially by γ to become linear Clinear = (Cstore)γ Typically, 1.8 ≤ γ ≤ 2.8

Brightness and Gamma Correction (2) Image credit: Blow(b) Filtering should not reduce brightness (ideally) However: A = tc1γ + tc2γ + tc3γ + tc4γ B = ((tc1 + tc2 + tc3 + tc4) / 4)γ A > B Fixed by converting texel colors to linear space (decode), filter that, and then convert back (encode)

Brightness and Gamma Correction (3) Detail view of mipmapped textures direct filtering linear filtering Image credit: Blow(b)

Achilles’ Heel of Mipmapping Mipmapping weakness: all pixel projections that do not vaguely approximate squares Below: color of pixel (red outline) comes from all shaded texels—mostly error!

Aliasing from mipmapping Image credit: Angel

Ripmapping Extension of mipmapping generating rectangular maps Requires 300% more memory than original texture Rarely used today dv du du dv Image credit: Wikipedia(b)

Summed Area Tables Invented by Frank Crow, seminal paper published in 1984 Based on rectangles like ripmapping, but with a dissimilar algorithm Limited hardware support Top: Point sampling Middle: Mipmapping Bottom: Summed area tables Image credit: Akenine-Moller et al.

Generating the SAT n×m SAT for n×m texture (0,0) (i, j) m n n×m SAT for n×m texture Each slot (i, j) holds the sum of all texels in rectangle between origin (0, 0) and (i, j) Requires more bits per channel (16–32) than original texture color (8) Efficiently computed in a single pass: I(i,j) = tc(i,j) + I(i−1,j) + I(i,j−1) − I(i−1,j−1)

Finding Rectangle Color Rs = I(il,jb) − I(ir,jt) − I(il,jb) + I(il,jt) Ra = Rs / ((ir − il)(jb − jt)) (0,0) il ir jt jb

Finding Rectangle Color Rs = I(il,jb) − I(ir,jt) − I(il,jb) + I(il,jt) Ra = Rs / ((ir − il)(jb − jt)) (0,0) il ir jt jb

Finding Rectangle Color Rs = I(il,jb) − I(ir,jt) − I(il,jb) + I(il,jt) Ra = Rs / ((ir − il)(jb − jt)) (0,0) il ir jt jb

Finding Rectangle Color Rs = I(il,jb) − I(ir,jt) − I(il,jb) + I(il,jt) Ra = Rs / ((ir − il)(jb − jt)) (0,0) il ir jt jb

Finding Rectangle Color Rs = I(il,jb) − I(ir,jt) − I(il,jb) + I(il,jt) Ra = Rs / ((ir − il)(jb − jt)) (0,0) il ir jt jb

Finding the Bounding Box (ua, va) (ub, vb) (uc, vc) (ud, vd) v u umin = min(ua, ub, uc, ud) umax = max(ua, ub, uc, ud) vmin = min(va, vb, vc, vd) vmax = max(va, vb, vc, vd) v u v0 v1 v3 v2 Rectangle: Vertice[0] = (umin, vmin) Vertice[1] = (umin, vmax) Vertice[2] = (umax, vmax) Vertice[3] = (umax, vmin)

Interpolating SAT Rectangles Instead of rounding bounding box vertices to integers, allow the corners to fall between texel boundaries Find color of all boxes at neighboring texels and interpolate between them based on distance

Achilles’ Heel of Ripmapping and SATs Weakness of rectangle-based methods is pixel projections that cut diagonally across the texture Below: color of pixel (red outline) comes from the texels in the shaded bounding box—mostly error!

Unconstrained Anisotropic Filtering Built on top of mipmapping Find (approximate) the major axis of the pixel footprint Sample the mipmap (trilinear interpolation) at least twice along the axis, more if the footprint is long Unlike normal mipmapping, use the length of the shorter side to compute the d value Supported by PC graphics cards since early 2000s

Not Herein Considered... Non-color textures: most of the antialiasing techniques can be extended for textures of other types (e.g., bump maps) Curved surfaces Literal edge cases

Implementation Plan (1) Focus on implementing basic mipmapping “Color” textures only Time allowing, will implement more Use RayTracer framework, with MP4 as the starting point Risk: do not have enough information to compute the size or shape of the pixel footprint Substantial modifications required

Implementation Plan (2) Must have additional intersections (either world space or uv space) down within GetTexile() Deep stack; might be easiest to stuff extra information into the IntersectionRecord ComputeImage() ComputeShading() GetDiffuse() AttributeLookup() TextureLookup() GetTexile() Naïve implementation: ray trace four extra intersections at the pixel corners Better: shifting “box” of four intersection records No more expensive, except edges

Image Credits Akenine-Moller, Tomas; Eric Haines; Naty Hoffman. Real-Time Rendering (3rd ed.). Angel, Edward. Interactive Computer Graphics. Found at http://vip.cs.utsa.edu/classes/cs5113s2007/lectures/materials/TextureInterpolationExample.html Blow, Jonathan (a). “Mipmapping, Part 1.” Game Developer Magazine Dec. 2001. Blow, Jonathan (b). “Mipmapping, Part 2.” Game Developer Magazine Jan. 2002. Heckbert, Paul. “Fundamentals of Texture Mapping and Image Warping.” Thesis. University of California, Berkeley, 1989. Wikipedia (a). <http://en.wikipedia.org/wiki/Mipmap> Wikipedia (b). <http://en.wikipedia.org/wiki/Anisotropic_filtering> Williams, Lance. “Pyramidal Parametrics.” Computer Graphics 13.3 (1983).

Questions?