Docsity

3D Clipping and Color Representation in Computer Graphics - Prof. David E. Breen, Lab Reports of Computer Graphics

Toggle sidebar
bg1
1
1
CS 430/536
Computer Graphics I
3D Clipping
Week 9, Lecture 17
David Breen, William Regli and Maxim Peysakhov
Geometric and Intelligent Computing Laboratory
Department of Computer Science
Drexel University
http://gicl.cs.drexel.edu
2
Outline
• 3D Clipping
• Light
• Physical Properties of Light and Color
• Eye Mechanism for Color
• Systems to Define Light and Color
3
Simple Mesh Format (SMF)
• Michael Garland http:/
/graphics.cs.uiuc.edu/~garland/
• Triangle data
• Vertex indices begin at 1
4
3D Clipping
• Cohen-Sutherland and Cyrus-Beck can
be trivially extended to 3D
• We will cover:
– Cohen-Sutherland for 3D, (parallel
projection)
– Cohen-Sutherland for 3D, (perspective
projection)
5
Recall: Cohen-Sutherland
• Line is completely
visible iff both code
values of endpoints
are 0, i.e.
• If line segments are
completely outside
the window, then
Pics/Math courtesy of Dave Mount @ UMD-CP
6
Cohen-Sutherland for 3D,
Parallel Projection
• Use 6 bits
• Trivially accept if both end-codes are 0
• Trivially reject if bit-by-bit AND of end-codes is not 0
• Up to 6 intersections may have to be computed
bit 1 point ABOVE the view volume y > 1
bit 2 point BELOW the view volume y < -1
bit 3 point RIGHT OF the view volume x > 1
bit 4 point LEFT OF the view volume x < -1
bit 5 point BEHIND the view volume z < -1
bit 6 point IN FRONT the view volume z > 0
pf3
pf4
pf5
pf8

Partial preview of the text

Download 3D Clipping and Color Representation in Computer Graphics - Prof. David E. Breen and more Lab Reports Computer Graphics in PDF only on Docsity!

1

CS 430/

Computer Graphics I

3D Clipping

Week 9, Lecture 17

David Breen, William Regli and Maxim Peysakhov

Geometric and Intelligent Computing Laboratory

Department of Computer Science

Drexel University

http://gicl.cs.drexel.edu^2

Outline

• 3D Clipping

• Light

• Physical Properties of Light and Color

• Eye Mechanism for Color

• Systems to Define Light and Color

3

Simple Mesh Format (SMF)

  • Michael Garland http:/ /graphics.cs.uiuc.edu/~garland/
  • Triangle data
  • Vertex indices begin at 1 4

3D Clipping

• Cohen-Sutherland and Cyrus-Beck can

be trivially extended to 3D

• We will cover:

– Cohen-Sutherland for 3D, (parallel

projection)

– Cohen-Sutherland for 3D, (perspective

projection)

5

Recall: Cohen-Sutherland

• Line is completely

visible iff both code

values of endpoints

are 0, i.e.

• If line segments are

completely outside

the window, then

Pics/Math courtesy of Dave Mount @ UMD-CP 6

Cohen-Sutherland for 3D,

Parallel Projection

  • Use 6 bits
  • Trivially accept if both end-codes are 0
  • Trivially reject if bit-by-bit AND of end-codes is not 0
  • Up to 6 intersections may have to be computed bit 1 point ABOVE the view volume y > 1 bit 2 point BELOW the view volume y < - bit 3 point RIGHT OF the view volume x > 1 bit 4 point LEFT OF the view volume x < - bit 5 point BEHIND the view volume z < - bit 6 point IN FRONT the view volume z > 0

7

Cohen-Sutherland for 3D

computing intersection points.

• Use parametric representation of the line to

compute intersections

• So for y=1 replace y with 1 and solve for t

• If 1 ≥ t ≥ 0 use it to find x and z

• Test if x and z are in valid range

• Repeat for planes y=-1, x=1, x=-1, z=-1, z=

0 1 0 0 1 0 0 1 0

z z tz z

y y ty y

x x tx x

1 0 0

y y

t y

=^ −

8

Cohen-Sutherland for 3D,

