cs 586/480 computer graphics iidavid/classes/cs586/lectures/cgii_pres3.pdfcs 586/480 computer...

65
CS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Upload: others

Post on 22-Jun-2020

29 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

CS 586/480Computer Graphics II

Dr. David BreenKorman 207Thursday 6PM Æ 8:50PM

Presentation 310/9/03

Page 2: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Logisticsn Take attendancen Read research paper and prepare

questionn R.A. Drebin, L. Carpenter, and P. Hanrahan,

"Volume Rendering", ACM Computer Graphics(SIGGRAPH '88 Proceedings), 1988, pp. 65-74

n Michael Thomas presents next weekn Assignment due dates

Page 3: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Slide Creditsn Jonathan Cohen - Johns Hopkinsn Yizhou Yu - University of Illinoisn Kevin Suffern -University of Technology,

Sydney, Australian G. Drew Kessler, Larry Hodges - Georgia

Institute of Technology

Page 4: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Color Models

Page 5: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Johns Hopkins Department of Computer ScienceCourse 600.456: Rendering Techniques, Professor: Jonathan Cohen

Frequency SpectrumFrequency SpectrumFrequency Spectrum

Spectrum describes frequency distribution of Spectrum describes frequency distribution of a light sourcea light source

Wavelength (nm)Wavelength (nm)

Am

plitu

deA

mpl

itude

400400 450450 500500 550550 600600 650650 700700

redredyelyel..greengreenblueblue

Page 6: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Johns Hopkins Department of Computer ScienceCourse 600.456: Rendering Techniques, Professor: Jonathan Cohen

DefinitionsDefinitionsDefinitions

Hue: quality that distinguishes one color Hue: quality that distinguishes one color family from another (i.e. red, yellow, green, family from another (i.e. red, yellow, green, blue, etc.)blue, etc.)

ChromaChroma: degree of color’s departure from : degree of color’s departure from greyscalegreyscale

Value/Lightness: quality distinguishing light Value/Lightness: quality distinguishing light from dark colorsfrom dark colors

Page 7: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Johns Hopkins Department of Computer ScienceCourse 600.456: Rendering Techniques, Professor: Jonathan Cohen

More definitionsMore definitionsMore definitions

Achromatic light: literally light without Achromatic light: literally light without chromachroma, or , or greyscale greyscale lightlight

•• fairly uniform frequency distributionfairly uniform frequency distribution

Monochromatic light: light which has all Monochromatic light: light which has all intensity near a single frequencyintensity near a single frequency

Page 8: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Johns Hopkins Department of Computer ScienceCourse 600.456: Rendering Techniques, Professor: Jonathan Cohen

Color Mixture - SubtractiveColor Mixture Color Mixture -- SubtractiveSubtractive

Applies when mixing pigments and dyesApplies when mixing pigments and dyes

••Each substance absorbs certain frequenciesEach substance absorbs certain frequencies

••Combining substances absorbs the union of Combining substances absorbs the union of these frequenciesthese frequencies

••Resulting reflected light is intersection of colors Resulting reflected light is intersection of colors reflected by eachreflected by each

Page 9: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Johns Hopkins Department of Computer ScienceCourse 600.456: Rendering Techniques, Professor: Jonathan Cohen

Subtractive Mixture ExampleSubtractive Mixture ExampleSubtractive Mixture Example

from Gerald from Gerald MurchMurch, “Color Displays and Color Science”, in , “Color Displays and Color Science”, in Color and the Color and the ComputerComputer, H. John , H. John DurrettDurrett, ed., page 10., ed., page 10.

Page 10: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Johns Hopkins Department of Computer ScienceCourse 600.456: Rendering Techniques, Professor: Jonathan Cohen

Color Mixture - AdditiveColor Mixture Color Mixture -- AdditiveAdditive

Applies to mixing of luminescent colors, such Applies to mixing of luminescent colors, such as color CRT and LCD displays, etc.as color CRT and LCD displays, etc.

••Color refers to actual frequency spectrum of Color refers to actual frequency spectrum of lightlight

••Combining lights adds their frequency spectraCombining lights adds their frequency spectra

Page 11: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Johns Hopkins Department of Computer ScienceCourse 600.456: Rendering Techniques, Professor: Jonathan Cohen

Additive Color ExampleAdditive Color ExampleAdditive Color Example

Page 12: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Johns Hopkins Department of Computer ScienceCourse 600.456: Rendering Techniques, Professor: Jonathan Cohen

3 Types of retinal cones3 Types of retinal cones3 Types of retinal cones

From Foley, From Foley, vanDamvanDam, , FeinerFeiner, , and Hughes, and Hughes, Computer Computer Graphics: Principles and Graphics: Principles and Practice, 2nd edition, page Practice, 2nd edition, page 577577

Page 13: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Johns Hopkins Department of Computer ScienceCourse 600.456: Rendering Techniques, Professor: Jonathan Cohen

Efficient Color Computations in Computer GraphicsEfficient Color Computations in Efficient Color Computations in Computer GraphicsComputer Graphics

Represent frequency spectrum as discrete set Represent frequency spectrum as discrete set of samplesof samples

••Typically 3 samples: red, green, and blueTypically 3 samples: red, green, and blue

••Monitors also use samples corresponding to Monitors also use samples corresponding to different phosphorsdifferent phosphors

••Eye also has 3 samples (types of cones)Eye also has 3 samples (types of cones)

Does Does notnot imply that three samples for initial imply that three samples for initial and intermediate produce accurate and intermediate produce accurate computationscomputations

Page 14: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Johns Hopkins Department of Computer ScienceCourse 600.456: Rendering Techniques, Professor: Jonathan Cohen

Color Space GamutColor Space GamutColor Space Gamut

Color gamut: subspace of visible colorsColor gamut: subspace of visible colorsNo system of mixing colors from fixed No system of mixing colors from fixed

number of primaries can represent all number of primaries can represent all visible colorsvisible colors

from Gerald Murch, “Color Displays and Color Science”, in Color and the Computer, H. John Durrett, ed., page 13.

Page 15: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Johns Hopkins Department of Computer ScienceCourse 600.456: Rendering Techniques, Professor: Jonathan Cohen

Color Spaces - RGB cubeColor Spaces Color Spaces -- RGB cubeRGB cube

Shortcomings:Shortcomings:••perceptually nonperceptually non--linearlinear••nonnon--intuitive for human specificationintuitive for human specification

From Alan Watt, 3D Computer Graphics, 2nd edition, p. 416

from Foley, vanDam, Feiner, and Hughes, Computer Graphics: Principles and Practice, plate II.4

Page 16: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Johns Hopkins Department of Computer ScienceCourse 600.456: Rendering Techniques, Professor: Jonathan Cohen

Color Spaces - HSV hexaconeColor Spaces Color Spaces -- HSV HSV hexaconehexacone

Still not perceptually Still not perceptually linearlinear

Axes correspond to Axes correspond to more intuitive more intuitive perceptual qualitiesperceptual qualities••Selection similar to Selection similar to

artist color mixingartist color mixing••choose hue of base choose hue of base

pigment, add white, pigment, add white, add blackadd black

Derived from Derived from projections of RGB projections of RGB cubecube

From Alan Watt, 3D Computer Graphics, 2nd edition, p. 419

Page 17: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Johns Hopkins Department of Computer ScienceCourse 600.456: Rendering Techniques, Professor: Jonathan Cohen

CIE Color SpaceCIE Color SpaceCIE Color Space

Employs 3 artificial primaries: X, Y, ZEmploys 3 artificial primaries: X, Y, Z

••Mathematical abstractions, not physically Mathematical abstractions, not physically realizablerealizable

••Allow Allow supersaturationsupersaturation

Larger than visible spectrumLarger than visible spectrum

Standard for representing colors and Standard for representing colors and converting between spacesconverting between spaces

Page 18: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Johns Hopkins Department of Computer ScienceCourse 600.456: Rendering Techniques, Professor: Jonathan Cohen

CIE Space and Device GamutsCIE Space and Device CIE Space and Device GamutsGamuts

from Foley, vanDam, Feiner, and Hughes, Computer Graphics: Principles and Practice, plates II.1 and II.2

Chromaticity DiagramChromaticity Diagram

Page 19: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Johns Hopkins Department of Computer ScienceCourse 600.456: Rendering Techniques, Professor: Jonathan Cohen

Gamma CorrectionGamma CorrectionGamma Correction

Exponential function converts from deviceExponential function converts from device--independent RGB space to deviceindependent RGB space to device--dependent RGBdependent RGB

••Gamma is exponentGamma is exponent

••Every monitor is differentEvery monitor is different

••Monitor color intensities are nonMonitor color intensities are non--linear with linear with respect to phosphor excitation levelsrespect to phosphor excitation levels

Page 20: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Light Models

Page 21: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

��������������� �������������������������

������������������������������ ���!�"������������� �� �������

����������� ����������� �����������

����������������������

## �������������������������������������� ��������������������������������������

������������������������������������������������������������

## ������������������������������������������������������������������������������

$$��������������������������������������������������������������������

Page 22: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

��������������� �������������������������

������������������������������ ���!�"������������� �� �������

��� ���������� ���������� �������

����������������������������������������������������

## ��������������������������������������������������������������������������������

## ��������������������������������������������������������������������������

$$ ����������������������������������������������������������������������

��������������������������������������������������

Page 23: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

��������������� �������������������������

������������������������������ ���!�"������������� �� �������

���� ����������� ������ ����������� ������ ����������� ��

## ����������� �����������

## ����������������������������������

## �����! ��"������������! ��"�������

## #����������!�������������������"#����������!�������������������"

Page 24: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

��������������� �������������������������

������������������������������ ���!�"������������� �� �������

��� ���� �������� ���� �������� ���� �����

#�����������������������#�����������������������

## $������������������$ ��������������������������������������������������������������

�������������������!%��&"�������������������!%��&"

## %��&����'���������%��&����'���������

$$(����������������������������(����������������������������

$$(���������������������������(���������������������������

$$)������������������������)������������������������

Page 25: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

��������������� �������������������������

������������������������������ ���!�"������������� �� �������

������������������������������������������������

--�� ��

..

�/�������������������/������������������

-/������������-/������������

�/�������������������������������/������������������������������

./�������������������!�0�0����������./�������������������!�0�0����������

�������������������"�������������������"

Page 26: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

��������������� �������������������������

������������������������������ ���!�"������������� �� �������

��������������������

������������/������������/

## ���������!1���2"���������!1���2"

## ����������!����"����������!����"

����������3�����������������������3�������������

��������������������������������

��4� ��4� ������������ ����������

�����%���

Page 27: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

��������������� �������������������������

������������������������������ ���!�"������������� �� �������

��������� ��������������� ������

���������������������� ����������������������

������������/������������/

## ���������!1���2"���������!1���2"

## ����������!����"����������!����"

#����������������#����������������

��������������

��4���4�������������������

�����%���

������&

Page 28: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Spot Light

Dl

Pl

Ps

f

q

n Specified byn Position, Directionn Cone angle, sharpness

n L = Pl - Psn if f > qn IL= 0

n elsen IL= cosn((p/2)(f/q))

Page 29: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Shading Models

Page 30: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Computer Graphics Rendering Techniques: Reflection Models © KG Suffern 1991-20001 5

Consider the process of looking at (or photographing) a scene through awindow.

At every point on the window the light from the scene has a certainintensity I(x, y).

Intensity is a measure of the brightness of the light.

Generally there will be a mixture of light of different wavelengths ateach point on the window: I = I(x, y, λ) where λ is the wavelength.

We don't discuss the wavelength dependency in these notes.

Page 31: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Computer Graphics Rendering Techniques: Reflection Models © KG Suffern 1991-20001 6

Page 32: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Computer Graphics Rendering Techniques: Reflection Models © KG Suffern 1991-20001 8

Types of illumination

Direct illumination

Light striking the objects comes directly from the light sources

Page 33: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Computer Graphics Rendering Techniques: Reflection Models © KG Suffern 1991-20001 9

Indirect illumination

Light striking the objects has been reflected off at least one other objectsince leaving the light source.

The light could also have been refracted through transparent objects.

Page 34: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Computer Graphics Rendering Techniques: Reflection Models © KG Suffern 1991-20001 10

Reflection Models

There exists a number of reflection models that model the real world tovarying degrees of realism.

In general, the more realistic a model is, the more physics andcomputation is involved.

Most reflection models incorporate direct illumination.

The indirect illumination is very expensive to calculate.

Only the most advanced rendering techniques incorporate indirectillumination.

Examples are ray tracing and radiosity.

Page 35: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Computer Graphics Rendering Techniques: Reflection Models © KG Suffern 1991-20001 11

Some more terminology

Direct illumination is referred to as local illumination.

Indirect illumination is referred to as global illumination.

Page 36: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03
Page 37: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Computer Graphics Rendering Techniques: Reflection Models © KG Suffern 1991-20001 15

Interaction of light and objects.

We must also model the way that light interacts with the surfaces ofobjects.

When light hits the surface of an object, it can be:

• Reflected

• Absorbed

• Transmitted (for transparent objects)

We see opaque objects by the light they reflect.

Page 38: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Computer Graphics Rendering Techniques: Reflection Models © KG Suffern 1991-20001 16

The way in which light interacts with real objects is very complicated.

The interaction depends on:

• the material properties of the object

• the wavelength of the incident light

• the angle of incidence of the light and the surface

The polarisation of the light is also involved, but rarely modelled incomputer graphics.

Page 39: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03
Page 40: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03
Page 41: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Computer Graphics Rendering Techniques: Reflection Models © KG Suffern 1991-20001 22

Diffuse reflection

The incident light is scattered equally in all directions

incident light

surface

This is characteristic of dull, matt surfaces such as paper, bricks, carpet,etc.

Page 42: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03
Page 43: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03
Page 44: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Computer Graphics Rendering Techniques: Reflection Models © KG Suffern 1991-20001 23

Specular reflection

The reflected light is concentrated around the direction of mirrorreflection, and is spread out.

incident light

surface

mirror reflectiondirection

This can be used to model shiny surfaces.

Page 45: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03
Page 46: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Calculating the Reflected Ray

n r = 2 * (n · L) * n - Ln Derivation left for the studentsn Clamp all dot products to zero. They

shouldn’t be negative, but they can ben MAX (0, n · L)

Page 47: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Computer Graphics Rendering Techniques: Reflection Models © KG Suffern 1991-20001 40

θ90

o−90

o

1.0 cos θ

cos θ2

cos θ10

cos θ25

Page 48: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Computer Graphics Rendering Techniques: Reflection Models © KG Suffern 1991-20001 46

N

RL

V

θ θ φdiffuse

diffuse + specular

n = 10

n = 25

Diffuse + specular reflection

Page 49: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03
Page 50: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03
Page 51: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03
Page 52: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03
Page 53: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Computer Graphics Rendering Techniques: Reflection Models © KG Suffern 1991-20001 50

Page 54: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Originally from Larry F. Hodges, G. Drew Kessler 7

Light-source AttenuationThus far we have ignored the inverse square law: energy decays with the

inverse square of the distance dL to the light source. Including this termwe get

I = Iaka + Ipkd (L•N)/dL2

However, due to our previous assumptions of a point light source anduniform ambient light, using the dL

2 term gives too rapid of a decreasein illumination intensity to look realistic. The 1/dL

2 term is usuallyreplaced by fatt where

fatt = MIN (1/(c1dL), 1)

I = Iaka + Ipkd (N•L)*fatt

Page 55: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03
Page 56: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03
Page 57: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03
Page 58: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03
Page 59: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Including Surface Color

n I = IL*kd * C * cos(q) + IL*ks * C * cosn(f)!!!!+ Ia*ka * C

n C - RGB surface colorn Could define Cd, Cs and Ca, but you

don’t have to

Page 60: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

��������������� �������������������������

������������������������������ ���!�"������������� �� �������

����������� ���������������������� ���������������������� �����������

������������������������������������������������������������������������������������������������������������������

���������� 4�4�&&���������6�6<<��������=!-0."!-0�">=!-0."!-0�">

## &&�������� ������&������&����������������������������������������������������������������������������������������������������������������������������������������������������������������������

## ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

## 6����������������������������������6����������������������������������������������������������������������

Page 61: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

��������������� �������������������������

������������������������������ ���!�"������������� �� �������

�����$���%&'������������� ������$��������$���%&'������������� �%&'������������� �

�������������������� �� ���� �� ������������������������������������*������6������/�*������6������/�

������������� ��������(�����������������7?@ ������������� ��������(�����������������7?@

Page 62: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Larry F. Hodges, G. Drew Kessler 11

Too Intense

With multiple light sources, it is easy to generated values of I > 1

One solution is to set the color value to be MIN(I, 1)

• An object can change color, saturating towards whiteEx. (0.1, 0.4, 0.8) + (0.5, 0.5, 0.5) = (0.6, 0.9, 1.0)

Another solution is to renormalize the intensities to vary from 0 to 1if one I > 1.

• Requires calculating all I’s before rendering anything.

• No over-saturation, but image may be too bright, and contrasts alittle off.

Image-processing on image to be rendered (with original I’s) willproduce better results, but is costly.

Page 63: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Calculating Normalsv -1 -1 -1v 1 -1 -1v -1 1 -1v 1 1 -1v -1 -1 1v 1 -1 1v -1 1 1v 1 1 1f 1 3 4f 1 4 2f 5 6 8f 5 8 7f 1 2 6f 1 6 5f 3 7 8f 3 8 4f 1 5 7f 1 7 3f 2 4 8f 2 8 6

vertices

triangles

n Create vector structure(for normals) same size asvertex structure

n For each facen Calculate unit normaln Add to normal structure

using vertex indexn Normalize all the normalsn N(a,b,g)= aNa+ bNb+ gNc

Page 64: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Supersample & Average Imagen hres and vres are even

for (i=0; i++; i < hres/2)for (j=0; j++; j < vres/2) {

offset = 2 * [i,j]; newImage[i,j] = (oldImage[offset] +

oldImage[offset + [0,1]] + oldImage[offset + [1,0]] + oldImage[offset + [1,1]])/4;}

Page 65: CS 586/480 Computer Graphics IIdavid/Classes/CS586/Lectures/CGII_Pres3.pdfCS 586/480 Computer Graphics II Dr. David Breen Korman 207 Thursday 6PM Æ 8:50PM Presentation 3 10/9/03

Wrap Upn Discuss next week’s programming

assignmentn Add point lights with colorn Add color, shading properties and

normals to modelsn Phong shadingn Supersample image

n Discuss status/problems/issues withthis week’s programming assignment