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

Save this PDF as:

Size: px
Start display at page:

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

## Transcription

1 Surface Graphics Objects are explicitely defined by a surface or boundary representation (explicit inside vs outside) This boundary representation can be given by: - a mesh of polygons: 200 polys 1,000 polys 15,000 polys - a mesh of spline patches: an empty foot 3

2 Polygon Mesh Definitions v3 e3 f1 e2 e1 v2 n1 v1, v2, v3: vertices (3D coordinates) e1, e2, e3: edges e1 = v2 - v1 and e2 = v3 - v2 f1: polygon or face v1 n1: face normal n1 = e1 e e1 e2 view plane (screen) n3 backface n4 n1 n2 = = e11 e e11 e12 e21 e e21 e22, e21 = -e12 n1 e11 e12 e21 e22 view vector vp n2 Rule: if all edge vectors in a face are ordered counterclockwise, then the face normal vectors will always point towards the outside of the object. This enables quick removal of back-faces (back-faces are the faces hidden from the viewer): - back-face condition: vp n > 0 5

3 Polygon Mesh Data Structure Vertex list (v1, v2, v3, v4,...): (x1, y1, z1), (x2, y2, z2), (x3, y3, z3), (x4, y4, z4),... Edge list (e1, e2, e3, e4, e5,...): (v1, v2), (v2, v3), (v3, v1), (v1, v4), (v4, v2),... Face list (f1, f2,...): v3 e2 v2 (e1, e2, e3), (e4, e5, -e1),... or (v1, v2, v3), (v1, v4, v2),... e3 f1 n1 e1 f2 e5 Normal list (n1, n2,...), one per face or per vertex (n1x, n1y, n1z), (n2x, n2y, n2z),... v1 e4 n2 v4 Use Pointers or indices into vertex and edge list arrays, when appropriate 6

4 Object-Order Viewing - Overview screen in world space W Cop y n v u H Eye (Camera) Viewing Transform y transformed object - z object - z object projected to the screen x Eye v u screen in viewing space x A view is specified by: - eye position (Eye) - view direction vector (n) - screen center position (Cop) - screen orientation (u, v) - screen width W, height H u, v, n are orthonormal vectors After the viewing transform: - the screen center is at the coordinate system origin - the screen is aligned with the x, y-axis - the viewing vector points down the negative z-axis - the eye is on the positive z-axis All objects are transformed by the viewing transform 7

5 Step 1: Viewing Transform The sequence of transformations is: - translate the screen Center Of Projection (COP) to the coordinate system orgin (T view ) - rotate the translated screen such that the view direction vector n points down the negative z- axis and the screen vectors u, v are aligned with the x, y-axis (R view ) We get M view = R view T view We transform all object (points, vertices) by M view : x' y' z' 1 = u x u y u z 0 v x v y v z 0 n x n y n z Cop x 010 Cop y 001 Cop z x y z 1 Now the objects are easy to project since the screen is in a convenient position - but first we have to account for perspective distortion... 8

6 Step 2: Perspective Projection y y y p Eye z eye z screen plane A (view-transformed) vertex with coordinates (x, y, z ) projects onto the screen as follows: y p eye = y' x eye z' p = x' eye eye z' x p and y p can be used to determine the screen coordinates of the object point (i.e., where to plot the point on the screen) 9

7 Step 1 + Step 2 = World-To-Screen Transform Perspective projection can also be captured in a matrix M proj with a subsequent perspective divide by the homogenous coordinate w: x h y h z h w = eye eye eye x' y' z' 1 x h x p = w y h y p = w So the entire world-to-screen transform is: M trans = M proj M view = M proj R view T view with a subsequent divide by the homogenous coordinate M trans is composed only once per view and all object points (vertices) are multiplied by it 10

8 Step 3: Window Transform (1) Note: our camera screen is still described in world coordinates However, our display monitor is described on a pixel raster of size (Nx, Ny) The transformation of (perspective) viewing coordinates into pixel coordinates is called window transform Assume: - we want to display the rendered screen image in a window of size (Nx, Ny) pixels - the width and height of the camera screen in world coordinates is (W, H) - the center of the camera is at the center of the screen coordinate system Then: - the valid range of object coordinates is (-W/2... +W/2, -H/2... +H/2) - these have to be mapped into (0... Nx-1, 0... Ny-1): x W s x p Nx 1 = y H 2 W s y p Ny 1 = H H camera W window Nx Ny 11

9 Step 3: Window Transform (2) The window transform can be written as the matrix M window : x s y s 1 = Nx 1 Nx W 2 Ny Ny H x p y p 1 After the perspective divide, all object points (vertices) are multiplied by M window Note: we could figure the window transform into M trans - in that case, there is only one matrix multiply per object point (vertex) with a subsequent perspective divide - the OpenGL graphics pipeline does this 12