Perspective Projection

  • Use 6 bits identical to parallel view volume clipping
  • Conditions on the codes are different
  • Trivially accept/reject lines using same roles
  • Intersection points computed differently bit 1 point ABOVE the view volume y > -z bit 2 point BELOW the view volume y < z bit 3 point RIGHT OF the view volume x > -z bit 4 point LEFT OF the view volume x < z bit 5 point BEHIND the view volume z < - bit 6 point IN FRONT the view volume z > zmin 9

Cohen-Sutherland for 3D

computing intersection points.

  • Intersections with planes z=-1, z=zmin is the same.
  • Calculating intersections with a sloping plane …
  • For plane y=z these two equations are equal
  • Repeat for planes y=-z, x=z, x=-z

0 1 0 0 1 0 0 1 0

z z tz z

y y ty y

x x tx x

1 0 1 0 0 0 y y z z t z^ y − − −

=^ −

14

“3D Clipping” for HWs 4 & 5

• Only do trivial reject test

• For HW4 just do X and Y tests

• ‘AND’ all vertex bit codes for a polygon

• If result != 0, then reject polygon

– i.e. remove from projection pipeline

15

More Efficient Alternative?

• Use Cohen-Sutherland to do trivial reject

• Project remaining polygons onto view

plane

• Clip polygons in 2D

• Remember that user-defined window is

redefined for canonical view volumes!

16

end clipping

23

Selecting Intensities

• Dynamic range of a device

– Max intensity/Min intensity

– Min CRT intensity ~ 1/200th^ to 1/40th^ of max

• Gamma correction : adjusting intensities

to compensate for the device

– Look-up table

• How many intensities are enough?

– Can’t see changes below 1%

– 1.01 = (1/I 0 )1/n

– n = log1.01(1/I 0 ) 24

Chromatic Light!

• Let there be colored light!

• Major terms

  • Hue
    • Distinguish colors such as red, green, purple, etc.
  • Saturation
    • How far is the color from a gray of equal intensity (i.e. red=high saturation; pastels are low)
  • Lightness
    • Perceived intensity of the reflecting object
    • Brightness is used when the object is an emitter 25

Physics of Light and Color

  • Light: a physical phenomenon:
    • Electromagnetic radiation in the [400 nm-700nm] wavelength range
  • Color:psychological phenomenon:
    • Interaction of the light of different wavelength with our visual system. http://prometheus.cecs.csulb.edu/~jewett/colors/ 26

Spectral Energy Distributions

Foley/VanDam, 1990/

Photons

Wavelength (nm) 400 500 600 700 400 500 600 700

Photons

Wavelength (nm) Violet 388-440nm Blue 440-490nm Green 490-565nm Yellow 565-590nm Orange 590-630nm Red (^) White 630-780nm Less White (Gray) Laser

Photons

Wavelength (nm) 400 500 600 700 Pure day light 27

Colorimetry (Physics)

• Define color in terms of the light

spectrum and wavelengths

– Dominant Wavelength: what we see

– Excitation Purity: saturation

– Luminance: intensity of light

• Ex:

– Pure color, 100% saturated, no white light

– White/gray lights are 0% saturated

28

Specifying Colors

• Can we specify colors using spectral

distributions?

  • We can, but we do not want to.
  • More then one set of

distributions corresponds

to the same color. Reason?

  • Too much information^ # Photons 400 500 600 700 Wavelength (nm)

29

Seeing in Color

• The eye contains

rods and cones

  • Rods work at low light levels and do not see color
  • Cones come in three types (experimentally and genetically proven), each responds in a different way to frequency distributions http://www.thornlighting.com/ 30

Tristimulus Theory

• The human retina

has 3 color sensors

  • the cones

• Cones are tuned to

red, green and blue

light wavelengths

  • Note: R&G are both

“yellowish”

• Experimental data

Foley/VanDam, 1990/ 31

Luminous-Efficiency Function

• The eye’s response

to light of constant

luminance as the

dominant

wavelength is

varied

• Peak sensitivity is at

~550nm (yellow

-green light)

• This is just the sum

of the earlier curves Foley/VanDam, 1990/

32

Eye Sensitivity

• Can distinguish 100,000s of colors, side by side

• When color only differs in hue, wavelength

between noticeably different colors is between

2nm and 10nm (most within 4nm)

• Hence, 128 fully saturated hues can be

distinguished

