Interactive Computer Graphics Aliasing and Anti-Aliasing Hearn & Baker, chapter 4-7 D transforms Hearn & Baker, chapter 5 Aliasing and Anti-Aliasing Problem: jaggies Also known as aliasing. It results from sampling a pattern (signal) at limited resolution.
Aliasing and Anti-Aliasing -Examples Aliasing Anti-Aliasing Aliasing in photos A piece of practical knowledge Example web page Often better to blur before resizing 4
Aliasing and Anti-Aliasing To fully understand the causes of aliasing requires the use of Signal Processing and Fourier Transforms. We can look at Aliasing from a more intuitive basis. 5 Aliasing and Anti-Aliasing Effects of Sampling 6
Aliasing and Anti-Aliasing Effects of Sampling 7 Aliasing and Anti-Aliasing Aliasing 8 4
Aliasing and Anti-Aliasing Anti-Aliasing is the process that attempts to prevent or fix the problem. More Resolution Unweighted Area Sampling Weighted Area Sampling Post image creation filtering 9 Aliasing and Anti-Aliasing More Resolution 5
Aliasing and Anti-Aliasing Unweighted Area Sampling Aliasing and Anti-Aliasing Unweighted Area Sampling Pixel Sub Pixels 55 * 4/9 = 6
Aliasing and Anti-Aliasing Weighted Area Sampling 96 Sub Pixels Pixel 4 Sub Pixels Weights 55 * (+++)/6 = 96 Aliasing and Anti-Aliasing Post image creation filtering = /9 * 55 = 85 4 7
Aliasing and Anti-Aliasing Post-image processing: fewer samples (less work) more blur (worse quality) Weighted area sampling: slightly less blurry than unweighted 5 Basic Graphics Transforms Translation Scaling Rotation Reflection Shear All Can be Expressed As Linear Functions of the Original Coordinates : x = Ax + By + C y = Dx + Ey + F x' A = y' D B E Cx F y 6 8
Preserve Parallel Lines Finite Points Map to Finite Points Translation, Rotation, and Reflection Preserve : Angles Lengths 7 x = x + y = y + Tx Ty P T Vectors : P = P + T Matrices : [ P ] = [ P] + [ T] P x Px Tx Px + T = + = P y Py Ty Py + T x y P Transform Polygons by Transforming Each Vertex 8 9
x = S y = S x y x y [ P ] = [ S][ P] P x Sx = P y Px Sx P = S ypy Sy P x y Uniform Scaling : Differential Scaling : S = S x Sy x Sy 9 (x,y ) φ r (x,y) r cos Θ = x r sin Θ = y Θ x = r cos( Θ + φ) = r cos Θ cosφ r sin Θsinφ y = r sin( Θ + φ) = r cos Θsinφ + r sin Θ cosφ Rotation about the Origin x = x cosφ y sinφ y = x sinφ + y cosφ P x cosφ = P y sinφ [ P ] = [ R(φ )][ P] sinφpx cosφ Py
Shear Transforms Shear: An action or stress resulting from applied forces that causes two contiguous parts of a body to slide relatively to each other. a Shear Transforms a Shear Translation in X a b Shear Translation in Y b
Shear Transforms Properties: It is an Affine Transform a and b are the proportionality constant A shear transform application: Fast and efficient rotation It will be used in perspective transformations Shear is easily invertable Shear Transforms Shear rotation α λ θ θ β co s sin = sin θ co sθ α = t a n θ ( ) β = s i n θ λ = t a n θ ( ) 4
5 Reflection Transforms Reflection is a transform that allows vectors to be flipped about an axis as if reflected in a mirror. Reflection About YZ Reflection About XZ Reflection About XY 6
Unify Transformation Operations All Transformations Represented as Matrix Products Tx [ T ] Ty [ S ] Sy [ R φ) ] Sx cosφ sinφ ( sinφ cosφ [ P ] = [ T][ P] [ P ] = [ S][ P] [ P ] = [ R(φ )][ P] Homogeneous Coordinates [ P] Px = Py NOT the z coordinate 7 Scaling About a Point Translate to Origin Apply Scale Matrix Translate Back to Original Position [ P ] = [ T][ S][ T][ P] T T T = T 8 4
Transform Combinations Rotation About a Point Translate to Origin Apply Rotation Matrix Translate Back to Original Position [ P ] = [ T ][ R(φ )][ T][ P] T φ T 9 Homogeneous coordinates in D How to represent perspective projection It is hard! y x= Given the coordinates of the orange point find the coordinates of the blue point Points: (x,y) (x,y,) x Equivalency: (x,y,w) (x/a, y/a, w/a) 5
An arbitrary camera? Need some systematic way of doing this (x c,y c ) (x,y ) Image plane (x,y ) Approach: One thing at a time First transform everything so that the camera is in the canonic position Matrix M Then perform projection Matrix P Combine the result P*M 6