10 Orthographic (Parallel) Projection Leave out the perspective mapping (step 2) in the viewing pipeline In orthographic projection, all object points project along parallel lines onto the screen y y y y p =y y p z z perspective projection orthographic projection 13

11 Rendering the Polygonal Objects - The Hidden Surface Removal Problem We have removed all faces that are definitely hidden: the back-faces But even the surviving faces are only potentially visible - they may be obscured by faces closer to the viewer face A of object 1 is partially obscured by face B of object 2 obj 1 A obj 2 B screen Problem of identifying those face portions that are visible is called the hidden surface problem Solutions: - pre-ordering of the faces and subdivision into their visible parts before display (expensive) - the z-buffer algorithm (cheap, fast, implementable in hardware) 14

12 The Z-Buffer (Depth-Buffer) Scan Conversion Algorithm Two data structures: - z-buffer: holds for each image pixel the z-coordinate of the closest object so far - color-buffer: holds for each pixel the closest object s color Basic z-buffer algorithm: color buffer z-buffer // initialize buffers for all (x, y) z-buffer(x, y) = -infinity; color-buffer(x, y) = color background // scan convert each front-face polygon for each front-face poly for each scanline y that traverses projected poly for each pixel x in scanline y and projected poly if z poly(x, y) > z-buffer(x, y) initialize buffers scan-convert face B of obj. 2 z-buffer(x, y) = z poly(x, y) color-buffer(x, y) = color poly(x, y) scan-convert face A of obj. 1 15

13 Polygon Shading Methods - Faceted Shading vertex3 How are the pixel colors determined in z-buffer? rasterized pixel (x,y) scanline y The simplest method is flat or faceted shading: vertex2 - each polygon has a constant color vertex1 - compute color at one point on the polygon (e.g., at center) and use everywhere - assumption: lightsource and eye is far away, i.e., N L, H E = const. N L E Problem: discontinuities are likely to appear at face boundaries 16

14 Polygon Shading Methods - Gouraud Shading Colors are averaged across polygons along common edges no more discontinuities Steps: - determine average unit normal at each poly vertex: N v = n k = 1 N k n k = 1 N k n: number of faces that have vertex v in common N v - apply illumination model at each poly vertex C v - linearly interpolate vertex colors across edges - linearly interpolate edge colors across scan lines C 3 C 1 y C p C 12 C 23 x C 2 Downside: may miss specular highlights at off-vertex positions or distort specular highlights 17

15 Polygon Shading Methods - Phong Shading Phong shading linearly interpolates normal vectors, not colors Steps: more realistic specular highlights illumination model N 3 - determine average normal at each vertex - linearly interpolate normals across edges - linearly interpolate normals across scanlines N 1 y N p C p N 12 N 23 x N 2 - apply illumination model at each pixel to calculate pixel color Downside: need more calculations since need to do illumination model at each pixel 18

16 Rendering With OpenGl (1) look also in glmatrixmode(gl_projection) Define the viewing window: glortho() for parallel projection glfrustum() for perspective projection glmatrixmode(gl_modelview) Specify the viewpoint glulookat() /* need to have GLUT */ Model the scene Modelview Matrix Stack glulookat(...) gltranslate(x,y,z) glrotate(ϕ y,0,1,0) glrotate(ϕ z,0,0,1) glrotate(ϕ x,1,0,0) order of execution rotate first, then translate, then do viewing... gltranslate(), glrotate(), glscale(),... Vertex x y z w object coordinates Modelview Matrix Viewport Transfor- mation eye coordinates OpenGL rendering pipeline Projection Matrix clip coordinates Perspective Division window coordinates normalized device coordinates 19

17 Rendering With OpenGl (2) Specify the light sources: gllight() Enable the z-buffer: glenable(gl_depth_test) Enable lighting: glenable(gl_lighting) Enable light source i: glenable(gl_lighti) /* GL_LIGHTi is the symbolic name of light i */ Select shading model: glshademodel() /* GL_FLAT or GL_SMOOTH */ For each object: /* duplicate the matrix on the stack if want to apply some extra transformations to the object */ glpushmatrix(); gltranslate(), glrotate(), glscale() /* any specific transformation on this object */ for all polygons of the object: /* specify the polygon (assume a triangle here) */ glbegin(gl_polygon); glcolor3fv(c1); glvertex3fv(v1); glnormal3fv(n1); /* vertex 1 */ glcolor3fv(c2); glvertex3fv(v2); glnormal3fv(n2); /* vertex 2 */ glcolor3fv(c3); glvertex3fv(v3); glnormal3fv(n3); /* vertex 3 */ glend(); glpopmatrix() /* get rid of the object-specific transformations, pop back the saved matrix */ 20

