Rendering Pipeline/ OpenGL

Similar documents
Spline Curves. Color Interpolation. Normal Interpolation. Last Time? Today. glshademodel (GL_SMOOTH); Adjacency Data Structures. Mesh Simplification

Rendering Pipeline/ OpenGL

Rendering Pipeline/ OpenGL

Effects needed for Realism. Ray Tracing. Ray Tracing: History. Outline. Foundations of Computer Graphics (Fall 2012)

CENG 477 Introduction to Computer Graphics. Modeling Transformations

Curves & Surfaces. Last Time? Today. Readings for Today (pick one) Limitations of Polygonal Meshes. Today. Adjacency Data Structures

Schedule. Curves & Surfaces. Questions? Last Time: Today. Limitations of Polygonal Meshes. Acceleration Data Structures.

Last Time: Curves & Surfaces. Today. Questions? Limitations of Polygonal Meshes. Can We Disguise the Facets?

EECS 487: Interactive Computer Graphics

Today. Curves & Surfaces. Can We Disguise the Facets? Limitations of Polygonal Meshes. Better, but not always good enough

Gauss-Jordan Algorithm

Implementing Ray Casting in Tetrahedral Meshes with Programmable Graphics Hardware (Technical Report)

STEREO PLANE MATCHING TECHNIQUE

4.1 3D GEOMETRIC TRANSFORMATIONS

Ray Casting. Outline. Outline in Code

Projection & Interaction

Outline. EECS Components and Design Techniques for Digital Systems. Lec 06 Using FSMs Review: Typical Controller: state

Texture Mapping. Texture Mapping. Map textures to surfaces. Trompe L Oeil ( Deceive the Eye ) Texture map. The texture

M y. Image Warping. Targil 7 : Image Warping. Image Warping. 2D Geometric Transformations. image filtering: change range of image g(x) = T(f(x))

4. Minimax and planning problems

AML710 CAD LECTURE 11 SPACE CURVES. Space Curves Intrinsic properties Synthetic curves

OpenGL/GLUT Intro. Week 1, Fri Jan 12

Sam knows that his MP3 player has 40% of its battery life left and that the battery charges by an additional 12 percentage points every 15 minutes.

Image warping Li Zhang CS559

Interactive Graphical Systems HT2005

CAMERA CALIBRATION BY REGISTRATION STEREO RECONSTRUCTION TO 3D MODEL

Image warping/morphing

Computer representations of piecewise

PART 1 REFERENCE INFORMATION CONTROL DATA 6400 SYSTEMS CENTRAL PROCESSOR MONITOR

COMP26120: Algorithms and Imperative Programming

Image Content Representation

A Matching Algorithm for Content-Based Image Retrieval

CS 152 Computer Architecture and Engineering. Lecture 7 - Memory Hierarchy-II

FIELD PROGRAMMABLE GATE ARRAY (FPGA) AS A NEW APPROACH TO IMPLEMENT THE CHAOTIC GENERATORS

Why not experiment with the system itself? Ways to study a system System. Application areas. Different kinds of systems

Assignment 2. Due Monday Feb. 12, 10:00pm.

Lecture 18: Mix net Voting Systems

Optics and Light. Presentation

NEWTON S SECOND LAW OF MOTION

Traditional Rendering (Ray Tracing and Radiosity)

Overview. 9 - Game World: textures, skyboxes, etc. Texture Mapping. Texture Space. Vertex Texture Coordinates. Texture Mapping. Game World Backgrounds

Streamline Pathline Eulerian Lagrangian

MOTION DETECTORS GRAPH MATCHING LAB PRE-LAB QUESTIONS

Data Structures and Algorithms. The material for this lecture is drawn, in part, from The Practice of Programming (Kernighan & Pike) Chapter 2

A NEW APPROACH FOR 3D MODELS TRANSMISSION

Scheduling. Scheduling. EDA421/DIT171 - Parallel and Distributed Real-Time Systems, Chalmers/GU, 2011/2012 Lecture #4 Updated March 16, 2012

CS 152 Computer Architecture and Engineering. Lecture 6 - Memory

Image segmentation. Motivation. Objective. Definitions. A classification of segmentation techniques. Assumptions for thresholding

C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE. Mikhail Bessmeltsev

Virtual Recovery of Excavated Archaeological Finds

STRING DESCRIPTIONS OF DATA FOR DISPLAY*

Midterm Exam Announcements

CS 152 Computer Architecture and Engineering. Lecture 6 - Memory

