Presentation is loading. Please wait.

Presentation is loading. Please wait.

David Luebke9/7/2015 CS 551 / 645: Introductory Computer Graphics David Luebke

Similar presentations


Presentation on theme: "David Luebke9/7/2015 CS 551 / 645: Introductory Computer Graphics David Luebke"— Presentation transcript:

1 David Luebke9/7/2015 CS 551 / 645: Introductory Computer Graphics David Luebke cs551@cs.virginia.edu http://www.cs.virginia.edu/~cs551

2 David Luebke9/7/2015 Administrivia l Final exam: –Tuesday December 14, 9 AM to noon in MEC 339 –Closed-book, closed-note exam l Study notes: – PDF versions of six slides-per-page handouts will be put on the course web page

3 David Luebke9/7/2015 Review For Test l 3-D graphics: Transform Illuminate Transform Clip Project Rasterize Model & Camera Parameters Rendering Pipeline FramebufferDisplay

4 David Luebke9/7/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

5 David Luebke9/7/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

6 David Luebke9/7/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

7 David Luebke9/7/2015 Recap: 3-D Clipping 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

8 David Luebke9/7/2015 3-D Clipping l Recall this sequence of diagrams: Clip against view volume Apply projection matrix and homogeneous divide Transform into viewport for 2-D display Apply normalizing transformation projection matrix; homogeneous divide Transform into viewport for 2-D display Clip against canonical view volume Clip against view volume Apply projection matrix Transform into viewport for 2-D display Homogeneous divide

9 David Luebke9/7/2015 Canonical Perspective Coordinates 1 x or y z Front or hither plane Back or yon plane Why is this going to be simpler?

10 David Luebke9/7/2015 Visible Surface Determination l Why might a polygon be invisible? –Polygon outside the field of view: view-frustum culling –Polygon is backfacing: backface culling –Polygon is occluded by object(s) nearer the viewpoint: occlusion culling Efficiency Efficiency & Correctness

11 David Luebke9/7/2015 View-Frustum Culling l Clump primitives and classify clump bounding volumes as inside, outside, or intersecting view frustum l If bounding volume isn’t in frustum, don’t draw primitives in clump l For better performance, use a hierarchy of bounding volumes –Spheres –Bounding boxes –Others

12 David Luebke9/7/2015 l On the surface of a closed manifold, polygons whose normals point away from the camera are always occluded: Back-Face Culling

13 David Luebke9/7/2015 Occlusion l Need to find visible polygon fragments: –Upper bound on fragments?

14 David Luebke9/7/2015 Occlusion l Painter’s Algorithm (and problem cases) l Binary Space Partition (BSP) Tree –Splitting planes, recursively divide space into half- spaces –Allows front-to-back traversal, thus painter’s alg. –Know the pros and cons l Warnock’s Algorithm –Clip objects to viewport –If number of objects is 0 or 1, visibility is trivial –Else subdivide into smaller viewports and recurse

15 David Luebke9/7/2015 The Z-Buffer Algorithm l Resolve visibility independently at each pixel: l Interpolating Z: just another (planar) parameter

16 David Luebke9/7/2015 Z-Buffer Pros and Cons l Pros: –Simple –Good for hardware –Handles polygon interpenetration and overlap –Handles polygons in arbitrary order l Cons –Lots of memory (16 bits barely okay, 32 bits best) –Needs fast memory –Hard to do antialiasing/translucent –Precision issues

17 David Luebke9/7/2015 Visibility: Ray Casting l An example: ScreenEyepointScene

18 David Luebke9/7/2015 Cells & Portals l Works well for architectural models l Cells are regions of model mostly occluded from each other –Rooms, alcoves, corridors… l Transparent portals connect cells on their boundaries –Doorways, entrances, windows… l Adjacency graph captures cell connectivity l Cells visible if  a line of sight through portals

19 David Luebke9/7/2015 Cells & Portals l View-dependent vs. view-independent solutions l pfPortals algorithm: –Recursive traversal of adjacency graph: –Treat portals as special polygons n If portal is visible, render adjacent cell n But clip to boundaries of portal! n Recursively check portals in that cell against new clip boundaries (and render) –Each visible portal sequence amounts to a series of nested portal boundaries n Kept implicitly on recursion stack

