Introduction to Computer Graphics CS 445 / 645 Lecture 12 Chapter 12: Color

Post on 11-Feb-2016

36 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

Introduction to Computer Graphics CS 445 / 645 Lecture 12 Chapter 12: Color. Test. Sections from Hearn and Baker All of Ch. 2 except sections: 5, 6, and 7 All of Ch. 3 except sections: 10, 11, 12, 13, 14, 16, 17 end Ch. 4-10 All of Ch. 5 All of Ch. 6 except sections: 9 and 10 - PowerPoint PPT Presentation

Transcript

Introduction to Computer Graphics

CS 445 / 645

Lecture 12Chapter 12: Color

TestSections from Hearn and BakerSections from Hearn and Baker• All of Ch. 2 except sections: 5, 6, and 7All of Ch. 2 except sections: 5, 6, and 7

• All of Ch. 3 except sections: 10, 11, 12, 13, 14, 16, 17All of Ch. 3 except sections: 10, 11, 12, 13, 14, 16, 17endend

• Ch. 4-10Ch. 4-10

• All of Ch. 5All of Ch. 5

• All of Ch. 6 except sections: 9 and 10All of Ch. 6 except sections: 9 and 10

• All of Ch. 7 except sections: 11 and 12All of Ch. 7 except sections: 11 and 12

• Appendix sections A-1, A-2, A-5, and A-7Appendix sections A-1, A-2, A-5, and A-7

Homework• Questions to help get ready for testQuestions to help get ready for test

• Will be graded for effortWill be graded for effort

• Download from class websiteDownload from class website

• Work individuallyWork individually

• Use of the web is allowedUse of the web is allowed

Canonical View VolumeA standardized viewing volume representationA standardized viewing volume representation

Parallel (Orthogonal) PerspectiveParallel (Orthogonal) Perspectivex or y

-z

x or y

-z

1

-1

-1FrontPlane

FrontPlane

BackPlane

BackPlane

x or y = +/- z

Why do we care?Canonical View Volume Permits StandardizationCanonical View Volume Permits Standardization• ClippingClipping

– Easier to determine if an arbitrary point is enclosed in Easier to determine if an arbitrary point is enclosed in volumevolume

– Consider clipping to six arbitrary planes of a viewing Consider clipping to six arbitrary planes of a viewing volume versus canonical view volumevolume versus canonical view volume

• RenderingRendering

– Projection and rasterization algorithms can be reusedProjection and rasterization algorithms can be reused

Projection NormalizationOne additional step of standardizationOne additional step of standardization• Convert perspective view volume to orthogonal view volume Convert perspective view volume to orthogonal view volume

to further standardize camera representationto further standardize camera representation

– Convert all projections into orthogonal projections by Convert all projections into orthogonal projections by distorting points in three space (actually four space distorting points in three space (actually four space because we include homogeneous coordinate w)because we include homogeneous coordinate w)

Distort objects using transformation matrixDistort objects using transformation matrix

Projection NormalizationBuilding a transformation Building a transformation matrixmatrix• How do we build a matrix thatHow do we build a matrix that

– Warps any view volume to Warps any view volume to canonical orthographic view canonical orthographic view volumevolume

– Permits rendering with Permits rendering with orthographic cameraorthographic camera

All scenes rendered with All scenes rendered with orthographic cameraorthographic camera

Projection Normalization - OrthoNormalizing Orthographic CamerasNormalizing Orthographic Cameras• Not all orthographic cameras define viewing volumes of right Not all orthographic cameras define viewing volumes of right

size and location (canonical view volume)size and location (canonical view volume)

• Transformation must map:Transformation must map:

Projection Normalization - OrthoTwo stepsTwo steps• Translate center to (0, 0, 0)Translate center to (0, 0, 0)

– Move x by –(xMove x by –(xmaxmax + x + xminmin) / 2) / 2

• Scale volume to cube with sides = 2Scale volume to cube with sides = 2

– Scale x by 2/(xScale x by 2/(xmaxmax – x – xminmin))

• Compose these transformation Compose these transformation matricesmatrices

– Resulting matrix maps Resulting matrix maps orthogonal volume to canonicalorthogonal volume to canonical

Projection Normalization - PerspPerspective Normalization is TrickierPerspective Normalization is Trickier

Perspective NormalizationConsider N=Consider N=

After multiplying:After multiplying:• p’ = Npp’ = Np

010000

00100001

Perspective NormalizationAfter dividing by w’, p’ -> p’’After dividing by w’, p’ -> p’’

Perspective NormalizationQuick CheckQuick Check • If x = zIf x = z

– x’’ = -1x’’ = -1

• If x = -zIf x = -z

– x’’ = 1x’’ = 1

Perspective NormalizationWhat about z?What about z?• if z = zif z = zmaxmax

• if z = zif z = zminmin

• Solve for Solve for and and such that zmin such that zmin -1 and zmax -1 and zmax 1 1• Resulting z’’ is nonlinear, but preserves ordering of pointsResulting z’’ is nonlinear, but preserves ordering of points

– If zIf z11 < z < z22 … z’’ … z’’11 < z’’ < z’’22

Perspective NormalizationWe did it. Using matrix, NWe did it. Using matrix, N• Perspective viewing frustum transformed to cubePerspective viewing frustum transformed to cube

• Orthographic rendering of cube produces same image as Orthographic rendering of cube produces same image as perspective rendering of original frustumperspective rendering of original frustum

ColorNext topic: Next topic: ColorColor

To understand how to make realistic images, we need a To understand how to make realistic images, we need a basic understanding of the physics and physiology of basic understanding of the physics and physiology of vision. Here we step away from the code and math for a vision. Here we step away from the code and math for a bit to talk about basic principles.bit to talk about basic principles.