Constant-Work-Space Algorithms for Shortest Paths in Trees and Simple Polygons

C 1. Last Time. CSE 490/590 Computer Architecture. Cache I. Branch Delay Slots (expose control hazard to software)

Fill in the following table for the functions shown below.

Motor Control. 5. Control. Motor Control. Motor Control

REDUCTIONS BBM ALGORITHMS DEPT. OF COMPUTER ENGINEERING ERKUT ERDEM. Bird s-eye view. May. 12, Reduction.

4 Error Control. 4.1 Issues with Reliable Protocols

A time-space consistency solution for hardware-in-the-loop simulation system

MATH Differential Equations September 15, 2008 Project 1, Fall 2008 Due: September 24, 2008

FLOW VISUALIZATION USING MOVING TEXTURES * Nelson Max Lawrence Livermore National Laboratory Livermore, California

Design Alternatives for a Thin Lens Spatial Integrator Array

A non-stationary uniform tension controlled interpolating 4-point scheme reproducing conics

Digital Geometry Processing Differential Geometry

Projective geometry- 2D

parametric spline curves

COSC 3213: Computer Networks I Chapter 6 Handout # 7

Shortest Path Algorithms. Lecture I: Shortest Path Algorithms. Example. Graphs and Matrices. Setting: Dr Kieran T. Herley.

Point Cloud Representation of 3D Shape for Laser- Plasma Scanning 3D Display

MORPHOLOGICAL SEGMENTATION OF IMAGE SEQUENCES

Overview. 8 - Game World: textures, skyboxes, etc. Texture Mapping. Texture Space. Creating Textures. Vertex Texture Coordinates.

An Adaptive Spatial Depth Filter for 3D Rendering IP

CS 428: Fall Introduction to. Geometric Transformations (continued) Andrew Nealen, Rutgers, /20/2010 1

DETC2004/CIE VOLUME-BASED CUT-AND-PASTE EDITING FOR EARLY DESIGN PHASES

Learning in Games via Opponent Strategy Estimation and Policy Search

Real Time Integral-Based Structural Health Monitoring

Chapter 3 MEDIA ACCESS CONTROL

Definition and examples of time series

Using CANopen Slave Driver

Introduction to Data-Driven Animation: Programming with Motion Capture Jehee Lee

EP2200 Queueing theory and teletraffic systems

Announcements For The Logic of Boolean Connectives Truth Tables, Tautologies & Logical Truths. Outline. Introduction Truth Functions

Test - Accredited Configuration Engineer (ACE) Exam - PAN-OS 6.0 Version

LAMP: 3D Layered, Adaptive-resolution and Multiperspective Panorama - a New Scene Representation

Timers CT Range. CT-D Range. Electronic timers. CT-D Range. Phone: Fax: Web: -

The Roots of Lisp paul graham

An Improved Square-Root Nyquist Shaping Filter

NURBS rendering in OpenSG Plus

TOOTH ALIGNMENT OF THE DENTAL CAST USING 3D THIN PLATE SPLINE

Image Based Computer-Aided Manufacturing Technology

Motion Level-of-Detail: A Simplification Method on Crowd Scene

Low-Cost WLAN based. Dr. Christian Hoene. Computer Science Department, University of Tübingen, Germany

Upper Body Tracking for Human-Machine Interaction with a Moving Camera

MIC2569. Features. General Description. Applications. Typical Application. CableCARD Power Switch

Representing Non-Manifold Shapes in Arbitrary Dimensions

Announcements. TCP Congestion Control. Goals of Today s Lecture. State Diagrams. TCP State Diagram

Geometry Transformation

Lecture 4. Programming with Message Passing: Applications and Performance

Connections, displays and operating elements. Status LEDs (next to the keys)

Transcription:

