Download presentation
Presentation is loading. Please wait.
Published byAubrey Jennings Modified over 8 years ago
1
Graphics Review Geometry, Color & Shading Brad Tennis Leslie Wu 10.24.06
2
Topics ● Foundations of 2D graphics Coordinate systems Matrices Transformations Algorithms Splines
3
Topics cont. ● Color Physical Basis, Representation Reflection Models Shading
4
Coordinate Systems Cartesian coordinates (x, y) note: (x h, y h, h) with h = 0 corresponds to point at infinity Homogeneous coordinate (x h, y h, h) where x = x h / h y = y h / h
5
Basic definitions ● Affine transformation: Parallel lines map to parallel lines Finite points map to finite points Examples in 2D: ● Translation, rotation, scaling, reflection, shear
6
Transformation Matrices ● Translation ● Rotation ● Scaling
7
Matrix Properties ● Translation is additive ● Rotation is additive ●...both are commutative ● Rotation matrices are orthogonal
8
Algorithms ● Clipping Interior = saves inside region Exterior = saves parts outside of region ● Intersection Point in triangle ● Can be computed using cross-products (see handout)
9
Splines ● Spline curve Composite curve made out of polynomial sections Satisfies continuity conditions at section boundaries Control points Control graph / characteristic polygon
10
Continuity ● Parametric continuity Zero-order (C 0 ) : curves meet First-order (C 1 ) : first parametric derivatives same Second-order (C 2 ): 1 st and 2 nd derivatives same ● Geometric continuity Zero-order (G 0 ) : same as C 0 First-order (G 1 ) : 1 st derivatives proportional Second-order (G 2 ) : 1 st and 2 nd derivatives proportional
11
Bezier Splines ● Properties Curve is polynomial of degree (# control points – 1) Can be defined recursively ● For example, to plot midpoint of Bezier of degree two
12
Physical Basis Humans can distinguish roughly 10 million colors The eye has three different types of cones The response of each peaks at either 420, 534 or 564 nm http://en.wikipedia.org/wiki/Image:Srgbspectrum.png
13
Additive Color Combination of emitters of different wavelengths RGB Color (e.g., monitors) http://en.wikipedia.org/wiki/Image:RGB_illumination.jpg
14
Subtractive Color Combination of absorbers of different wavelengths CMYK Color (e.g., printers) http://en.wikipedia.org/wiki/Image:Synthese-.svg
15
Color Representation Each light is modeled as the summation of three monochromatic lights (RGB) Each object has a collection of material properties which determine how it reflects light
16
Diffuse Reflection Lambert’s Law: The reflection from a perfectly matte surface is proportional to the dot product of the surface normal and light vector i diff = (nl)m diff ⊗ s diff
17
Specular Reflection Not all materials are perfectly matte, and shiny objects tend to reflect primarily along the reflected light vector i spec = (vr) m shi m spec ⊗ s spec
18
Ambient Reflection Sometimes light reaches an object indirectly (e.g., from bouncing off walls in the scene) i amb = m amb ⊗ s amb
19
Emission Sometimes a surface might represent a light Note that emissive surfaces do not light other objects i em = m em
20
Putting it Together The materials model used by most graphics systems isn’t necessarily physically accurate However, it provides a enough control to the programmer for most any effect i tot = i diff + i spec + i amb + i em
21
Transparency Typically implemented with a color buffer Unless objects are rendered back to front, pixels can get incorrect colors c new = α src c src + (1-α src )c dest http://en.wikipedia.org/wiki/Image:Butterfly_transparent.jpg
22
Shading Techniques Flat Gouraud Phong http://www.cs.cmu.edu/~ph/nyit/facet_gouraud_phong.jpeg
23
Shading Comparison Flat shading is very fast, but looks blocky Phong shading looks great, but is difficult to compute Gouraud shading offers a balance of speed and quality
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.