18 Texture Mapping - Realistic Detail for Boring Polygons Leonard McMillan, UNC 3

19 Texture Mapping - Large Walls Take pictures, map as textures onto large polygon 4

20 Texture Mapping Large Walls - OpenGL Program glenable(gl_texture_2d); for each polygon glbindtexture(texturename); glbegin(gl_quad); glcolor3fv(c1); glvertex3fv(v1); gltexcoord2d(0.0, 0.0); /* vertex 1 */ glcolor3fv(c2); glvertex3fv(v2); gltexcoord2d(0.0, 1.0); /* vertex 2 */ glcolor3fv(c3); glvertex3fv(v3); gltexcoord2d(1.0, 1.0); /* vertex 3 */ glcolor3fv(c4); glvertex3fv(v4); gltexcoord2d(1.0, 0.0); /* vertex 4 */ glend(); (1.0, 0.0) (1.0, 1.0) (0.0, 0.0) (0.0, 1.0) 5

21 Texture Mapping - Small Facets Leonard McMillan, UNC 6

22 Texture Mapping Small Facets - OpenGL Program glenable(gl_texture_2d); glbindtexture(texturename); for each polygon i in the mesh glbegin(gl_quad); glcolor3fv(c[i][0]); glvertex3fv(v[i][0]); gltexcoord2fv(t[i][0]); /* vertex 1 */ glcolor3fv(c[i][1]); glvertex3fv(v[i][1]); gltexcoord2fv(t[i][1]); /* vertex 2 */ glcolor3fv(c[i][2]); glvertex3fv(v[i][2]); gltexcoord2fv(t[i][2]); /* vertex 3 */ glend(); polygon mesh texture (image) v[i][0] screen pixel v[i][2] interpolated texel v[i][1] 7

23 Complete Graphics Pipeline screen display (framebuffer) polygon primitives transformed into screen space vertex transformation transformed vertices rasterization shading texture mapping shaded and texture fragments vertex shader fragment shader (vertex engine) (rasterizers) fragments are interpolated from texture image 8

24 Graphics Hardware - Peeking Under The Hood Graphics hardware accelerates vertex and fragment shaders - (almost) fully programmable - enables accurate physics and visuals - realistic games - latest: real-time movie production on the PC - accelerate even general purpose, scientific and numerical computations (GPGPU) 9

### CSE 690: GPGPU. Lecture 2: Understanding the Fabric - Intro to Graphics. Klaus Mueller Stony Brook University Computer Science Department

CSE 690: GPGPU Lecture 2: Understanding the Fabric - Intro to Graphics Klaus Mueller Stony Brook University Computer Science Department Klaus Mueller, Stony Brook 2005 1 Surface Graphics Objects are explicitely

### Interpolation using scanline algorithm

Interpolation using scanline algorithm Idea: Exploit knowledge about already computed color values. Traverse projected triangle top-down using scanline. Compute start and end color value of each pixel

### Rasterization Overview