Grading Programming Assignmens: 4% Chaper 2 2D Game: Inro o (6%) ou now 3D Transformaions modeling/animaion (11%) Basics of Compuer Graphics: Rendering pipeline (11%) Ray racing (12%) compuer graphics exper Grading Course Info/Policies (boring suff): hp:www.ugrad.cs.ubc.ca/~cs314 Paricipaion (2%) Classroom: Clicke responses + classroom involvemen Pos wo weekly review quesions Based on maerial covered each week Submi via DB (privae, rev# ag) ill Mon 9AM Include: quesion, muliple choice answers, explanaion Grading Programming Assignmens: 4% Weekly Mini Home Quizes: 3% Paricipaion 2% Classroom Review quesion composiion Two Miderms: 25% 12% +13% Final Exam: 3% compuer graphics exper Grading Mini Home Quizes: (3%) Online (connec.ubc.ca) quiz each week (from week 2) Released by Tue AM, Due Friday 9AM Muliple choice quesions Suden/insrucor composed If your quesion seleced - double your quiz grade!!! If wo seleced riple.. compuer graphics exper Page 1 1

Imporan Daes Assignmen 1 due: Sep 21 Assignmen 2 due: Oc 12 Assignmen 3 due: Nov 2 Assignmen 4 due: Nov 3 Miderm 1: Oc 19 Miderm 2: Nov 9 Lieraure (opional) Fundamenals of Compuer Graphics Third ediion (second is OK oo bu noe syllabus changes) Peer Shirley, A.K. Peers Programming Guide J. Neider, T. Davis and W. Mason, Addison- Wesley Course Organizaion Programming assignmens: C++, Windows or Linux ed on deparmen Linux machines graphics library / GLUT for user inerface Face o face grading in lab Opporuniy o show all he cool exra suff ha you do know wha every piece of your code does Learning This is a graphics course using no a course ON Upper-level class: learning APIs mosly on your own only minimal lecure coverage basics, some of he ricky bis Red Book many uorial sies on he web hp://www.xmission.com/~nae/opengl.hml Hall of fame cooles projecs from 22 on Lae/Missing Work Programming Assignmens: 3 grace days TOTAL for unforeseen circumsances srong recommendaion: don use early in erm handing in lae uses up auomaically unless you ell us Home Quizes/Review Quesion Ses Can miss wo of each Excepion: severe illness/crisis, as per UBC rules MUST Ge approval from me ASAP (in person or email) Turn in proper documenaion Plagiarism and Cheaing Shor Summary: Don chea Home quizes and programming assignmens are individual work Can discuss ideas (including on DB), browse Web Bu canno copy code or answers/quesions If you REALLY hink using a source is OK cie i Mus be able o explain algorihms during faceo-face demo or no credi for ha assignmen, possible prosecuion Page 2 2

Basics of Compuer Graphics: Rendering Pipeline Rendering Goal: Transform (3D) compuer models ino images Phoo-realisic (or no) Ineracive rendering: Fas, bu unil recenly low qualiy Roughly follows a fixed paerns of operaions Rendering Pipeline Offline rendering: Ray-racing Global illuminaion Rendering Pipeline Absrac model of sequence of operaions o ransform geomeric model ino digial image graphics hardware workflow Underlying API (applicaion programming inerface) model for programming graphics hardware Direc 3D Acual implemenaions vary Rendering Tasks (no paricular order) Projec 3D geomery ono image plane ransformaions Deermine which primiives/pars of primiives are visible Hidden surface removal Deermine which pixels geomeric primiive covers conversion Compue color of every visible surface poin, shading, exure mapping Advanages of pipeline srucure? Logical separaion of differen componens, modulariy Easy o parallelize: Earlier sages can already work on new daa while laer sages sill work wih previous daa Similar o pipelining in modern CPUs Bu much more aggressive parallelizaion possible (special purpose hardware!) Imporan for hardware implemenaions! Only local knowledge of he scene is necessary Page 3 3

Disadvanages? Limied flexibiliy Some algorihms would require differen ordering of pipeline sages Hard o achieve while sill preserving compaibiliy Only local knowledge of scene is available Shadows Global illuminaion API for graphics hardware Sared in 1989 by Kur Akeley Designed o exploi graphics hardware Implemened on many differen plaforms Pipeline processing Even driven Communicaion via sae seing (Tenaive) Lecure Syllabus Inroducion + Rendering Pipeline (week 1/2) Transformaions (week 2/3) (week 4/5) (week 5) Hidden Surface Removal (week 6/7) Review & Miderm (week 7) Miderm: Oc 19 Models (week 8) Texure mapping (week 9/1) Review & Miderm (week 1) Miderm: Nov 9 Ray Tracing (week 11) Shadows (week 11/12) Modeling (conen creaion) (week 12/13) Review (las lecure) GLUT: Uiliy Toolki Even driven!!! in main(in argc, char **argv) { // Iniialize GLUT and open a window. gluini(&argc, argv); gluinidisplaymode(glut_rgb GLUT_DOUBLE); gluiniwindowsize(8, 6); glucreaewindow(argv[]); // Regiser a bunch of callbacks for GLUT evens. gludisplayfunc(display); glureshapefunc(reshape); // Pass conrol o GLUT. glumainloop(); } reurn ; Even-Driven Programming Rendering Pipeline Implemenaion: /GLu Main loop no under your conrol vs. procedural Conrol flow hrough even callbacks redraw he window now key was pressed mouse moved Callback funcions called from main loop when evens occur mouse/keyboard, redrawing Page 4 4

Graphics Sae (global variables) Se sae once, remains unil overwrien glcolor3f(1., 1.,.) se color o yellow glseclearcolor(.,.,.2) dark blue bg glenable(light) urn on ligh glenable(gl_depth_test) hidden surf. GLUT Inpu Evens // you supply hese kind of funcions void reshape(in w, in h); void keyboard(unsigned char key, in x, in y); void mouse(in bu, in sae, in x, in y); // regiser hem wih glu glureshapefunc(reshape); glukeyboardfunc(keyboard); glumousefunc(mouse); /GLUT Example void display(void) {// Called when need o redraw screen. // Clear he buffer we will draw ino. glclearcolor(,,, 1); glclear(gl_color_buffer_bit); } // Iniialize he modelview marix. glmarixmode(gl_modelview); MODELVIEW); glloadideniy(); // Draw STUFF // Make he buffer we jus drew ino visible. gluswapbuffers(); GLUT and GLU primiives glusphere(...) glucylinder(...) glusolidsphere(gldouble radius, GLin slices, GLin sacks) gluwiresphere(...) glusolidcube(gldouble size) gluwirecube(...) glusolidtorus(...) o us(...) gluwiretorus(...) glusolidteapo(...) gluwireteapo(...) Noe: Have limied se of parameers Conrol via global ransformaions (see a1 emplae) Need o save/resore seing GLUT Example in main(in argc, char *argv[]) {... // Schedule he firs animaion callback ASAP. glutimerfunc(, animae, ); // Pass conrol o GLUT. glumainloop(); reurn ; } void animae(in las_frame = ) { // Do suff // Schedule he nex frame. in curren_ime = gluge(glut_elapsed_time); in nex_frame = las_frame + 1 / 3; glutimerfunc(max(, nex_frame - curren_ime), animae, curren_ime); } GLUT and GLU primiives Example (from a1): void Pad::draw() { glcolor3f(1, 1, 1); glpushmarix(); Save previous sae gltranslaef(x_, y_, ); glscalef(widh_, l heigh_, h 1); glnormal3f(,, 1); glbegin(gl_quads); glverex3f(-.5, -.5, ); glverex3f(-.5,.5, ); glverex3f(.5,.5, ); glverex3f(.5, -.5, ); glend(); glpopmarix(); Resore previous sae } Page 5 5

GLUT and GLU primiives Basic Transformaions: Assignmen 1 Experience & GLUT // Differen basic ransformaions gltranslaef( ); glroaef( ); glscalef( ); Have FUN Descripion: hp://www.ugrad.cs.ubc.ca/~cs314/vsep212/a1/a1.pdf Deadline: Sep 21 Your asks for he weekend Piazza Discussion Group: Regiser Pos review quesions by Mon 9AM Use privae opion, rev1 ag Rendering Pipeline in (More) Deail Assignmen 1 programming environmen on lab compuers/se lapop environmen (opional) Should have all he necessary background afer his class Your asks for he weekend Sign and Submi Plagiarism Form hp://www.ugrad.cs.ubc.ca/~cs314/vsep212/plag.hml Opional reading (Shirley: Inroducion o CG) Mah refresher: Chapers 2, 4 Los of mah coming in he nex few weeks Background on graphics: Chaper 1 Page 6 6

3D Needs o represen models for Shapes (objecs) Relaions beween differen shapes Objec maerials Ligh sources Camera Explici Funcions Curves: y is a funcion of x: Only works in 2D Surfaces: z is a funcion of x and y: y sin(x) Canno define arbirary shapes in 3D z sin( x) cos( y) Shapes Differen philosophies: Volumeric Boolean algebra wih volumeric primiives Spheres, cones, cylinders, ori, Boundary represenaion Single basic primiive Triangles or riangle meshes, poins, lines Higher order surface primiives wih adjusable parameers E.g. all polynomials of degree 2 Splines, NURBS (deails in CPSC 424) Implicis Parameric Funcions Curves: 2D: x and y are funcions of a parameer value 3D: x, y, and z are funcions of a parameer value cos( ) C ( ) sin( ) Curves/Surfaces Mahemaical represenaions: Explici funcions Parameric funcions Implici funcions Parameric Funcions Surfaces: Surface S is defined as a funcion of parameer values s, Names of parameers can be differen o mach inuiion: cos( )cos( ) S(, sin( )cos( ) sin( ) Page 7 7

Shapes Implici Surfaces: Surface defined by zero se (roos) of funcion E.g: 2 2 2 S ( x, y, z ) : x y z 1 Shape Primiives How o inerpre geomery glbegin(<mode of geomeric primiives>) mode = GL_TRIANGLE, GL_POLYGON, ec. Feed verices glverex3f(-1.,., -1.) glverex3f(1.,., -1.) glverex3f(., 1., -1.) Done glend() Shapes Triangles and Triangle Meshes: How o define a riangle? Open GL: (Some) Shape Primiives glpoinsize( floa size); gllinewidh( floa widh); glcolor3f( floa r, floa g, floa b);... Modeling and Viewing Transformaions Placing objecs - Modeling ransformaions Map poins from objec coordinae sysem o world coordinae sysem TRIANGLE... glcolor3f(,1,); glbegin( GL_TRIANGLES ); glverex3f(.f,.5f,.f ); glverex3f( -.5f, -.5f,.f ); glverex3f(.5f, -.5f,.f ); glend(); Placing camera - Viewing ransformaion Map poins from world coordinae sysem o camera (or eye) coordinae sysem Page 8 8

Compuer Graphics 9 Page 9 Modeling Transformaions: Objec Placemen Viewing Transformaion: Camera Placemen Types of ransformaions: Roaions, scaling, shearing Modeling & Viewing Transformaions Translaions Oher ransformaions (no handled by rendering pipeline): Freeform deformaion Linear ransformaions Roaions, scaling, shearing Can be expressed as 3x3 marix E.g. scaling (non uniform): Modeling & Viewing Transformaion z y x z y x 1 3 2 ' ' ' Affine ransformaions Linear ransformaions + ranslaions Can be expressed as 3x3 marix + 3 vecor E.g. scale+ ranslaion: Modeling & Viewing Transformaion Anoher represenaion: 4x4 homogeneous marix z y x z y x z y x 1 3 2 ' ' '

Transformaion Purpose: Projec 3D geomery o 2D image plane Simulaes a camera Camera model: Pinhole camera (single view poin) Oher, more complex camera models also exis in compuer graphics, bu are less common Thin lens cameras Full simulaion of lens geomery Complex and Shading Projecion Page 1 1

Transformaion In compuer graphics: Image plane concepually in fron of cener of projecion ransformaions subse of projecive ransformaions Linear & affine ransformaions also belong o his class All projecive ransformaions can be expressed as 4x4 marix operaions / Conver coninuous 2D geomery o discree Raser display discree grid of elemens Terminology Pixel: basic elemen on device drawing Resoluion: number of rows & columns in device Measured in Absolue values (1K x 1K) Densiy values (3 dos per inch) Screen Space: Discree 2D Caresian coordinae sysem of he screen pixels Removing invisible geomery Geomery ouside viewing frusum Plus oo far or oo near one Page 11 11

Color inerpolaion Linearly inerpolae per-pixel color from verex color values Trea every channel of RGB color separaely color s Problem: Color inerpolaion Line is infiniely hin, bu image has finie resoluion Resuls in seps raher han a smooh line Example: Jaggies Aliasing red green blue One of he fundamenal problems in compuer graphics s s s Page 12 12

Displacemen Mapping (s, ) (s 2, 2 ) (s 1, 1 ) s Issues: (s, ) (s 2, 2 ) (s 1, 1 ) Compuing 3D/2D map (low disorion) How o map pixel from exure (exels) o screen pixels Texure can appear widely disored in rendering Magnificaion / minificaion of exures Filering of exures Prevening aliasing (ani-aliasing) s Texure Mapping Page 13 13

Wihou Hidden Line Removal /Hidden Surface Removal Remove invisible geomery Pars ha are hidden behind oher geomery Possible Implemenaions: Per-fragmen decision buffer Objec space decision polygons agains each oher Soring polygons by disance from camera Hidden Line Removal /Hidden Surface Removal Hidden Surface Removal Page 14 14

: Final image: wrie fragmens o pixels Draw from farhes o neares No blending replace previous color : combine new & old values wih some arihmeic operaions Frame Buffer : video memory on graphics board ha holds resuling image & used o display i No Handled: Reflecion/Shadows Basics of Compuer Graphics: Rendering Pipeline Page 15 15