Docsity

3D Clipping - Computer Graphics - Lecture Notes | CS 430, Lab Reports of Computer Graphics

Partial preview of the text

Download 3D Clipping - Computer Graphics - Lecture Notes | CS 430 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

Outline

  • 3D Clipping
  • Light
  • Physical Properties of Light and Color
  • Eye Mechanism for Color
  • Systems to Define Light and Color

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

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 t z z y y t y y x x t x x = + − = + − = + − ( ) ( 1 ) 1 0 0 y y y t − − =

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

“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

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!

17

Achromatic Light

  • Light without color
  • Basically Black-and -White
  • Defined in terms of “energy” (physics) - Intensity and luminance - or Brightness (perceived intensity) http://www.thornlighting.com/

Quantizing Intensities

  • Q: Given a limited number of colors/ shades, which ones should we use?
  • Suppose we want 256 “shades”
  • Idea #1 (bad)
    • 128 levels from 0.0 – 0.
    • 128 levels from 0.9 – 1.
    • Problems
      • Discontinuities at 0.
      • Uneven distribution of samples

Optical Illusion

Optical Illusion Revealed

23

Selecting Intensities

  • Dynamic range of a device
    • Max intensity/Min intensity
    • Min CRT intensity ~ 1/ th to 1/ th 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 = log
      1. (1/I 0 )

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