+ All Categories
Home > Documents > Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد...

Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد...

Date post: 16-Dec-2015
Category:
Upload: barrett-teesdale
View: 225 times
Download: 8 times
Share this document with a friend
Popular Tags:
39
Computer Graphics Viewing, Rendering, Antialiasing ف ي ل ا و ت وري رد آ گ: ي چ ل ي ن ش ق ن ا مد رض ح ر آ كت د& هان ف ص گاه آ ش ن دآ ر ت و ي3 پ م كا ي س د ي ه م روه گ
Transcript
Page 1: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Computer Graphics Viewing, Rendering,

Antialiasing

Computer Graphics Viewing, Rendering,

Antialiasing

:گرد آوري و تاليف

دكتر احمد رضا نقش نيل چي

دانشگاه اصفهان

گروه مهندسي كامپيوتر

Page 2: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Right Handed Coordinate System

+X

+Y

+Z

+X

+Y

+Z

Page 3: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Viewing a 3D world

We have a model in this world and would like to view it from a new position.

We’ll call this new position the camera or eyepoint. Our job is to figure out what the model looks like on the display plane.

+X

+Y

+Z

Page 4: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Parallel Projection

+X

+Y

+Z

Page 5: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Perspective Projection

+X

+Y

+Z

Page 6: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Major Tasks of a Renderer Modelling:

Produce sets of vertices that define geometric objects Geometric Processing:

Determine which objects should appear and in what colour Normalization Clipping Hidden Surface Removal Shading Vertex-based: floating point processing in 3-D

Rasterization: Generate frame buffer pixels by Scan Conversion Pixel-based: integer processing in 2-D

Display: Pixels are read from the frame buffer onto the CRT Must overcome display artefacts through Antialiasing

Page 7: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

A Note about Hidden-Surface Removal

Hidden Surface Removal (Visible Surface Determination) seeks to discover which objects are visible or obscured from the viewpoint

Object Space Approach: Consider polygons A and B pair-wise and determine if: (a) B

partially obscures A, (b) A partially obscures B, (c) A and B are completely visible, (d) B obscures A (or vice versa)

Image Space Approach: Follows ray-casting approach

Page 8: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Aliasing

Occurs when the sampling inherent in rendering does not contain enough information for an accurate image.

Original Scene

Scanline Luminosity

Sampling Pixel Centres

Sampled Signal Luminosity Signal

Rendered Image

Page 9: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Antialiasing

What is antialiasing? How do we see the affects of antialiasing? What can we do about it? Math behind antialiasing Antialiasing in modern day graphics cards Advanced stuff on AA

Page 10: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Let’s Revisit a pixel

A pixel is which of these things (theoretically)? point circle/disk square/rectangle has area has a location sample

Page 11: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Samples

Continuous - function with values at any input. Most things in the world. Ex. sine and cosine

Discrete - function with values only at specific inputs. Computers are discrete.

What is a 2D example? To convert from a continuous function to a discrete one, we discretize or sample

To convert form a continuous variable to a discrete one, we quantize When we render an image (which is a continuous function), we sample and

quantize

Page 12: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

A New Thought about Images

Images are really a 2D function

Here’s an image plotted as a height field

Now we store this image as an “array” of points. What does that mean?

Page 13: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

We Sample the Image Function

Here is the sampling function. It is called the delta function

Page 14: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Thus we are “sampling” a continuous image function

We call these samples at this regular grid of points, pixels.

Pixels are a sampling of the function that describes the image.

We store these pixels into memory as an array of colors.

How densely should we sample?

What would govern this?

Page 15: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

A quick footnote into frequency analysis

A way to understand the sampling question is to convert the function into a different “space” or domain.

We use the Fourier Transform to convert the function (in our case the image) into the frequency domain.

Page 16: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

What does sampling mean?

What happens if we don’t sample enough?

Page 17: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Aliasing in General

If we sample at too low a rate, the high frequencies in the image appear as lower frequencies.

How do we fix it? Increase sampling Remove high frequencies

Page 18: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Aliasing in Image

Aliasing manifests itself as “jaggies” in graphics. Thus we don’t have enough pixels to accurately represent the underlying function. Check out what happens when we increase our sampling.

Page 19: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Effects of Aliasing in Image

Common aliasing errors (called artefacts) are: jagged profiles, disappearing or improper fine detail, and disintegrating textures.

Jagged Profiles

Loss of Detail

Page 20: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Fixing Aliasing

Increase Resolution What’s wrong with this approach? Filtering is another possibility

We want to remove the high frequency areas How would we do that?

Let’s re-examine what a pixel is in reality.

Page 21: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Prefiltering

No Antialiasing Prefiltering

Page 22: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Postfiltering

Sampling: take jittered, regular or random samples.

Averaging: use an filter to assign weights to each sample. Sum all the weighted samples to obtain a pixel.

Jittered Regular

nn

nn

161

81

161

81

41

81

161

81

161

Page 23: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Filtering Example

Page 24: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

(0,0)

(4,2)

(4,0)

2

2

1

10

0

3 4

Let’s recall

Page 25: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Filter Sampling

This reduces the high frequencies (which cause aliasing)

Interpolate between samples.

Page 26: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Filter Sampling Result (Example)

Page 27: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

What are we doing?

(0,0)

(4,2)

(4,0)

2

2

1

10

0

3 4

Page 28: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Two ways to Antialias

Increase resolution (increase sampling) or

Supersampling

Page 29: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Increase Rendering Resolution

Render the image at a higher resolution and downsample. Really, you are letting your eye do some filtering for you.

Page 30: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Supersampling

For each pixel, we would like to figure out what “percentage” is covered.

(0,0)

(4,0)

2

1

10

0

3 4

Page 31: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Line Antialiasing

Page 32: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Full Screen Antialiasing

Another way to do the supersampling is to do full screen antialiasing

We want to draw the image with several camera jitter positions and average the answers

Page 33: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Full Screen Antialiasing Example (Exaggerated)

Page 34: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Anti-aliasing in Summary Developed to combat aliasing Super-sampling (Post-filtering):

Compute pixel color by averaging multiple samples.

Sample the scene at n times the display resolution. For example, suppose the display resolution is 512x512. Sampling at three times the width and three times the height of the display resolution would yield 1536x1536 samples

A filter provides the weights used to compute the average

Page 35: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

Antialiasing Examples

Page 36: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.
Page 37: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.
Page 38: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.
Page 39: Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.

پايانپايان


Recommended