24.colorissues - clarkson university › class › cs452 › slides › 24.colorissues.pdfuse...

82
CS452/552; EE465/505 Color Display Issues 4-16–15

Upload: others

Post on 25-Jun-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

CS452/552; EE465/505

Color Display Issues

4-16–15

Page 2: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

2

Page 3: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

! Color Display Issues ✦Color Systems ✦Dithering and Halftoning

! Splines ✦Hermite Splines ✦Bezier Splines ✦Catmull-Rom Splines

Read: Angel, ✦Chapter 8, section 8.13 Display Considerations ✦Chapter 11, Curves and Surfaces ✦Chapter 12, section 12.1 - 12.7 Advanced Rendering: Ray-Tracing

Lab#5 posted, due: April 22nd simple scene: platform & object; 1 light; shadow map; camera controls Project#2 posted due: April 23rd

Outline

Page 4: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Light mapping

Page 5: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

// starting point p, direction d, max # of steps; returns a color c (single light source) trace(p, d, step) { color local, reflected, transmitted; point q; normal n; if(step > max) return(background_color); q = intersect(p, d, status); if(status==light_source) return(light_source_color); if(status==no_intersection) return(background_color); n = normal(q); r = reflect(q, n); t = transmit(q,n); local = phong(q, n, r); reflected = trace(q, r, step+1); // recursive call transmitted = trace(q, t, step+1); // recursive call return(local + reflected + transmitted); }

Recursive Ray Tracer (Simple version)

Page 6: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

! Efficiency ✦ replace the recursion with iteration ✦use bounding boxes to simplify the math used to compute intersections

! Aliasing errors, due to sampling ✦use a stochastic sampling method in which the decision on where to cast the next ray is based on the rays cast so far (used in Renderman)

! Ray tracing is an inherently parallel process ! There are many free ray tracers available

Ray Tracing: Summary

Page 7: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Next Topic: Displays & Color! Consider perceptual issues related to displays ! Introduce chromaticity space

✦Color systems ✦Color transformations

! Standard Color Systems

Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Page 8: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

! Problems that affect the quality of a display ✦two different displays may have the same resolution, but display pixels at different sizes

✦the colors displayed on two different monitors may differ ● map software-defined colors onto the display ● map brightness values onto the display

✦RGB values are independent of display properties, but do not account for the full range of the human visual system

! The range of displayable colors for a device is called its color gamut

Displays & Color

Page 9: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Luminance and Color Images! Luminance Image

✦Monochromatic ✦ Values are gray levels ✦ Analogous to working with black and white film or television

! Color Image ✦ Has perceptional attributes of hue, saturation, and lightness ✦ Do we have to match every frequency in visible spectrum? No!

Page 10: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Perception Review! Light is the part of the electromagnetic spectrum

between ~350-750 nm ! A color C(λ) is a distribution of energies within this

range! Human visual system has two types of

sensors ✦Rods: monochromatic, night vision ✦Cones: color sensitive ● Three types of cones

! Consequently, only three values, the tristimulus values, are “perceived” by the brain

Page 11: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Color vision deficiency! red-green

✦ difficulty distinguishing between shades of red + green

✦ affects ~8% of males and ~0.5% of females in populations of North European ancestry

! achromatopsia ✦ cannot perceive any

colors ✦ rare, < 1/30,000 for

most populations

! blue-yellow

✦ difficulty differentiating shades of blue and yellow

✦ affects males & females equally, < 1/10,000

Page 12: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Tristimulus Values! The human visual center has three cones with

sensitivity curves S1(λ), S2(λ), and S3(λ) ! For a color C(λ), the cones output the tristimulus

values

λλλ dCST )()(11 ∫=

λλλ dCST )()(22 ∫=

λλλ dCST )()(33 ∫=

C(λ)

T1, T2, T3cones

optic nerve

Page 13: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Three Color Theory! Any two colors with the same tristimulus values are

perceived to be identical ! Thus a display (CRT, LCD, film) must only produce

the correct tristimulus values to match a color ! Is this possible? Not always

✦Different primaries (different sensitivity curves) in different systems

Page 14: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

The Problem! The sensitivity curves of the human are not the same as those of physical devices

! Human: curves centered in blue, green, and green-yellow

! CRT: RGB ! Print media: CMY or CMYK ! Which colors can we match and, if we cannot match, how close can we come?

Page 15: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Representing Colors! Consider a color C(λ) ! It generates tristimulus values T1, T2, T3

✦Write C = (T1, T2, T3 ) ✦Conventionally,we assume 1≥ T1, T2, T3 ≥ 0 because there is a maximum brightness we can produce and energy is nonnegative

✦C is a point in color solid C1

11T1

T2

T3

Page 16: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Producing Colors! Consider a device such as a CRT with RGB

primaries and sensitivity curves

! Tristimulus valuesλλλ dCRT )()(1 ∫= λλλ dCGT )()(2 ∫= λλλ dCBT )()(3 ∫=

Page 17: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Matching ! This T1, T2, T3 is dependent on the particular device

! If we use another device, we will get different values and these values will not match those of the human cone curves

! Need a way of matching and a way of normalizing

Page 18: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Color Systems! Various color systems are used

✦Based on real primaries: ● RGB ● UVW ● CMYK ● HLS (aka HSB) ● NTSC YIQ (National Television System Committee)

✦Theoretical ● XYZ

! Prefer to separate brightness (luminance) from color (chromatic) information ✦Reduce to two dimensions

Page 19: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Tristimulus Coordinates

TTTTt

321

11 ++=

TTTTt

321

22 ++=

! For any set of primaries, define

TTTTt

321

33 ++=

1ttt 321 =++ 0,,1 ttt 321 ≥≥✦Note:

Page 20: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Maxwell Triangle

Project onto 2D: chromaticity space

1

1T1 + T2+T3 =1

1

color solid

t1

t2

1

1t1 +

t2 =1possible colors

Page 21: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

NTSC RGB

1

1

r

g

r+g+b=1

r+g=1

Page 22: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Producing Other Colors! However colors producible on one system (its color gamut) is not necessarily producible on any other

! Note that if we produce all the pure spectral colors in the 350-750 nm range, we can produce all others by adding spectral colors

! With real systems (CRT, film), we cannot produce the pure spectral colors

! We can project the color solid of each system into chromaticity space (of some system) to see how close we can get

Page 23: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Color Gamuts

spectral colors printer colors

CRT colors

350 nm

750 nm

600 nm

producible color on CRT but not on printer

producible color on both CRT and printer

unproducible color

Page 24: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

XYZ! Reference system in which all visible pure spectral colors can be produced

! Theoretical systems, as there are no corresponding physical primaries

! Standard reference system

Page 25: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Color Systems! Most correspond to real primaries

✦National Television Systems Committee (NTSC) RGB matches phosphors in CRTs

! Film both additive (RGB) and subtractive (CMY) for positive and negative film

! Print industry CMYK (K = black) ✦K used to produce sharp crisp blacks ✦Example: ink jet printers

Page 26: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Color Transformations! Each additive color system is a linear transformation of another

R

R’

GG’

BB’

C = (T1, T2, T3) = (T’1, T’2, T’3)

in RGB system

in R’G’B’system

Page 27: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Additive and Subtractive Color! Additive color

✦Form a color by adding amounts of three primaries ● CRTs, projection systems, positive film

✦Primaries are Red (R), Green (G), Blue (B) ! Subtractive color

✦Form a color by filtering white light with cyan (C), Magenta (M), and Yellow (Y) filters ● Light-material interactions ● Printing ● Negative film

Page 28: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

! Primary colors: ✦ red, green, blue

! Secondary colors: ✦yellow = red+green ✦cyan = green+blue ✦magenta = blue+red

! All colors ✦white = red+green+blue ✦black = no color

RGB: Red, Green, Blue

C = T1R + T2G + T3B

Color Cube

Page 29: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

CMYK: Cyan, Magenta, Yellow, Black! Primary colors:

✦cyan, magenta, yellow ! Secondary colors:

✦blue = cyan+magenta ✦ red = magenta+yellow ✦green = yellow+cyan

! All colors ✦white = no color ✦ black = cyan+magenta+yellow ● for true black, add in black

Also known as process color (used to print full-color images)

(+black)

Page 30: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

RGB, CMY, CMYK! Assuming 1 is max of a primary C = 1 – R M = 1 – G Y = 1 – B ! Convert CMY to CMYK by K = min(C, M, Y) C’ = C – K M’ = M – K Y’ = Y - K

Page 31: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Color Matrix! Exists a 3 x 3 matrix to convert from representation in

one system to representation in another

! Example: XYZ to NTSC RGB ✦ find in colorimetry references

! Can take a color in XYZ and find out if it is producible by transforming and then checking if resulting tristimulus values lie in (0,1)

!!!

"

#

$$$

%

&

=!!!

"

#

$$$

%

&

TTT

T'T'T'

3

2

1

3

2

1

M

Page 32: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

YIQ! NTSC Transmission Colors ! Here Y is the luminance

✦ arose from the need to separate brightness from chromatic information in TV broadcasting

! Note luminance shows high green sensitivity

!!!

"

#

$$$

%

&

!!!

"

#

$$$

%

&

=

!!!

"

#

$$$

%

&

BGR

0.3110.523-0.2120.321-0.275-0.5960.1140.5870.299

QIY

Page 33: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Other Color Systems! UVW: equal numerical errors are closer to equal

perceptual errors ! HLS: perceptual color (hue, saturation, lightness)

✦Polar representation of color space ✦Single and double cone versions

Page 34: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

HSB: Hue, Saturation, Brightness! Hue is the actual color. It is

measured in angular degrees counter-clockwise around the cone starting and ending at red=0 or 360 (yellow = 60, green = 120, etc.).

! Saturation is the purity of the color, measured in percent from the center of the cone (0) to the surface (100).

! Brightness is measured in percent from black (0%) to white (100%).

✦ grayscale – axis from 0% (white) to 100% (black)

Page 35: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Gamma Correction ! Intensity vs CRT voltage is nonlinear

I = cVγ! Gamma correction (encoding) can code/decode

luminance or tristimulus values ! Can use a lookup table to correct ! Human brightness response is logarithmic

✦Equal steps in gray levels are not perceived equally ✦Can use lookup table

! CRTs cannot produce a full black ✦Limits contrast ratio

Page 36: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Dithering (digital halftoning)

Page 37: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Black/White Dithering

Page 38: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Color Dithering

Page 39: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Halftoning

Page 40: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Modeling Complex Shapes

Page 41: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

! Local control of shape ■ so that it is easy to build and modify

! Stability ! Smoothness and continuity ! Ability to evaluate derivatives ! Ease of rendering

What do we need from curves in Computer Graphics?

Page 42: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Utah Teapot

! Most famous data set in computer graphics ! Widely available as a list of 306 3D vertices and the indices that define 32 Bezier patches

Page 43: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Curve Representations

Page 44: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Parameterization of a Curve

Page 45: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Polynomial Interpolation

Page 46: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Splines: Piecewise Polynomials

Page 47: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Piecewise Polynomials

Page 48: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Splines

Page 49: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Cubic Curves in 3D

Page 50: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Cubic Hermite Splines

Page 51: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Deriving Hermite Splines

Page 52: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Deriving Hermite Splines

Page 53: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Deriving Hermite Splines

Page 54: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

The Cubic Hermite Spline Equation

Page 55: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Four Basis Functions for Hermite Splines

Page 56: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Piecing together Hermite Splines

Page 57: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Hermite Splines in Adobe Illustrator

Page 58: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Bezier’s Idea! In graphics and CAD, we do not usually have derivative data

! Bezier suggested using the same 4 data points as with the cubic interpolating curve to approximate the derivatives in the Hermite form

Page 59: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Bezier Splines

Page 60: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Approximating Derivatives

p0

p1p2

p3

p1 located at u=1/3 p2 located at u=2/3

3/1pp)0('p 01−≈

3/1pp)1('p 23−≈

slope p’(0) slope p’(1)

u

Page 61: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

The Bezier Spline Matrix

Page 62: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Bezier Blending Functions

Page 63: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

DeCasteljau Construction

Page 64: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Bezier Patches

Using same data array P=[pij] as with interpolating form

vupvbubvup TBB

Tijj

i ji MPM==∑∑

= =

)()(),(3

0

3

0

Patch lies in convex hull

Page 65: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Analysis! Although the Bezier form is much better than the interpolating form, we have the derivatives are not continuous at join points

! Can we do better? ■ Go to higher order Bezier ● More work ● Derivative continuity still only approximate ● Supported by OpenGL

■Apply different conditions ● Tricky without letting order increase

Page 66: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Catmull-Rom Splines

Page 67: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Constructing the Catmull-Rom Spline

Page 68: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Catmull-Rom Spline Matrix

Page 69: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Splines with More Continuity?

Page 70: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Comparison of Basic Cubic Splines

Page 71: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Natural Cubic Splines

Page 72: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

B-Splines

Page 73: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

B-Splines! Basis splines: use the data at p=[pi-2 pi-1 pi pi-1]T

to define curve only between pi-1 and pi

! Allows us to apply more continuity conditions to each segment

! For cubics, we can have continuity of function, first and second derivatives at join points

! Cost is 3 times as much work for curves ■ Add one new point each time rather than three

! For surfaces, we do 9 times as much work

Page 74: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

B-Spline Basis

Page 75: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Other Common Types of Splines

Page 76: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Generalizing Splines! We can extend to splines of any degree ! Data and conditions to not have to given at equally spaced values (the knots) ■ Nonuniform and uniform splines ■ Can have repeated knots ● Can force spline to interpolate points

! Cox-deBoor recursion gives method of evaluation

Page 77: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

NURBS! Nonuniform Rational B-Spline curves and surfaces add a fourth variable w to x,y,z ■ Can interpret as weight to give more importance to some control data

■ Can also interpret as moving to homogeneous coordinate

! Requires a perspective division ■ NURBS act correctly for perspective viewing

! Quadrics are a special case of NURBS

Page 78: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

How to Draw Spline Curves

Page 79: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Drawing Splines, continued

Page 80: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Summary

Page 81: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

! use Catmull-Rom splines along with lighting and texture mapping to create a roller coaster simulation

! runs in a first-person view, allowing the user to “ride” the coaster in an immersive environment

Project: Roller Coaster

Page 82: 24.colorIssues - Clarkson University › class › cs452 › slides › 24.colorIssues.pdfuse bounding boxes to simplify the math used to compute intersections! Aliasing errors, due

Animation