50 likes | 204 Views
Aliasing & Anti-aliasing. Aliasing. Aliasing is cause by the discrete nature of pixels (Sampling Error) . Approximation of lines and circles with discrete points often gives a staircase appearance or "Jaggies". Desired line Aliased rendering of the line.
E N D
Aliasing Aliasing is cause by the discrete nature of pixels (Sampling Error). Approximation of lines and circles with discrete points often gives a staircase appearance or "Jaggies". Desired line Aliased rendering of the line
Aliasing can be smoothed out by using higher addressability. If addressability is fixed but intensity is variable, use the intensity to control the address of a "virtual pixel". Two adjacent pixels can be be used to give the impression of a point part way between them. The perceived location of the point is dependent upon the ratio of the intensities used at each. The impression of a pixel located halfway between two addressable points can be given by having two adjacent pixels at half intensity. An antialiased line has a series of virtual pixels each located at the proper address. Anti-aliasing - Solutions
Line drawing algorithms can easily be modified to implement virtual pixels. We use the distance ( e ) value to determine pixel intensities. Two possible cases which may occur for simple anti-aliased line algorithm: Anti-aliased Line Algorithm 0 <= e <=1.5 0 > e >= -1.5 A A When color is used rather than a grey scale, the red, green and blue components are interpolated separately to determine each one's proper intensity. B B e e C C D D A = max(e+0.5,1) - 1 B = 1 - abs(e-0.5) C = 1 - min(e+0.5,1) D = 0 A = 0 B = 1 + max(e-0.5, -1) C = 1 - abs(e+0.5) D = -min(e-0.5, -1) - 1
Circle drawing algorithms can also be easily modified to implement virtual pixels. Once again, we use the distance ( e ) value to determine pixel intensities. Two possible cases which may occur for simple anti-aliased circle algorithm: Anti-aliased Circle Algorithm 0 <= e <= 1/2 0 > e >= -1/2 When color is used rather than a grey scale, the red, green and blue components are interpolated separately to determine each one's proper intensity. B e B A e A B = 1 - abs(e-0.5) A = 1 - min(e+0.5,1) A = 1 - abs(e+0.5) B = 1 + max(e-0.5, -1)