Basics Of ColorElements of color:Elements of color:

Basics of ColorPhysics: Physics:

• IlluminationIllumination– Electromagnetic spectraElectromagnetic spectra

• ReflectionReflection– Material propertiesMaterial properties– Surface geometry and microgeometry (i.e., polished versus matte Surface geometry and microgeometry (i.e., polished versus matte

versus brushed)versus brushed)

PerceptionPerception• Physiology and neurophysiologyPhysiology and neurophysiology• Perceptual psychologyPerceptual psychology

Physiology of VisionThe eye:The eye:The retinaThe retina

• RodsRods

• ConesCones

– Color!Color!

Physiology of VisionThe center of the retina is a densely packed The center of the retina is a densely packed

region called the region called the foveafovea. . • Cones much denser here than the Cones much denser here than the peripheryperiphery

Physiology of Vision: ConesThree types of cones:Three types of cones:

• LL or or RR, most sensitive to red light (610 nm) , most sensitive to red light (610 nm) • MM or or GG, most sensitive to green light (560 nm), most sensitive to green light (560 nm)• SS or or BB, most sensitive to blue light (430 nm), most sensitive to blue light (430 nm)

• Color blindness results from missing cone type(s)Color blindness results from missing cone type(s)

Physiology of Vision: The Retina

Strangely, rods and cones are Strangely, rods and cones are at the at the backback of the retina, of the retina, behind a mostly-transparent behind a mostly-transparent neural structure that neural structure that collects their response.collects their response.

http://www.trueorigin.org/retina.asphttp://www.trueorigin.org/retina.asp

Perception: Metamers

A given perceptual sensation of color derives A given perceptual sensation of color derives from the stimulus of all three cone typesfrom the stimulus of all three cone types

Identical perceptions of color can thus be caused Identical perceptions of color can thus be caused by very different spectraby very different spectra

Perception: Other GotchasColor perception is also difficult because:Color perception is also difficult because:

• It varies from person to personIt varies from person to person

• It is affected by adaptation (stare at a light bulb… don’t)It is affected by adaptation (stare at a light bulb… don’t)

• It is affected by surrounding color:It is affected by surrounding color:

Perception: Relative IntensityWe are not good at judging absolute intensityWe are not good at judging absolute intensityLet’s illuminate pixels with white light on scale of 0 - 1.0Let’s illuminate pixels with white light on scale of 0 - 1.0Intensity difference of neighboring colored rectangles Intensity difference of neighboring colored rectangles

with intensities:with intensities: 0.10 -> 0.11 (10% change)0.10 -> 0.11 (10% change) 0.50 -> 0.55 (10% change)0.50 -> 0.55 (10% change)

will look the samewill look the sameWe perceive We perceive relativerelative intensities, not absolute intensities, not absolute

Representing IntensitiesRemaining in the world of black and white…Remaining in the world of black and white…

Use photometer to obtain min and max brightness of Use photometer to obtain min and max brightness of monitormonitor

This is the This is the dynamic rangedynamic range

Intensity ranges from min, IIntensity ranges from min, I00, to max, 1.0, to max, 1.0

How do we represent 256 shades of gray?How do we represent 256 shades of gray?

Representing Intensities

Equal distribution between min and max failsEqual distribution between min and max fails

• relative change near max is much smaller than near Irelative change near max is much smaller than near I00

• Ex: ¼, ½, ¾, 1Ex: ¼, ½, ¾, 1

Preserve % changePreserve % change• Ex: 1/8, ¼, ½, 1Ex: 1/8, ¼, ½, 1

• IInn = I = I00 * r * rnnII00, n > 0, n > 0

II00=I=I00

II11 = rI = rI00

II22 = rI = rI11 = r = r22II00

……

II255255=rI=rI254254=r=r255255II00

Dynamic Ranges Dynamic RangeDynamic Range Max # ofMax # of Display Display (max / min illum)(max / min illum) PerceivedPerceivedIntensities (r=1.01)Intensities (r=1.01)

CRT:CRT: 50-20050-200 400-530400-530Photo (print)Photo (print) 100100 465465Photo (slide)Photo (slide) 10001000 700700B/W printoutB/W printout 100100 465465Color printoutColor printout 5050 400400NewspaperNewspaper 1010 234234

Gamma CorrectionBut most display devices are inherently nonlinear: But most display devices are inherently nonlinear:

Intensity = Intensity = kk(voltage)(voltage)

• i.e., brightness * voltage != (2*brightness) * (voltage/2)i.e., brightness * voltage != (2*brightness) * (voltage/2)

is between 2.2 and 2.5 on most monitorsis between 2.2 and 2.5 on most monitors

Common solution: Common solution: gamma correctiongamma correction• Post-transformation on intensities to map them to linear range on Post-transformation on intensities to map them to linear range on

display device:display device:

• Can have separate Can have separate for R, G, B for R, G, B 1

xy

Gamma CorrectionSome monitors perform the gamma correction in Some monitors perform the gamma correction in

hardware (SGIs)hardware (SGIs)Others do not (most PCs)Others do not (most PCs)Tough to generate images that look good on both Tough to generate images that look good on both

platforms (i.e. images from web pages)platforms (i.e. images from web pages)

Paul DebevecTop Gun SpeakerTop Gun Speaker

Wednesday, October 9Wednesday, October 9thth at 3:30 – OLS 011 at 3:30 – OLS 011http://www.debevec.orghttp://www.debevec.org

MIT Technolgy Review’s “100 Young MIT Technolgy Review’s “100 Young Innovators”Innovators”

Rendering with Natural Light

Fiat Lux

Light Stage

top related