Sei sulla pagina 1di 24

Rasterization

D.Aju
VIT University
What is Rasterization ?

• Rasterization is the task of taking an image described in a


vector graphics format (shapes) and converting it into a raster
image (pixels or dots).
Aliasing
• A pixel is a point
– It has no dimension
– It can have a coordinate
– is more than a point, it is a sample

• All rasterized locations do not match with the


true line.

• Have to select the optimum raster locations


to represent a straight line.
Aliased

• Severe with the low resolution screens.


• Line appears like a stair-step.
Antialiased
• This effect is known as aliasing.
Aliasing

Original Image Samples Reconstructed Image

Aliasing occurs because of poor sampling and reconstruction


Digitization
• Most things in the real world are continuous
• Everything in a computer is discrete
• The process of mapping a continuous function to a discrete one is
called sampling
• The process of mapping a continuous variable to a discrete one is
called quantization
• Rendering an image requires sampling and quantization
Sampling and reconstruction

Continuous Sampling Discrete Reconstruction Reconstructed


Function Function Samples Kernel Signal
Line Segments

• We try to sample a line segment so it would map to a


2D raster display
• We quantized the pixel values to 0 or 1
Antialiasing

Antialiasing is a technique used to diminish the jagged edges of


an image or a line, so that the line appears to be smoother; by
changing the pixels around the edges to intermediate colors or
gray scales.
Eg. Antialiasing disabled:

Eg. Antialiasing enabled:


Antialiasing

• The Nyquist rate is the minimum sampling rate required to


avoid aliasing, equal to twice the highest frequency contained
within the signal.

𝑓𝑁 ≝ 2𝐵, 𝑤ℎ𝑒𝑟𝑒 𝐵 𝑖𝑠 𝑡ℎ𝑒 ℎ𝑖𝑔ℎ𝑒𝑠𝑡 𝑓𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦

• To avoid aliasing, the sampling rate must exceed the Nyquist


rate:
𝑓𝑠 > 𝑓𝑁
Drawbacks of Aliasing
Methods of Antialiasing

• Increasing Resolution
• Area Sampling
• Unweighted Area Sampling
• Weighted Area Sampling
• Super Sampling
• Pixel Phasing
Methods of Antialiasing

• Increasing Resolution
– Increase the resolution of the raster display.
– Making the resolution as twice the original one.

• Disadvantage
– Need a huge frame buffer
– Quadrupling the cost of memory.
– Quadrupling the bandwidth of the memory.
– Quadrupling the scan-conversion time
Methods of Antialiasing

• Area Sampling

– Setting intensity proportional to amount of area covered.

– Assign intensity of pixel according to amount of overlap.

– Intensity decreases as the distance between the pixel and


the edges increases
Methods of Antialiasing

• Unweighted Area Sampling


– Many times the line passes in-between two pixels.
– Select the pixel which is closet to the true line.
– The intensity of the pixel is proportional to the amount of
the line area occupied by the pixel.
– Better results.
Equal areas contribute equal
intensity regardless of distance
between pixel’s center and the
area ; only the total amount of
overlapped area matters
Intensity is proportional to Area Covered
Methods of Antialiasing

• Weighted Area Sampling


– Small area closer to the pixel center has greater intensity than
one at a greater distance.
– The intensity of the pixel depends upon the line area occupied
and the distance of the area from the pixel center.
– Pixel cut through the center should be more heavily weighted
than one cut along corner
Methods of Antialiasing
• Weighted Area Sampling

Example weight for each sub-pixel

Total weight = 32

Final color of pixel = Sum of each (sub-pixel colors * sub-pixel weight) / total weight
Methods of Antialiasing

• Super Sampling

– Compute intensities at sub-pixel grid positions and


combine the results to obtain the pixel intensity.
Methods of Antialiasing

• Super Sampling(zero line width) - Example


A straight line on a gray scale display
– Divide each pixel into sub-pixels.
– The number of intensities are the max number of sub-pixels
selected on the line segment within a pixel.
Methods of Antialiasing
Super Sampling(Non-zero line width)

A line that is one-pixel wide.


For every pixel: Maximum number of sub-
pixels inside line = 16

A sub-pixel is considered in if its lower-left corner


is inside the line
0 0 5/16 9/16

10/16 15/16 13/16 7/16

8/16 2/16 0 0
Fraction of sub-pixels are in = fraction of color of the pixel should be line color
Methods of Antialiasing

• Super Sampling (finite line width)

– The intensity level for each pixel is proportional to the


number of sub-pixels inside the polygon representing the
line area.

– Line intensity is distributed


Pixel Masking
Common Filter Functions

Box Filter Cone Filter Gaussian Filter

1 1 1 1 1 1 2 3 2 1 1 2 3 2 1

1 1 1 1 1 2 4 5 4 2 2 5 6 5 2

1 1 1 1 1 3 5 6 5 3 3 6 8 6 3

1 1 1 1 1 2 4 5 4 2 2 5 6 5 2

1 1 1 1 1 1 2 3 2 1 1 2 3 2 1
Filters in Antialiasing
Pixel phasing
Pixel Phasing

• Shift the pixel location of display areas.

• It is applied by micropositioning the electron beam in


relation to object geometry

Potrebbero piacerti anche