20 David Luebke9/7/2015 Lighting l Simulate physics/optics of surface illumination l Definitions: illumination vs. lighting vs. shading l Components of illumination: –Light sources n Position, direction, shape n Spectrum of emittance (color) & attenuation –Surface properties n Position, orientation n Reflectance spectrum (color) & micro-structure l Simplifications of various components

21 David Luebke9/7/2015 Phong-Style Lighting l Light-source approximations: –Ambient light sources –Directional light sources –Point light sources l Lambert’s Cosine Law and Lambertian surfaces l Specular reflection –Microgeometry (underlying reasoning) –Cosine-to-a-power (empirical hack)

22 David Luebke9/7/2015 Phong-Style Lighting l Understand this equation and where its terms all came from:

23 David Luebke9/7/2015 Lighting & Shading l Lighting: applying illumination calculations l Shading: coloring pixels (interpolation) –Flat shading –Gouraud shading –Phong shading

24 David Luebke9/7/2015 Texture Mapping

25 David Luebke9/7/2015 Texture Mapping l Texture coordinates l Perspective-correct interpolation of texture coordinates –Basically, interpolate u/z and v/z rather than u and v l Texture-map antialiasing –The problem: uneven pixel-texel coverage –Bilinear interpolation –MIP-maps and trilinear interpolation

26 David Luebke9/7/2015 Texture Maps l Value stored in texels can modulate other parameters besides color: –Bump-mapping: use texture to perturb surface normal used for lighting calculations –Displacement mapping: actually displace geometry, applying texture as a height-field –Illumination mapping: combine a low-res brightness map with a high-res texture map –Shadow maps: store depth from light source l 3-D textures work well for marble, wood

27 David Luebke9/7/2015 OpenGL l Conventions: –glVertex3fv, etc –gluPerspective l Specifying geometry (list of vertices) l Triangle strips & fans l Be able to reason about simple OpenGL lighting code l Modeling transforms l Double-buffering for flicker-free animation

28 David Luebke9/7/2015 Animation & The Scene Graph l Instancing –OpenGL display lists l The scene graph captures transformations and object-object relationships in a DAG l Traversing the scene graph with the OpenGL matrix stack

29 David Luebke9/7/2015 Ray Tracing l Recursive ray tracing: primary and secondary (reflected & refracted) rays l Shadow rays l Representing rays parametrically: R = O + tD l Intersecting rays with spheres –Don’t know the details l Intersecting rays with polygons –Know (or be able to derive) the details

30 David Luebke9/7/2015 Shadow Rays l The concept l The problems: –Lots of computation n Light buffer n Shadow ray cahcing –Infinitely sharp shadows n Shoot more shadow rays or larger shadow rays –No translucent object shadows (caustics) n Can fake it though

31 David Luebke9/7/2015 Accelerating Ray Tracing l Hierarchical bounding volumes –Spheres vs. AABBs vs. OBBs l Spatial partitions –Grid vs. octree vs BSP tree

32 David Luebke9/7/2015 Level of Detail l Traditional static LOD: start with original highly-detailed object and create multiple levels of detail (LODs) in a preprocess l Creating levels of detail: mechanisms –Sample-and-reconstruct –Decimation –Vertex-merging –Adaptive subdivision l Creating levels of detail: criteria –Geometric criteria (e.g., curvature) –Visual criteria (e.g., coloration or texture maps)

33 David Luebke9/7/2015 Dynamic LOD l Create a data structure (the vertex tree) in preprocess and extract desired LOD at runtime l Enables view-dependent LOD, for example: –Distant regions in lower detail than nearby regions –Silhouette regions in higher detail l Vertex tree: hierarchical clustering of vertices –Folding/unfolding nodes –Tris and subtris

34 David Luebke9/7/2015 Radiosity l Models light transfer among surfaces in a scene l Simplifying assumptions: –Surface consists of uniformly lit patches –Surfaces are Lambertian (perfectly diffuse) –Environment is closed l Definitions: radiosity, reflectivity, form factors

35 David Luebke9/7/2015 Radiosity The radiosity equation: B i = E i +  i  B j F ij l Know the matrix form and what it means l Computing form factors –Relevant factors (distance, shape, etc). –Hemicube algorithm (pros & cons) –Ray casting (pros & cons) l End result: a colored polygonal model –View-independent solution!


Download ppt "David Luebke9/7/2015 CS 551 / 645: Introductory Computer Graphics David Luebke"

Similar presentations


Ads by Google