Computer Graphics I Lecture 11

Similar documents
CHAPTER 1 Graphics Systems and Models 3

Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL

Lighting and Shading Computer Graphics I Lecture 7. Light Sources Phong Illumination Model Normal Vectors [Angel, Ch

Curves and Surfaces Computer Graphics I Lecture 9

GLOBAL EDITION. Interactive Computer Graphics. A Top-Down Approach with WebGL SEVENTH EDITION. Edward Angel Dave Shreiner

Splines Computer Graphics I Lecture 10

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

Pipeline Operations. CS 4620 Lecture 14

Computer Graphics Disciplines. Grading. Textbooks. Course Overview. Assignment Policies. Computer Graphics Goals I

Topics and things to know about them:

Curves and Surfaces Computer Graphics I Lecture 10

Pipeline Operations. CS 4620 Lecture 10

Homework #2. Shading, Projections, Texture Mapping, Ray Tracing, and Bezier Curves

Course Title: Computer Graphics Course no: CSC209

CS 464 Review. Review of Computer Graphics for Final Exam

Introduction to Computer Graphics

Computer Graphics Curves and Surfaces. Matthias Teschner

Mathematical Tools in Computer Graphics with C# Implementations Table of Contents

Graphics for VEs. Ruth Aylett

Graphics and Interaction Rendering pipeline & object modelling

Transformations Computer Graphics I Lecture 4

Homework #2. Hidden Surfaces, Projections, Shading and Texture, Ray Tracing, and Parametric Curves

CS451Real-time Rendering Pipeline

QUESTION BANK 10CS65 : COMPUTER GRAPHICS AND VISUALIZATION

Transformations Computer Graphics I Lecture 4

Computer Graphics. - Texturing Methods -

CS 130 Final. Fall 2015

Blue colour text questions Black colour text sample answers Red colour text further explanation or references for the sample answers

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Topic 12: Texture Mapping. Motivation Sources of texture Texture coordinates Bump mapping, mip-mapping & env mapping

Spatial Data Structures

Topic 11: Texture Mapping 11/13/2017. Texture sources: Solid textures. Texture sources: Synthesized

For each question, indicate whether the statement is true or false by circling T or F, respectively.

SRM INSTITUTE OF SCIENCE AND TECHNOLOGY

COMP30019 Graphics and Interaction Rendering pipeline & object modelling

Lecture outline. COMP30019 Graphics and Interaction Rendering pipeline & object modelling. Introduction to modelling

Computer Graphics. Instructor: Oren Kapah. Office Hours: T.B.A.

Height Fields and Contours Scalar Fields Volume Rendering Vector Fields [Angel Ch. 12] April 23, 2002 Frank Pfenning Carnegie Mellon University

Graphics for VEs. Ruth Aylett

Topic 11: Texture Mapping 10/21/2015. Photographs. Solid textures. Procedural

Lecture IV Bézier Curves

Clipping and Scan Conversion

CS230 : Computer Graphics Lecture 4. Tamar Shinar Computer Science & Engineering UC Riverside

Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation

Computer Graphics Introduction. Taku Komura

Module Contact: Dr Stephen Laycock, CMP Copyright of the University of East Anglia Version 1

Reading. 18. Projections and Z-buffers. Required: Watt, Section , 6.3, 6.6 (esp. intro and subsections 1, 4, and 8 10), Further reading:

Lahore University of Management Sciences. CS 452 Computer Graphics

CEng 477 Introduction to Computer Graphics Fall 2007

The University of Calgary

3D Modeling Parametric Curves & Surfaces. Shandong University Spring 2013

Computer Science 426 Midterm 3/11/04, 1:30PM-2:50PM

Visualization Computer Graphics I Lecture 20

3D Modeling Parametric Curves & Surfaces

The Viewing Pipeline Coordinate Systems

CEng 477 Introduction to Computer Graphics Fall

Final Exam CS 184: Foundations of Computer Graphics! page 1 of 12!

Spatial Data Structures

Until now we have worked with flat entities such as lines and flat polygons. Fit well with graphics hardware Mathematically simple

Projections and Hardware Rendering. Brian Curless CSE 557 Fall 2014

Orthogonal Projection Matrices. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

CS 488. More Shading and Illumination. Luc RENAMBOT

Information Coding / Computer Graphics, ISY, LiTH. Splines

Computer Graphics. Lecture 14 Bump-mapping, Global Illumination (1)

Level of Details in Computer Rendering

MODELING AND HIERARCHY

Lecture 1. Computer Graphics and Systems. Tuesday, January 15, 13

Computer Graphics CS 543 Lecture 13a Curves, Tesselation/Geometry Shaders & Level of Detail

CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions. The Midterm Exam was given in class on Thursday, October 23, 2008.

CSE 167: Introduction to Computer Graphics Lecture #13: Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017

Rendering. Illumination Model. Wireframe rendering simple, ambiguous Color filling flat without any 3D information

Institutionen för systemteknik

COM337 COMPUTER GRAPHICS Other Topics

3D GRAPHICS. design. animate. render

Shape Representation Basic problem We make pictures of things How do we describe those things? Many of those things are shapes Other things include

Introduction Rasterization Z-buffering Shading. Graphics 2012/2013, 4th quarter. Lecture 09: graphics pipeline (rasterization and shading)

Spring 2012 Final. CS184 - Foundations of Computer Graphics. University of California at Berkeley

Objectives Shading in OpenGL. Front and Back Faces. OpenGL shading. Introduce the OpenGL shading methods. Discuss polygonal shading

CS130 : Computer Graphics Curves (cont.) Tamar Shinar Computer Science & Engineering UC Riverside

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

Graphics Pipeline 2D Geometric Transformations

Lahore University of Management Sciences. CS 452 Computer Graphics

Overview: Ray Tracing & The Perspective Projection Pipeline

Surface Graphics. 200 polys 1,000 polys 15,000 polys. an empty foot. - a mesh of spline patches:

Viewing and Projection

Graphics Hardware and Display Devices

Midterm Exam! CS 184: Foundations of Computer Graphics! page 1 of 13!

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

Lighting. To do. Course Outline. This Lecture. Continue to work on ray programming assignment Start thinking about final project

CS-184: Computer Graphics

Shape modeling Modeling technique Shape representation! 3D Graphics Modeling Techniques

2D Spline Curves. CS 4620 Lecture 13

The Traditional Graphics Pipeline

Local Illumination. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

Computer Graphics: Programming, Problem Solving, and Visual Communication

Reflection and Shading

Rendering and Radiosity. Introduction to Design Media Lecture 4 John Lee

Central issues in modelling

3D Rasterization II COS 426

Computer Graphics 1. Chapter 7 (June 17th, 2010, 2-4pm): Shading and rendering. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2010

Transcription:

15-462 Computer Graphics I Lecture 11 Midterm Review Assignment 3 Movie Midterm Review Midterm Preview February 26, 2002 Frank Pfenning Carnegie Mellon University http://www.cs.cmu.edu/~fp/courses/graphics/

Announcements Assignment 4 due Thursday before lecture Lecture by John Ketchpaw Midterm next Tuesday In class Closed book One double-sided sheet of notes permitted Everything covered in lecture so far Assignment 3 movies Some flaws may be problems in production software Enjoy! 02/26/2002 15-462 Graphics I 2

1. Course Overview Revisited Modeling: how to represent objects Animation: how to control and represent motion Rendering: how to create images OpenGL graphics library 02/26/2002 15-462 Graphics I 3

2. Basic Graphics Programming The graphics pipeline Pipelines and parallelism Latency vs throughput Efficiently implementable in hardware Not so efficiently implementable in software Course approach: walk the pipeline left-to-right 02/26/2002 15-462 Graphics I 4

Graphics Functions Primitive functions (points, lines, polygons) Attribute functions (color, lighting, material) Transformation functions (homogeneous coord) Viewing functions (projections) Input functions (callbacks) Control functions (GLUT library calls) 02/26/2002 15-462 Graphics I 5

3. Interaction Client/Server Model Callbacks Double Buffering Hidden Surface Removal 02/26/2002 15-462 Graphics I 6

Client/Server Model Graphics hardware and caching Important for efficiency Need to be aware where data are stored Examples: vertex arrays, display lists 02/26/2002 15-462 Graphics I 7

Hidden Surface Removal Classic problem of computer graphics What is visible after clipping and projection? Object-space vs image-space approaches Object space: depth sort (Painter s algorithm) Image space: ray cast (z-buffer algorithm) Related: back-face culling 02/26/2002 15-462 Graphics I 8

4. Transformations Vector Spaces Affine and Euclidean Spaces Frames Homogeneous Coordinates Transformation Matrices OpenGL Transformation Matrices 02/26/2002 15-462 Graphics I 9

Geometric Interpretations Lines and line segments Convexity Dot product and projections Cross product and normal vectors Planes 02/26/2002 15-462 Graphics I 10

Lines and Line Segments Parametric form of line: P(α) = P 0 + α d Line segment between Q and R: P(α) = (1-α) Q + α R for 0 α 1 02/26/2002 15-462 Graphics I 11

Convex Hull Convex hull defined by P = α 1 P 1 + L + α n P n for a 1 + L + a n = 1 and 0 a i 1, i = 1,..., n 02/26/2002 15-462 Graphics I 12

Projection Dot product projects one vector onto other u v = u v cos(θ) [diagram correction: x = u] 02/26/2002 15-462 Graphics I 13

Normal Vector Cross product defines normal vector u v = n u v = u v sin(θ) Right-hand rule 02/26/2002 15-462 Graphics I 14

Plane Plane defined by point P 0 and vectors u and v u and v cannot be parallel Parametric form: T(α, β) = P 0 + α u + β v Let n = u v be the normal Then n (P P 0 ) = 0 iff P lies in plane 02/26/2002 15-462 Graphics I 15

Homogeneous Coordinates In affine space, P = α 1 v 1 + α 2 v 2 + α 3 v 3 + P 0 Define 0 P = 0, 1 P = P Points [α 1 α 2 α 3 1] T Vectors [δ 1 δ 2 δ 3 0] T Change of frame 02/26/2002 15-462 Graphics I 16

Affine Transformations Compose Rotations, translations, scalings Express in homogeneous coods (4 4 matrices) Apply from right to left! R p = (R z R y R x ) p = R z (R y (R x p)) Postmultiplication in OpenGL Think in terms of composition Translation to and from origin Remember geometric intuition 02/26/2002 15-462 Graphics I 17

5. Viewing and Projection Camera Positioning Parallel Projections Perspective Projections 02/26/2002 15-462 Graphics I 18

Camera in Modeling Coordinates Camera position is identified with a frame Either move and rotate the objects Or move and rotate the camera Those views are inverses! Each transformation Order of transformation glulookat utility 02/26/2002 15-462 Graphics I 19

Orthographic Projections Projectors perpendicular to projectoin plane Simple, but not realistic 02/26/2002 15-462 Graphics I 20

Perspective Viewing Characterized by foreshortening More distant objects appear smaller y/z = y p /d so y p = y/(z/d) Note this is non-linear! Need homogeneous coordinates 02/26/2002 15-462 Graphics I 21

Perspective Projection Matrix Represent multiple of point Solve with 02/26/2002 15-462 Graphics I 22

6. Hierarchical Models Matrix and attribute stacks Save and restore state Exploit natural hierarchical structure for Efficient rendering Example: bounding boxes (later in course) Concise specification of model parameters Example: joint angles Physical realism 02/26/2002 15-462 Graphics I 23

Hierarchical Objects and Animation Drawing functions are time-invariant Can be easily stored in display list Change parameters of model with time Redraw when idle callback is invoked 02/26/2002 15-462 Graphics I 24

Complex Objects Tree rather than linear structure Interleave along each branch Use push and pop to save state 02/26/2002 15-462 Graphics I 25

Unified View of Computer Animation Models with parameters Polygon positions, control points, joint angles,... n parameters define n-dimensional state space Animation defined by path through state space Define initial state, repeat: Render the image Move to next point (following motion curves) Animation = specifying state space trajectory 02/26/2002 15-462 Graphics I 26

Animation vs Modeling Modeling: what are the parameters? Animation: how do we vary the parameters? Sometimes boundary not clear Build models that are easy to control Hierarchical models often easy to control 02/26/2002 15-462 Graphics I 27

Basic Animation Techniques Traditional (frame by frame) Keyframing Procedural techniques Behavioral techniques Performance-based (motion capture) Physically-based (dynamics) 02/26/2002 15-462 Graphics I 28

7. Lighting and Shading Approximate physical reality Ray tracing: Follow light rays through a scene Accurate, but expensive (off-line) Radiosity: Calculate surface inter-reflection approximately Accurate, especially interiors, but expensive (off-line) Phong Illumination model: Approximate only interaction light, surface, viewer Relatively fast (on-line), supported in OpenGL 02/26/2002 15-462 Graphics I 29

Light Sources and Material Properties Appearance depends on Light sources, their locations and properties Material (surface) properties Viewer position Ray tracing: from viewer into scene Radiosity: between surface patches Phong Model: at material, from light to viewer 02/26/2002 15-462 Graphics I 30

Types of Light Sources Ambient light: no identifiable source or direction Point source: given only by point Distant light: given only by direction Spotlight: from source in direction Cut-off angle defines a cone of light Attenuation function (brighter in center) Light source described by a luminance Each color is described separately I = [I r I g I b ] T (I for intensity) Sometimes calculate generically (applies to r, g, b) 02/26/2002 15-462 Graphics I 31

Phong Illumination Model Calculate color for arbitrary point on surface Compromise between realism and efficiency Local computation (no visibility calculations) Basic inputs are material properties and l, n, v: l = vector to light source n = surface normal v = vector to viewer r = reflection of l at p (determined by l and n) 02/26/2002 15-462 Graphics I 32

Summary of Phong Model Light components for each color: Ambient (L_a), diffuse (L_d), specular (L_s) Material coefficients for each color: Ambient (k_a), diffuse (k_d), specular (k_s) Distance q for surface point from light source l = vector from light n = surface normal r = l reflected about n v = vector to viewer 02/26/2002 15-462 Graphics I 33

Normal Vectors Critical for Phong model (diffuse and specular) Must calculate accurately From geometry (e.g., differential calculus) From approximating surface (e.g., Bezier patch) Pitfalls Unit length (some OpenGL support) Surface boundary 02/26/2002 15-462 Graphics I 34

8. Shading in OpenGL Polygonal shading Material properties Approximating a sphere [example] 02/26/2002 15-462 Graphics I 35

Polygonal Shading Curved surfaces are approximated by polygons How do we shade? Flat shading Interpolative shading Gouraud shading Phong shading (different from Phong illumination) Two questions: How do we determine normals at vertices? How do we calculate shading at interior points? 02/26/2002 15-462 Graphics I 36

Gouraud Shading Special case of interpolative shading How do we calculate vertex normals? Gouraud: average all adjacent face normals Requires knowledge about which faces share a vertex 02/26/2002 15-462 Graphics I 37

Data Structures for Gouraud Shading Sometimes vertex normals can be computed directly (e.g. height field with uniform mesh) More generally, need data structure for mesh Key: which polygons meet at each vertex 02/26/2002 15-462 Graphics I 38

Drawing a Sphere Recursive subdivision technique quite general Interpolation vs flat shading effect 02/26/2002 15-462 Graphics I 39

Recursive Subdivision General method for building approximations Research topic: construct a good mesh Low curvature, fewer mesh points High curvature, more mesh points Stop subdivision based on resolution Some advanced data structures for animation Interaction with textures Here: simplest case Approximate sphere by subdividing icosahedron 02/26/2002 15-462 Graphics I 40

Subdivision Example Icosahedron after 3 subdivisions (fast converg.) 02/26/2002 15-462 Graphics I 41

9. Curves and Surfaces Parametric Representations Also used: implicit representations Cubic Polynomial Forms Hermite Curves Bezier Curves and Surfaces 02/26/2002 15-462 Graphics I 42

Parametric Forms Parameters often have natural meaning Easy to define and calculate Tangent and normal Curves segments (for example, 0 u 1) Surface patches (for example, 0 u,v 1) 02/26/2002 15-462 Graphics I 43

Approximating Surfaces Use parametric polynomial surfaces Important concepts: Join points for segments and patches Control points to interpolate Tangents and smoothness Blending functions to describe interpolation First curves, then surfaces 02/26/2002 15-462 Graphics I 44

Cubic Polynomial Form Degree 3 appears to be a useful compromise Curves: Each c k is a column vector [c kx c ky c kz ] T From control information (points, tangents) derive 12 values c kx, c ky, c kz for 0 k 3 These determine cubic polynomial form 02/26/2002 15-462 Graphics I 45

Geometry Matrix Calculate approximating polynomial from control point with geometry matrix M Each form of interpolation has its own geometry matrix 02/26/2002 15-462 Graphics I 46

Standard Methods Hermite curves Given by 2 points, 2 tangents C 1 continuity, intersect control points Bezier curves Given by 4 control points Intersects 2, others approximate tangent Bezier surface patches Given by 16 control points Intersects 4 corners, other approximate tangents 02/26/2002 15-462 Graphics I 47

Hermite Curves Another cubic polynomial curve Specify two endpoints and their tangents [diagram correction p9 = p ] 02/26/2002 15-462 Graphics I 48

Bezier Curves Widely used in computer graphics Approximate tangents by using control points 02/26/2002 15-462 Graphics I 49

10. Splines Approximating more than 4 control points Piecing together a longer curve or surface 02/26/2002 15-462 Graphics I 50

B-Splines Use 4 points, but approximate only middle two Draw curve with overlapping segments 0-1-2-3, 1-2-3-4, 2-3-4-5, 3-4-5-6, etc. Curve may miss all control points Smoother at joint points 02/26/2002 15-462 Graphics I 51

Cubic B-Splines Need m+2 control points for m cubic segments Computationally 3 times more expensive C 2 continuous at each interior point Derive as follows: Consider two overlapping segments Enforce C 0 and C 1 continuity Employ symmetry C 2 continuity follows 02/26/2002 15-462 Graphics I 52

Rendering by Subdivision Divide the curve into smaller subpieces Stop when flat or at fixed depth How do we calculate the sub-curves? Bezier curves and surfaces: easy (next) Other curves: convert to Bezier! 02/26/2002 15-462 Graphics I 53

Subdividing Bezier Curves Given Bezier curve by p 0, p 1, p 2, p 3 Find l 0, l 1, l 2, l 3 and r 0, r 1, r 2, r 3 Subcurves should stay the same! 02/26/2002 15-462 Graphics I 54

Preview I Physically based models Particle systems Spring forces (cloth) Collisions and constraints Rendering Clipping, bounding boxes Line drawing Scan conversion Anti-aliasing 02/26/2002 15-462 Graphics I 55

Preview II Textures and pixels Texture mapping Bump maps Environment maps Opacity and blending Filtering Image transformation Ray tracing Spatial data structures Bounding volumes 02/26/2002 15-462 Graphics I 56

Preview III Radiosity Inter-surface reflections Ray casting Scientific visualization Height fields and contours Isosurfaces Marching cubes Volume rendering Volume textures 02/26/2002 15-462 Graphics I 57

Announcements Assignment 4 due Thursday before lecture Lecture by John Ketchpaw Midterm next Tuesday In class Closed book One double-sided sheet of notes permitted Everything covered in lecture so far 02/26/2002 15-462 Graphics I 58