Download presentation
Presentation is loading. Please wait.
Published byAldous Townsend Modified over 9 years ago
1
David Luebke10/21/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu http://www.cs.virginia.edu/~cs551
2
David Luebke10/21/2015 Administrivia l Course evaluations on the web –Help make this class better next semester l Looking into alternative location for final –Who wants to move?
3
David Luebke10/21/2015 The Plan l Today –Finish up radiosity –Recap up till midterm l Tomorrow –Recap since midterm
4
David Luebke10/21/2015 Recap: Radiosity Fundamentals l Model light transfer between patches as a system of linear equations l Solving this system gives the intensity at each patch –Simplifying assumptions: n Environment is closed n All surfaces are Lambertian (perfectly diffuse) reflectors –Solving for R, G, B intensities produces color at each patch l Render patches as colored polygons
5
David Luebke10/21/2015 Recap: Radiosity Fundamentals l Radiosity is the rate at which energy leaves a surface l Radiosity = rate at which the surface emits energy + rate at which the surface reflects energy –Notice: previous methods distinguish light sources from surfaces –In radiosity all surfaces can emit light –Thus: all emitters inherently have area
6
David Luebke10/21/2015 Recap: The Radiosity Equation l For each patch i: B i = E i + i B j F ji (A j / A i ) where B i, B j = radiosity of patch i, j A i, A j = area of patch i, j E i = energy/area/time emitted by i i = reflectivity of patch i F ji = Form factor from j to i
7
David Luebke10/21/2015 Recap: Form Factors l Form factor: fraction of energy leaving the entirety of patch i that arrives at patch j, accounting for: –The shape of both patches –The relative orientation of both patches –Occlusion by other patches
8
David Luebke10/21/2015 Recap: The (Expanded) Radiosity Equation 1 - 1 F 11 - 1 F 12 … - 1 F 1n B 1 E 1 - 2 F 21 1 - 2 F 22 … - 2 F 2n B 2 E 2.. …... - p n F n1 - n F n2 … 1 - n F nn B n E n Note: E i values zero except at emitters Note: Fii is zero for convex or planar patches l Note: sum of form factors in any row = 1 (Why?) l Note: n equations, n unknowns!
9
David Luebke10/21/2015 Recap: Evaluating Form Factors (Hemicubes) l Hemicube algorithm: Think Z-buffer –Render the model onto a hemicube as seen from the center of patch i –Store item IDs instead of color –Use Z-buffer to resolve visibility l Advantages of hemicubes –Solves shape, size, orientation, and occlusion problems in one framework –Can use hardware Z-buffers to speed up form factor determination (How?)
10
David Luebke10/21/2015 Recap: Hemicubes l Disadvantages of hemicubes? –Aliasing! Low resolution buffer can’t capture actual polygon contributions very exactly n Causes “banding” near lights (plate 41) –Actual form factor is over area of patch; hemicube samples visibility at only center point on patch
11
David Luebke10/21/2015 Form Factors: Ray Casting l Idea: shoot rays from center of patch in hemispherical pattern
12
David Luebke10/21/2015 Form Factors: Ray Casting l Advantages: –Hemisphere better approximation than hemicube n More even sampling reduces aliasing –Don’t need to keep item buffer –Slightly simpler to calculate coverage
13
David Luebke10/21/2015 Form Factors: Ray Casting l Disadvantages: –Regular sampling still invites aliasing –Visibility at patch center still isn’t quite the same as form factor –Ray tracing is generally slower than Z-buffer-like hemicube algorithms n Depends on scene, though n What kind of scene might ray tracing actually be faster on?
14
David Luebke10/21/2015 Form Factors l Source-to-vertex form factors –Calculating form factors at the patch vertices helps address some problems: for every patch vertex for every source patch sample source evenly with rays visibility = % rays that hit –What are the problems with this approach?
15
David Luebke10/21/2015 Form Factors l Summary of form factor computation –Analytical: n Expensive or impossible (in general case) –Hemicube n Fast, especially using graphics hardware n Not very accurate; aliasing problems –Ray casting n Conceptually cleaner than hemicube n Usually slower; aliasing still possible
16
David Luebke10/21/2015 Radiosity Continued l Lots more to know about radiosity: –Progressive radiosity: viewing an approximate solution early –Hierarchical radiosity: increasing patch resolution on an as-needed basis
17
David Luebke10/21/2015 Review for Exam l Quick recap of lecture topics for exam… –Display technologies n Vector versus raster: what’s a pixel? n CRT (black & white, color): shadow mask, phosphors, electron guns n LCD: polarizing crystals that line up under an E-field, losing their polarization and acting as light valves n Pros and cons of different technologies –Framebuffers n Fast, dual-ported memory bank for holding pixels n True-color (24-bit) vs Pseudocolor (8-bit indexed) vs hi- color (16-bit, 6-6-4 ?)
18
David Luebke10/21/2015 Review For Exam l Color –Basic physiology: retina, rods, cones –Different types of cones: L, M, S –Metamers: perceptually identical color senstions caused by different spectra –CIE Color Space (X, Y, Z) n Color mix-and-match experiment n Hypothetical light sources X, Y, Z (why?) n Three dimensional shape, often simplified to 2-D gamut –Other color spaces (RGB, HSV) –Gamma correction: linearize non-linear response of display device
19
David Luebke10/21/2015 Review For Exam l Rasterizing lines –A methodology in optimizing code –Simplest way: solve slope-intercept equation n Check slope and step in X or Y –DDA: find incremental change per inner loop –Bresenham: take advantage of rational slope, endpoints to optimize with integer arithmetic
20
David Luebke10/21/2015 Review For Exam l Rasterizing polygons –Can break into triangles for convenience n Trivial for convex polys, difficult for complex polys –Edge equations: n Evaluate equation of edge (linear expression) per pixel n If all three edges are positive, light pixel n Can evaulate R,G,B, Z as linear expressions too n Hardware: SIMD array n Software: bounding box n Issues: ensuring consistent edge equations, numerical stability when evaluating edge equations
21
David Luebke10/21/2015 Review For exam l Rasterizing triangles: edge walking –Find edges (DDA) –Interpolate colors down edges –Interpolate colors across scanlines –Fast: touches only pixels necessary –Difficult: lots of special cases, fractional offsets, precision worries l Rasterizing triangles: general issues –Need consistent rules about pixels right on edge
22
David Luebke10/21/2015 Review For Test l Can also rasterize general polygons –Active edge table: sort edges by y min and y max, then by x intersection w/ scanline –March up scanline by scanline, filling pixels according to parity rule –Hard to interpolate color, etc. correctly -- not planar in color space, in general
23
David Luebke10/21/2015 Review For Test l Clipping –Want only portions of lines, polygons in viewport –Cohen-Sutherland line clipping: binary outcodes –Polygon clipping is harder n Triangle in, 7-gon out n Concave polyon in, 2 polygons out –Sutherland-Hodgman: clip against view planes in succession n In-out rules n Line-plane intersection
24
David Luebke10/21/2015 Review For Test l Clipping in 3-D –Sutherland-Hodgman extends easily to clipping against six view-frustum planes –Issue: when in the pipeline to clip? n World coordinates: arbitrary planes expensive n Camera coordinates: two planes easy, four hard n Canonical perspective coordinates: two easy, four okay n Canonical orthographic coordinates/screen coordinates: reduces matrix multiplies, requires clipping in homogeneous coordinates n Common shortcut: clip near-far in camera coordinates, multiply by perspective matrix, clip left-right-top-bottom
25
David Luebke10/21/2015 Review For Test l 3-D graphics: Transform Illuminate Transform Clip Project Rasterize Model & Camera Parameters Rendering Pipeline FramebufferDisplay
26
David Luebke10/21/2015 Review For Test l Rendering pipeline: Modeling Transforms Scene graph Object geometry Lighting Calculations Viewing Transform Clipping Projection Transform Result: All vertices of scene in shared 3-D “world” coordinate system All vertices of scene in shared 3-D “world” coordinate system Vertices shaded according to lighting model Vertices shaded according to lighting model Scene vertices in 3-D “view” or “camera” coordinate system Scene vertices in 3-D “view” or “camera” coordinate system Exactly those vertices & portions of polygons in view frustum Exactly those vertices & portions of polygons in view frustum 2-D screen coordinates of clipped vertices 2-D screen coordinates of clipped vertices
27
David Luebke10/21/2015 Review For Test l Transformations –Shift in coordinate systems (basis sets) –Accomplished via matrix multiplication –Modeling transforms: object->world –Viewing transform: world->view –Projection transform: view->screen
28
David Luebke10/21/2015 Review For Test l Rigid-body transforms –Rotation: 2-D. 3-D (canonical & arbitrary axis) –Scaling –Translation: homogeneous coords, 4x4 matrices –Composiing transforms n Matrix multiplication n Order from right to left l Projection transforms –Geometry of perspective projection –Derive perspective projection matrix
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.