• Less sensitive to changes in hue when light is

less saturated

• More sensitive at spectrum extremes to

changes in saturation a

  • about 23 distinguishable saturation grades/steps

• Luminance dynamic range: 10,000:

33

Device Sensitivity

• Eye luminance dynamic range, 10,000:

• Monitor luminance range, 200:

• How to recreate on a monitor/scanner

what the eye perceives?

• The focus of high dynamic range

imaging research

34

Specifying Colors

• Depends on the context

– Compare against standard samples

  • i.e. the paint store, printing professions
  • PANTONE MATCHING SYSTEM

– Artistic mixtures of tint , shade , and tone

  • Tint == white + pure color, decreasing saturation
  • Shade == black + pure color, decreasing lightness
  • Tone == both

• Both are subjective

41

Color Models XYZ

  • Standard defined by

International

Commission on

Illumination (CIE) since

  • Defined to avoid

negative weights

  • These are not real

colors

Foley/VanDam, 1990/

X = k ∫ P ( λ) x λ d λ

Y = k ∫ P ( λ) y λ d λ

Z = k ∫ P ( λ) z λ d λ

42

Color Models XYZ

• Cone of visible

colors in CIE space

• X+Y+Z=1 plane is

shown

• Constant luminance

• Only depends on

dominant

wavelength and

saturation

Foley/VanDam, 1990/ 43

CIE Chromaticity Diagram

  • Plot colors on the x + y

+ z = 1 plane

(normalize by

brightness)

  • Gives us 2D

Chromaticity Diagram

http://www.cs.rit.edu/~ncs/color/a_chroma.html

x = X + XY + Z

y = X + Y Y + Z

z = Z

X + Y + Z

44

Working with Chromaticity

Diagram

  • C is “white” and close to

x=y=z=1/

  • E and F can be mixed

to produce any color

along the line EF

  • Dominant wavelength of

a color B is where the

line from C through B

meets the spectrum

(D).

  • BC/DC gives saturation

D

B

C

A

E F

i

j

k

http://www.cs.rit.edu/~ncs/color/a_chroma.html 45

Working with Chromaticity

Diagram

  • A & B are

“complementary”

colors. They can be

combined to produce

white light

  • Colors inside ijk are

linear combinations of

i, j & k

D

B

C

A

E F

i

j

k

http://www.cs.rit.edu/~ncs/color/a_chroma.html 46

Gamut

  • Gamut : all colors

produced by adding

colors - a polygon

  • Green contour – RGB

Monitor

  • White – scanner
  • Black – printer
  • Problem: How to capture the color of an original image with a scanner, display it on the monitor and print out on the printer?

http://www.cs.rit.edu/~ncs/color/a_chroma.html

A triangle can’t cover the space → Can’t produce

all colors by adding 3 different colors together

47

Color Models YIQ

  • National Television System

Committee (NTSC)

  • Y is same as XYZ model and

represents brightness.

Uses 4MHz of bandwidth.

  • I contains orange-cyan hue information (skin tones).

Uses about 1.5 Mhz

  • Q contains green-magenta hue information.

Uses about 1.5 Mhz

  • B/W TVs use only Y signal. .299.587.144.596.275.321.212.528.3111.0.956.6201.0.272.6471.01.1081.705 YRIGQBRYGIBQ =−−∗−=−−∗− €

Y

I

Q

R

G

B

48

Tint-Shade-Tone

  • Relationships of tints,

shades and tones.

  • Tints - mixture of

color with white.

  • Shades – mixture of

color with black.

  • Both ignore one

dimension.

  • Tones respect all three. Foley/VanDam, 1990/ 49

HSB: hue, saturation, and

brightness

  • Also called HSV (hue saturation value)
  • Hue is the actual color. Measured in degrees around the cone (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). At 0% saturation, hue is meaningless.
  • Brightness is measured in percent from black (0) to white (100). At 0% brightness, both hue and saturation are meaningless. http://www.mathworks.nl/ 50

HLS hue, lightness, saturation

http://www.adobe.com

  • Developed by Tektronix
  • Hue define like in HSB. Complimentary colors 180 apart
  • Gray scale along

vertical axis L from 0

black to 1 white

  • Pure hues lie in the

L=0.5 plane

  • Saturation again is

similar to HSB model