Rendering Overview The process of generating an image given a virtual camera objects light sources Various techniques rasterization (topic of this course) raytracing (topic of the course Advanced Computer

### OpenGL: Open Graphics Library. Introduction to OpenGL Part II. How do I render a geometric primitive? What is OpenGL

OpenGL: Open Graphics Library Introduction to OpenGL Part II CS 351-50 Graphics API ( Application Programming Interface) Software library Layer between programmer and graphics hardware (and other software

### E.Order of Operations

Appendix E E.Order of Operations This book describes all the performed between initial specification of vertices and final writing of fragments into the framebuffer. The chapters of this book are arranged

### Models and Architectures. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico 1 Objectives Learn the basic design of a graphics system Introduce

### 6.837 Introduction to Computer Graphics Assignment 5: OpenGL and Solid Textures Due Wednesday October 22, 2003 at 11:59pm

6.837 Introduction to Computer Graphics Assignment 5: OpenGL and Solid Textures Due Wednesday October 22, 2003 at 11:59pm In this assignment, you will add an interactive preview of the scene and solid

### 6.837 Introduction to Computer Graphics Assignment 5: OpenGL and Solid Textures Due Wednesday October 22, 2003 at 11:59pm

6.837 Introduction to Computer Graphics Assignment 5: OpenGL and Solid Textures Due Wednesday October 22, 2003 at 11:59pm In this assignment, you will add an interactive preview of the scene and solid

### graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1 graphics pipeline sequence of operations to generate an image using object-order processing primitives processed one-at-a-time

### Books, OpenGL, GLUT, GLUI, CUDA, OpenCL, OpenCV, PointClouds, and G3D

Books, OpenGL, GLUT, GLUI, CUDA, OpenCL, OpenCV, PointClouds, and G3D CS334 Spring 2012 Daniel G. Aliaga Department of Computer Science Purdue University Computer Graphics Pipeline Geometric Primitives

### CSE 167: Introduction to Computer Graphics Lecture #8: Textures. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016

CSE 167: Introduction to Computer Graphics Lecture #8: Textures Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016 Announcements Project 2 due this Friday Midterm next Tuesday

### - Rasterization. Geometry. Scan Conversion. Rasterization

Computer Graphics - The graphics pipeline - Geometry Modelview Geometry Processing Lighting Perspective Clipping Scan Conversion Texturing Fragment Tests Blending Framebuffer Fragment Processing - So far,

### 3D Programming. 3D Programming Concepts. Outline. 3D Concepts. 3D Concepts -- Coordinate Systems. 3D Concepts Displaying 3D Models

3D Programming Concepts Outline 3D Concepts Displaying 3D Models 3D Programming CS 4390 3D Computer 1 2 3D Concepts 3D Model is a 3D simulation of an object. Coordinate Systems 3D Models 3D Shapes 3D Concepts

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

Orthogonal Projection Matrices 1 Objectives Derive the projection matrices used for standard orthogonal projections Introduce oblique projections Introduce projection normalization 2 Normalization Rather

### 3D Graphics Pipeline II Clipping. Instructor Stephen J. Guy

3D Graphics Pipeline II Clipping Instructor Stephen J. Guy 3D Rendering Pipeline (for direct illumination) 3D Geometric Primitives 3D Model Primitives Modeling Transformation 3D World Coordinates Lighting

### CS 591B Lecture 9: The OpenGL Rendering Pipeline

CS 591B Lecture 9: The OpenGL Rendering Pipeline 3D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination Spring 2007 Rui Wang 3D Polygon Rendering Many applications

### Graphics Pipeline & APIs

Graphics Pipeline & APIs CPU Vertex Processing Rasterization Fragment Processing glclear (GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT); glpushmatrix (); gltranslatef (-0.15, -0.15, solidz); glmaterialfv(gl_front,

### OpenGL. Toolkits.

http://www.opengl.org OpenGL Open Graphics Library Graphics API Delivered with UNIX, Win9x/2000/Me/Nt/Xp, Mac OS Direct3D (DirectX) is only Windows Utilizes the window system and event handling of the

### Shadow Algorithms. CSE 781 Winter Han-Wei Shen

Shadow Algorithms CSE 781 Winter 2010 Han-Wei Shen Why Shadows? Makes 3D Graphics more believable Provides additional cues for the shapes and relative positions of objects in 3D What is shadow? Shadow:

### Books, OpenGL, GLUT, CUDA, OpenCL, OpenCV, PointClouds, G3D, and Qt

Books, OpenGL, GLUT, CUDA, OpenCL, OpenCV, PointClouds, G3D, and Qt CS334 Fall 2015 Daniel G. Aliaga Department of Computer Science Purdue University Books (and by now means complete ) Interactive Computer

### Computer Graphics. Illumination and Shading

() Illumination and Shading Dr. Ayman Eldeib Lighting So given a 3-D triangle and a 3-D viewpoint, we can set the right pixels But what color should those pixels be? If we re attempting to create a realistic

### Computer Graphics and Visualization. Graphics Systems and Models

UNIT -1 Graphics Systems and Models 1.1 Applications of computer graphics: Display Of Information Design Simulation & Animation User Interfaces 1.2 Graphics systems A Graphics system has 5 main elements:

### Graphics Hardware and OpenGL

Graphics Hardware and OpenGL Ubi Soft, Prince of Persia: The Sands of Time What does graphics hardware have to do fast? Camera Views Different views of an object in the world 1 Camera Views Lines from

Fall 2017 CSCI 420: Computer Graphics 5.2 Shading in OpenGL Hao Li http://cs420.hao-li.com 1 Outline Normal Vectors in OpenGL Polygonal Shading Light Sources in OpenGL Material Properties in OpenGL Example:

### CS5620 Intro to Computer Graphics

So Far wireframe hidden surfaces Next step 1 2 Light! Need to understand: How lighting works Types of lights Types of surfaces How shading works Shading algorithms What s Missing? Lighting vs. Shading

### Viewing COMPSCI 464. Image Credits: Encarta and

Viewing COMPSCI 464 Image Credits: Encarta and http://www.sackville.ednet.ns.ca/art/grade/drawing/perspective4.html Graphics Pipeline Graphics hardware employs a sequence of coordinate systems The location

### Methodology for Lecture. Importance of Lighting. Outline. Shading Models. Brief primer on Color. Foundations of Computer Graphics (Spring 2010)

Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 11: OpenGL 3 http://inst.eecs.berkeley.edu/~cs184 Methodology for Lecture Lecture deals with lighting (teapot shaded as in HW1) Some Nate

Last Time? The Traditional Graphics Pipeline Reading for Today A Practical Model for Subsurface Light Transport, Jensen, Marschner, Levoy, & Hanrahan, SIGGRAPH 2001 Participating Media Measuring BRDFs

Shading and Illumination OpenGL Shading Without Shading With Shading Physics Bidirectional Reflectance Distribution Function (BRDF) f r (ω i,ω ) = dl(ω ) L(ω i )cosθ i dω i = dl(ω ) L(ω i )( ω i n)dω

### OpenGL. Jimmy Johansson Norrköping Visualization and Interaction Studio Linköping University

OpenGL Jimmy Johansson Norrköping Visualization and Interaction Studio Linköping University Background Software interface to graphics hardware 250+ commands Objects (models) are built from geometric primitives

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

Computer Graphics 1 Chapter 7 (June 17th, 2010, 2-4pm): Shading and rendering 1 The 3D rendering pipeline (our version for this class) 3D models in model coordinates 3D models in world coordinates 2D Polygons

### Graphics Programming

Graphics Programming 3 rd Week, 2011 OpenGL API (1) API (application programming interface) Interface between an application program and a graphics system Application Program OpenGL API Graphics Library

### GL_MODELVIEW transformation

lecture 3 view transformations model transformations GL_MODELVIEW transformation view transformations: How do we map from world coordinates to camera/view/eye coordinates? model transformations: How do

### GRAFIKA KOMPUTER. ~ M. Ali Fauzi

GRAFIKA KOMPUTER ~ M. Ali Fauzi Drawing 2D Graphics VIEWPORT TRANSFORMATION Recall :Coordinate System glutreshapefunc(reshape); void reshape(int w, int h) { glviewport(0,0,(glsizei) w, (GLsizei) h); glmatrixmode(gl_projection);

### Computer Graphics. Lecture 9 Environment mapping, Mirroring

Computer Graphics Lecture 9 Environment mapping, Mirroring Today Environment Mapping Introduction Cubic mapping Sphere mapping refractive mapping Mirroring Introduction reflection first stencil buffer

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

C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE UGRAD.CS.UBC.C A/~CS314 Mikhail Bessmeltsev 1 WHAT IS RENDERING? Generating image from a 3D scene 2 WHAT IS RENDERING? Generating image

### CPSC 314 LIGHTING AND SHADING

CPSC 314 LIGHTING AND SHADING UGRAD.CS.UBC.CA/~CS314 slide credits: Mikhail Bessmeltsev et al 1 THE RENDERING PIPELINE Vertices and attributes Vertex Shader Modelview transform Per-vertex attributes Vertex

### Homework #2 and #3 Due Friday, October 12 th and Friday, October 19 th

Homework #2 and #3 Due Friday, October 12 th and Friday, October 19 th 1. a. Show that the following sequences commute: i. A rotation and a uniform scaling ii. Two rotations about the same axis iii. Two

### CSE528 Computer Graphics: Theory, Algorithms, and Applications

CSE528 Computer Graphics: Theory, Algorithms, and Applications Hong Qin State University of New York at Stony Brook (Stony Brook University) Stony Brook, New York 11794--4400 Tel: (631)632-8450; Fax: (631)632-8334

### CS Computer Graphics: Hidden Surface Removal

CS 543 - Computer Graphics: Hidden Surface Removal by Robert W. Lindeman gogo@wpi.edu (with help from Emmanuel Agu ;-) Hidden Surface Removal Drawing polygonal faces on screen consumes CPU cycles We cannot

### Welcome to COMP 770 (236) Introduction. Prerequisites. Prerequisites

Welcome to COMP 770 (236) Introduction Computer Graphics COMP 770 (236) Spring 2007 Instructor: Brandon Lloyd Instructor: Brandon Lloyd Email: blloyd@cs.unc.edu Office: SN349 Office hours: MW 1:00 2:00

### THE DEPTH-BUFFER VISIBLE SURFACE ALGORITHM

On-Line Computer Graphics Notes THE DEPTH-BUFFER VISIBLE SURFACE ALGORITHM Kenneth I. Joy Visualization and Graphics Research Group Department of Computer Science University of California, Davis To accurately

### CS380: Computer Graphics Viewing Transformation. Sung-Eui Yoon ( 윤성의 ) Course URL:

CS38: Computer Graphics Viewing Transformation Sung-Eui Yoon ( 윤성의 ) Course URL: http://sglab.kaist.ac.kr/~sungeui/cg/ Class Objectives Know camera setup parameters Understand viewing and projection processes

### Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

Shading Models There are two main types of rendering that we cover, polygon rendering ray tracing Polygon rendering is used to apply illumination models to polygons, whereas ray tracing applies to arbitrary

### Real-Time Graphics Architecture

Real-Time Graphics Architecture Kurt Akeley Pat Hanrahan http://www.graphics.stanford.edu/courses/cs448a-01-fall Geometry Outline Vertex and primitive operations System examples emphasis on clipping Primitive

### lecture 16 Texture mapping Aliasing (and anti-aliasing)

lecture 16 Texture mapping Aliasing (and anti-aliasing) Texture (images) Texture Mapping Q: Why do we need texture mapping? A: Because objects look fake and boring without it. Adding texture improves realism.

### Werner Purgathofer

Einführung in Visual Computing 186.822 Visible Surface Detection Werner Purgathofer Visibility in the Rendering Pipeline scene objects in object space object capture/creation ti modeling viewing projection

### CEng 477 Introduction to Computer Graphics Fall

Illumination Models and Surface-Rendering Methods CEng 477 Introduction to Computer Graphics Fall 2007 2008 Illumination Models and Surface Rendering Methods In order to achieve realism in computer generated

### Rendering Pipeline/ OpenGL

Chapter 2 Basics of Computer Graphics: Your tasks for the weekend Piazza Discussion Group: Register Post review questions by Mon noon Use private option, rev1 tag Start Assignment 1 Test programming environment

### Texture Mapping Part 1

Texture Mapping Part 1 The Quest for Visual Realism Why Texture Map? How to do it How to do it right Spilling the beans Assignment #3 Lecture 17 Comp 236 Spring 2005 3/21/2005 Lecture 17 2 Decal Textures

Illumination and Shading Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL computes illumination at vertices illumination Shading

### Computer Graphics. Lecture 9 Hidden Surface Removal. Taku Komura

Computer Graphics Lecture 9 Hidden Surface Removal Taku Komura 1 Why Hidden Surface Removal? A correct rendering requires correct visibility calculations When multiple opaque polygons cover the same screen

### CSE328 Fundamentals of Computer Graphics: Concepts, Theory, Algorithms, and Applications

CSE328 Fundamentals of Computer Graphics: Concepts, Theory, Algorithms, and Applications Hong Qin Stony Brook University (SUNY at Stony Brook) Stony Brook, New York 11794-4400 Tel: (631)632-8450; Fax:

### OpenGL. 1 OpenGL OpenGL 1.2 3D. (euske) 1. Client-Server Model OpenGL

OpenGL (euske) 1 OpenGL - 1.1 OpenGL 1. Client-Server Model 2. 3. 1.2 3D OpenGL (Depth-Buffer Algorithm Z-Buffer Algorithm) (polygon ) ( rendering) Client-Server Model X Window System ( GL ) GL (Indy O

### Precept 2 Aleksey Boyko February 18, 2011

Precept 2 Aleksey Boyko February 18, 2011 Getting started Initialization Drawing Transformations Cameras Animation Input Keyboard Mouse Joystick? Textures Lights Programmable pipeline elements (shaders)

### Transformation Pipeline

Transformation Pipeline Local (Object) Space Modeling World Space Clip Space Projection Eye Space Viewing Perspective divide NDC space Normalized l d Device Coordinatesd Viewport mapping Screen space Coordinate

### CSCI E-74. Simulation and Gaming

CSCI E-74 Virtual and Augmented Reality for Simulation and Gaming Fall term 2017 Gianluca De Novi, PhD Lesson 7 Multi Texturing Data Structures in a 3D Engine Vertices/Vectors Segments Matrices Polygons

### Computer graphic -- Programming with OpenGL I

Computer graphic -- Programming with OpenGL I A simple example using OpenGL Download the example code "basic shapes", and compile and run it Take a look at it, and hit ESC when you're done. It shows the

### Projection and viewing. Computer Graphics CSE 167 Lecture 4

Projection and viewing Computer Graphics CSE 167 Lecture 4 CSE 167: Computer Graphics Review: transformation from the object (or model) coordinate frame to the camera (or eye) coordinate frame Projection

### From Vertices to Fragments: Rasterization. Reading Assignment: Chapter 7. Special memory where pixel colors are stored.

From Vertices to Fragments: Rasterization Reading Assignment: Chapter 7 Frame Buffer Special memory where pixel colors are stored. System Bus CPU Main Memory Graphics Card -- Graphics Processing Unit (GPU)

### COMP environment mapping Mar. 12, r = 2n(n v) v

Rendering mirror surfaces The next texture mapping method assumes we have a mirror surface, or at least a reflectance function that contains a mirror component. Examples might be a car window or hood,

### 5.8.3 Oblique Projections

278 Chapter 5 Viewing y (, y, ) ( p, y p, p ) Figure 537 Oblique projection P = 2 left right 0 0 left+right left right 0 2 top bottom 0 top+bottom top bottom far+near far near 0 0 far near 2 0 0 0 1 Because

### Computer Graphics. Bing-Yu Chen National Taiwan University

Computer Graphics Bing-Yu Chen National Taiwan University Visible-Surface Determination Back-Face Culling The Depth-Sort Algorithm Binary Space-Partitioning Trees The z-buffer Algorithm Scan-Line Algorithm

### Lecture 4 of 41. Lab 1a: OpenGL Basics

Lab 1a: OpenGL Basics William H. Hsu Department of Computing and Information Sciences, KSU KSOL course pages: http://snipurl.com/1y5gc Course web site: http://www.kddresearch.org/courses/cis636 Instructor

### CSE Intro to Computer Graphics. ANSWER KEY: Midterm Examination. November 18, Instructor: Sam Buss, UC San Diego

CSE 167 - Intro to Computer Graphics ANSWER KEY: Midterm Examination November 18, 2003 Instructor: Sam Buss, UC San Diego Write your name or initials on every page before beginning the exam. You have 75

### CENG 477 Introduction to Computer Graphics. Graphics Hardware and OpenGL

CENG 477 Introduction to Computer Graphics Graphics Hardware and OpenGL Introduction Until now, we focused on graphic algorithms rather than hardware and implementation details But graphics, without using

### The Rendering Pipeline (1)

The Rendering Pipeline (1) Alessandro Martinelli alessandro.martinelli@unipv.it 30 settembre 2014 The Rendering Pipeline (1) Rendering Architecture First Rendering Pipeline Second Pipeline: Illumination

### Direct Rendering of Trimmed NURBS Surfaces

Direct Rendering of Trimmed NURBS Surfaces Hardware Graphics Pipeline 2/ 81 Hardware Graphics Pipeline GPU Video Memory CPU Vertex Processor Raster Unit Fragment Processor Render Target Screen Extended

### 3D Viewing. CS 4620 Lecture 8

3D Viewing CS 46 Lecture 8 13 Steve Marschner 1 Viewing, backward and forward So far have used the backward approach to viewing start from pixel ask what part of scene projects to pixel explicitly construct

### The Graphics Pipeline and OpenGL I: Transformations!

! The Graphics Pipeline and OpenGL I: Transformations! Gordon Wetzstein! Stanford University! EE 267 Virtual Reality! Lecture 2! stanford.edu/class/ee267/!! Logistics Update! all homework submissions:

### Computer Viewing. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Computer Viewing CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science 1 Objectives Introduce the mathematics of projection Introduce OpenGL viewing functions Look at

### Light Sources. Spotlight model

lecture 12 Light Sources sunlight (parallel) Sunny day model : "point source at infinity" - lighting - materials: diffuse, specular, ambient spotlight - shading: Flat vs. Gouraud vs Phong light bulb ambient

### Triangle Rasterization

Triangle Rasterization Computer Graphics COMP 770 (236) Spring 2007 Instructor: Brandon Lloyd 2/07/07 1 From last time Lines and planes Culling View frustum culling Back-face culling Occlusion culling

Illumination and Shading Light sources emit intensity: assigns intensity to each wavelength of light Humans perceive as a colour - navy blue, light green, etc. Exeriments show that there are distinct I

### 3D Viewing. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

3D Viewing CMPT 361 Introduction to Computer Graphics Torsten Möller Reading Chapter 4 of Angel Chapter 6 of Foley, van Dam, 2 Objectives What kind of camera we use? (pinhole) What projections make sense

### Overview: Ray Tracing & The Perspective Projection Pipeline

Overview: Ray Tracing & The Perspective Projection Pipeline Lecture #2 Thursday, August 28 2014 About this Lecture! This is an overview.! Think of it as a quick tour moving fast.! Some parts, e.g. math,

### CSE 167: Lecture #7: Color and Shading. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

CSE 167: Introduction to Computer Graphics Lecture #7: Color and Shading Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011 Announcements Homework project #3 due this Friday,

### Scanline Rendering 2 1/42

Scanline Rendering 2 1/42 Review 1. Set up a Camera the viewing frustum has near and far clipping planes 2. Create some Geometry made out of triangles 3. Place the geometry in the scene using Transforms

### Spring 2009 Prof. Hyesoon Kim

Spring 2009 Prof. Hyesoon Kim Application Geometry Rasterizer CPU Each stage cane be also pipelined The slowest of the pipeline stage determines the rendering speed. Frames per second (fps) Executes on

### CIS 636 Interactive Computer Graphics CIS 736 Computer Graphics Spring 2011

CIS 636 Interactive Computer Graphics CIS 736 Computer Graphics Spring 2011 Lab 1a of 7 OpenGL Setup and Basics Fri 28 Jan 2011 Part 1a (#1 5) due: Thu 03 Feb 2011 (before midnight) The purpose of this

### Geometry: Outline. Projections. Orthographic Perspective

Geometry: Cameras Outline Setting up the camera Projections Orthographic Perspective 1 Controlling the camera Default OpenGL camera: At (0, 0, 0) T in world coordinates looking in Z direction with up vector

### Clipping. CSC 7443: Scientific Information Visualization

Clipping Clipping to See Inside Obscuring critical information contained in a volume data Contour displays show only exterior visible surfaces Isosurfaces can hide other isosurfaces Other displays can

### Lecture 2. Shaders, GLSL and GPGPU

Lecture 2 Shaders, GLSL and GPGPU Is it interesting to do GPU computing with graphics APIs today? Lecture overview Why care about shaders for computing? Shaders for graphics GLSL Computing with shaders

### Two possible ways to specify transformations. Each part of the object is transformed independently relative to the origin

Transformations Two possible ways to specify transformations Each part of the object is transformed independently relative to the origin - Not convenient! z y Translate the base by (5,0,0); Translate the

### CS Exam 1 Review Problems Fall 2017

CS 45500 Exam 1 Review Problems Fall 2017 1. What is a FrameBuffer data structure? What does it contain? What does it represent? How is it used in a graphics rendering pipeline? 2. What is a Scene data

### Drawing Fast The Graphics Pipeline

Drawing Fast The Graphics Pipeline CS559 Fall 2016 Lectures 10 & 11 October 10th & 12th, 2016 1. Put a 3D primitive in the World Modeling 2. Figure out what color it should be 3. Position relative to the

### OpenGL: A Practical Introduction. (thanks, Mark Livingston!)

OpenGL: A Practical Introduction (thanks, Mark Livingston!) Outline What is OpenGL? Auxiliary libraries Basic code structure Rendering Practical hints Virtual world operations OpenGL Definitions Software

### Hidden Surface Removal. 3D Graphics with OpenGL. Back-Face Culling

Hidden Surface Removal Back Face Culling 3D Surfaces Bicubic Parametric Bezier Surface Patches 3D Graphics with OpenGL Back-Face Culling Define one side of each polygon to be the visible side That side

### Basic Graphics Programming

CSCI 480 Computer Graphics Lecture 2 Basic Graphics Programming January 11, 2012 Jernej Barbic University of Southern California http://www-bcf.usc.edu/~jbarbic/cs480-s12/ Graphics Pipeline OpenGL API

### Real Time Reflections Han-Wei Shen

Real Time Reflections Han-Wei Shen Reflections One of the most noticeable effect of inter-object lighting Direct calculation of the physics (ray tracing) is too expensive Our focus is to capture the most

### Three Main Themes of Computer Graphics

Three Main Themes of Computer Graphics Modeling How do we represent (or model) 3-D objects? How do we construct models for specific objects? Animation How do we represent the motion of objects? How do

Illumination and Shading Computer Graphics COMP 770 (236) Spring 2007 Instructor: Brandon Lloyd 2/14/07 1 From last time Texture mapping overview notation wrapping Perspective-correct interpolation Texture

### CS488. Implementation of projections. Luc RENAMBOT

CS488 Implementation of projections Luc RENAMBOT 1 3D Graphics Convert a set of polygons in a 3D world into an image on a 2D screen After theoretical view Implementation 2 Transformations P(X,Y,Z) Modeling

Objectives Shading in OpenGL Introduce the OpenGL shading methods - per vertex shading vs per fragment shading - Where to carry out Discuss polygonal shading - Flat - Smooth - Gouraud CITS3003 Graphics

### CSE 167: Introduction to Computer Graphics Lecture #10: View Frustum Culling

CSE 167: Introduction to Computer Graphics Lecture #10: View Frustum Culling Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015 Announcements Project 4 due tomorrow Project

### OpenGL. White Square Code 11/4/09. OpenGL. OpenGL. OpenGL

OpenGL OpenGL OpenGL Is a mechanism to create images in a frame buffer Is an API to access that mechanism Is well specified OpenGL Is not a window system Is not a user interface Is not a display mechanism