page 1
play

Page 1 1 Review: Projection Taxonomy Review: Midpoint Algorithm - PDF document

University of British Columbia News CPSC 314 Computer Graphics P1 demos if you missed them May-June 2005 3:30-4:30 today Tamara Munzner Lighting/Shading I, II, III Week 3, Tue May 24 http://www.ugrad.cs.ubc.ca/~cs314/Vmay2005


  1. University of British Columbia News CPSC 314 Computer Graphics � P1 demos if you missed them May-June 2005 � 3:30-4:30 today Tamara Munzner Lighting/Shading I, II, III Week 3, Tue May 24 http://www.ugrad.cs.ubc.ca/~cs314/Vmay2005 � Homework 2 Clarification Clarification: N2D General Formulation � translate, scale, reflect � off-by-one problem in Q4-6 glViewport(c,d,a,b); � Q4 should refer to result of Q1 (1,1) (1,1) (w,h) (w,h) � Q5 should refer to result of Q2 � Q6 should refer to result of Q3 DCS DCS b NDCS NDCS � acronym confusion a d (-1,-1) � Q1 uses W2C, whereas notes say W2V c (0,0) (0,0) � world to camera/view/eye � x D = (a*x N )/2 + (a/2)+c � Q2 uses C2P, whereas notes say V2C, C2N � y D = - ((b*y N )/2 + (b/2)+d) � Q3 uses N2V, whereas notes say N2D � z D = z N /2 + 1 � normalized device to viewport/device � � Reading: Today Reading: Next Time � FCG Chap 8, Surface Shading, p 141-150 � FCG Chap 11.1-11.4 � RB Chap Lighting � FCG Chap 13 � RB Chap Blending, Antialiasing, Fog, Polygon Offsets � only Section Blending � � Page 1 1

  2. Review: Projection Taxonomy Review: Midpoint Algorithm � moving horizontally along x direction planar planar projections projections � draw at current y value, or move up vertically to y+1? � check if midpoint between two possible pixel centers perspective: perspective: above or below line 1,2,3 1,2,3-point point parallel parallel � candidates � top pixel: (x+1,y+1) � bottom pixel: (x+1, y) orthographic orthographic oblique oblique � midpoint: (x+1, y+.5) cabinet cabinet cavalier cavalier � check if midpoint above or below line � below: top pixel axonometric: axonometric: � above: bottom pixel top, top, http://ceprofs.tamu.edu/tkramer/ENGR%20111/5.1/20 isometric isometric front, front, � key idea behind Bresenham dimetric dimetric side side trimetric trimetric � [demo] � � Review: Flood Fill Review: Scanline Algorithms � simple algorithm � scanline: a line of pixels in an image � draw edges of polygon � set pixels inside polygon boundary along horizontal lines one pixel apart vertically � use flood-fill to draw interior 3 1 P 5=0 2 P 4 � �� Review: General Polygon Rasterization Review: Making It Fast: Bounding Box � smaller set of candidate pixels � loop over xmin, xmax and ymin,ymax instead of all x, all y � idea: use a parity test for each scanline edgeCnt = 0; for each pixel on scanline (l to r) if (oldpixel->newpixel crosses edge) edgeCnt ++; // draw the pixel if edgeCnt odd if (edgeCnt % 2) setPixel(pixel); �� Page 2 2

  3. Review: Bilinear Interpolation Review: Barycentric Coordinates ( α,β,γ α,β,γ ) = α,β,γ ) = ( α,β,γ α,β,γ α,β,γ α,β,γ α,β,γ P (1,0,0) (1,0,0) � interpolate quantity along L and R edges, � weighted combination of vertices 1 as a function of y β = 0 � smooth mixing ( α,β,γ α,β,γ ) = α,β,γ ) = ( α,β,γ α,β,γ α,β,γ α,β,γ α,β,γ (0,0,1) (0,0,1) β = 0 . 5 � then interpolate quantity as a function of x � speedup P 3 � compute once per triangle P 1 P P β = 1 = α ⋅ + β ⋅ + γ ⋅ P P P P P 1 2 3 ( ( α,β,γ α,β,γ α,β,γ α,β,γ α,β,γ α,β,γ ) = ) = α,β,γ α,β,γ 2 (0,1,0) (0,1,0) α + β + γ = 1 P 3 P P(x,y) P(x,y) 0 ≤ α , β , γ ≤ 1 for points inside triangle P L P P R P y y “convex combination convex combination “ of points” of points” P P 2 �� �� Correction/Review: Deriving Barycentric Review: Deriving Barycentric Coordinates Coordinates P (1,0,0) (1,0,0) 1 ( α,β,γ ( α,β,γ ) = α,β,γ α,β,γ α,β,γ α,β,γ ) = � non-orthogonal � 2D triangle area α,β,γ α,β,γ P (1,0,0) (1,0,0) 1 coordinate system α = A P1 A / A (0,0,1) (0,0,1) P � P 3 is origin, P 2 -P 3 , P 1 - 3 ( α,β,γ α,β,γ ) = α,β,γ ) = ( α,β,γ α,β,γ α,β,γ α,β,γ α,β,γ P β = A / A A P 3 are basis vectors (0,0,1) (0,0,1) 3 P P 2 2 A P P P γ = 3 A / A A P3 3 P P 1 P A (0,1,0) (0,1,0) P 1 P � from bilinear 2 P A = + A + A + A 1 P P P P 3 2 1 ( ( α,β,γ α,β,γ α,β,γ ) = α,β,γ α,β,γ α,β,γ ) = α,β,γ α,β,γ 2 interpolation of point P (0,1,0) (0,1,0) on scanline P P 3 P L P P P P P R d d 2 2 : : d d 1 1 �� �� P P 2 Review: Simple Model of Color Review: Trichromacy and Metamers � simple model based on RGB triples � three types of cones � component-wise multiplication of colors � color is combination of cone stimuli � (a0,a1,a2) * (b0,b1,b2) = (a0*b0, a1*b1, a2*b2) � metamer: identically perceived color caused by very different spectra � why does this work? �� �� Page 3 3

  4. Review: Color Constancy Clarification/Review: Stroop Effect � blue � green � purple � red � orange � say what color the text is as fast as possible � interplay between cognition and perception �� �� Review: Measured vs. CIE Color Spaces Review: Device Color Gamuts � compare gamuts on CIE chromaticity diagram � gamut mapping measured basis � � transformed basis monochromatic lights � � “imaginary” lights physical observations � � all positive, unit area negative lobes � � Y is luminance �� �� Review: RGB Color Space Review: Additive vs. Subtractive Colors � define colors with (r, g, b) � additive: light � � � � � � C 1 R amounts of red, green, and � monitors, LCDs � � � � � � blue M = 1 − G � � � � � � � RGB model � used by OpenGL � � � � � � � � � � � � Y 1 B � subtractive: pigment � printers � CMY model � RGB color cube sits within CIE color space � subset of perceivable colors �� �� Page 4 4

  5. Review: HSV Color Space Review: YIQ Color Space I � color model used for color TV � hue: dominant wavelength, “color” Q � saturation: how far from grey � Y is luminance (same as CIE) � value/brightness: how far from � I & Q are color (not same I as HSI!) black/white � using Y backwards compatible for B/W TVs � cannot convert to RGB with matrix � conversion from RGB is linear alone � � � � � � Y 0 . 30 0 . 59 0 . 11 R � � � � � � = − − I 0 . 60 0 . 28 0 . 32 G � � � � � � � � � � � � � Q � � 0 . 21 − 0 . 52 0 . 31 � � B � � green is much lighter than red, and red lighter than blue �� �� Review: Monitors � monitors have nonlinear response to input � characterize by gamma γ (maxIntensity) � displayedIntensity = a γ γ γ � gamma correction γ � γ � � 1 / Lighting I � a � displayedIntensity = (maxIntensity) � � = a (maxIntensity) �� �� Goal Photorealistic Illumination model interaction of light with matter in a way that appears realistic and is fast � phenomenological reflection models � ignore real physics, approximate the look � simple, non-physical � Phong, Blinn-Phong � physically based reflection models � simulate physics � BRDFs: Bidirectional Reflection Distribution Functions [ [electricimage.com electricimage.com] ] �� �� Page 5 5

  6. Photorealistic Illumination Fast Local Illumination [ [electricimage.com electricimage.com] ] �� �� Illumination Components of Illumination � two components: light sources and surface properties � transport of energy from light sources to � light sources (or emitters ) surfaces & points spectrum of emittance (i.e., color of the light) � includes direct and indirect illumination � geometric attributes � � position � direction � shape � directional attenuation � polarization Images by Henrik Wann Jensen �� �� Components of Illumination Illumination as Radiative Transfer � radiative heat transfer approximation � surface properties � substitute light for heat reflectance spectrum (i.e., color of the surface) � � light as packets of energy (photons) � subsurface reflectance � particles not waves � geometric attributes � model light transport as packet flow � position � orientation � micro-structure thermometer/eye energy packets heat/light source reflective objects �� �� Page 6 6

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend