Introduction to Computer Graphics with WebGL

Size: px
Start display at page:

Download "Introduction to Computer Graphics with WebGL"

Transcription

1 Introduction to Computer Graphics with WebGL Ed Angel Classical Viewing Computer Graphics with WebGL Ed Angel, 204 Classical Viewing Viewing requires three basic elements - One or more objects - A viewer with a projection surface - Projectors that go from the object(s) to the projection surface Classical views are based on the relationship among these elements - The viewer picks up the object and orients it how she would like to see it Each object is assumed to constructed from flat principal faces - Buildings, polyhedra, manufactured objects Computer Graphics with WebGL Ed Angel, Planar Geometric Projections Standard projections project onto a plane Projectors are lines that either - converge at a center of projection - are parallel Such projections preserve lines - but not necessarily angles Nonplanar projections are needed for applications such as map construction Computer Graphics with WebGL Ed Angel, 204 3

2 4 Classical Projections Computer Graphics with WebGL Ed Angel, 204 Taxonomy of Planar Geometric Projections planar geometric projections parallel perspective multiview axonometric orthographic point 2 point 3 point oblique isometric dimetric trimetric Computer Graphics with WebGL Ed Angel, Perspective vs Parallel Computer graphics treats all projections the same and implements them with a single pipeline Classical viewing developed different techniques for drawing each type of projection Fundamental distinction is between parallel and perspective viewing even though mathematically parallel viewing is the limit of perspective viewing Computer Graphics with WebGL Ed Angel, 204 6

3 7 Perspective Projection Computer Graphics with WebGL Ed Angel, 204 Parallel Projection Computer Graphics with WebGL Ed Angel, Orthographic Projection Projectors are orthogonal to projection surface Computer Graphics with WebGL Ed Angel, 204 9

4 Multiview Orthographic Projection Projection plane parallel to principal face Usually form front, top, side views isometric (not multiview orthographic view) front in CAD and architecture, we often display three multiviews plus isometric top side Computer Graphics with WebGL Ed Angel, Axonometric Projections Allow projection plane to move relative to object classify by how many angles of a corner of a projected cube are the same none: trimetric two: dimetric three: isometric θ θ 3 θ 2 Computer Graphics with WebGL Ed Angel, 204 Types of Axonometric Projections Computer Graphics with WebGL Ed Angel, 204 2

5 Oblique Projection Arbitrary relationship between projectors and projection plane Computer Graphics with WebGL Ed Angel, Advantages and Disadvantages Can pick the angles to emphasize a particular face - Architecture: plan oblique, elevation oblique Angles in faces parallel to projection plane are preserved while we can still see around side In physical world, cannot create with simple camera; possible with bellows camera or special lens (architectural) Computer Graphics with WebGL Ed Angel, Perspective Projection Projectors coverge at center of projection Computer Graphics with WebGL Ed Angel, 204 5

6 Three-Point Perspective No principal face parallel to projection plane Three vanishing points for cube Computer Graphics with WebGL Ed Angel, Two-Point Perspective On principal direction parallel to projection plane Two vanishing points for cube Computer Graphics with WebGL Ed Angel, One-Point Perspective One principal face parallel to projection plane One vanishing point for cube Computer Graphics with WebGL Ed Angel, 204 8

7 Introduction to Computer Graphics with WebGL Ed Angel Positioning the Camera Computer Graphics with WebGL Ed Angel, 204 From the Beginning In the beginning: - fixed function pipeline - Model-View and Projection Transformation - Predefined frames: model, object, camera, clip, ndc, window After deprecation - pipeline with programmable shaders - no transformations - clip, ndc window frames MV.js reintroduces original capabilities Computer Graphics with WebGL Ed Angel, Computer Viewing There are three aspects of the viewing process, all of which can be implemented in the pipeline, - Positioning the camera Setting the model-view matrix - Selecting a lens Setting the projection matrix - Clipping Setting the view volume Computer Graphics with WebGL Ed Angel, 204 3

8 4 The WebGL Camera In WebGL, initially the object and camera frames are the same - Default model-view matrix is an identity The camera is located at origin and points in the negative z direction WebGL also specifies a default view volume that is a cube with sides of length 2 centered at the origin - Default projection matrix is an identity Computer Graphics with WebGL Ed Angel, 204 Default Projection Default projection is orthogonal 2 clipped out z=0 Computer Graphics with WebGL Ed Angel, Repositioning the Camera Frame If we want to visualize objects with both positive and negative z values we can either - Move the camera in the positive z direction Translate the camera frame - Move the objects in the negative z direction Translate the world frame Both of these views are equivalent and are determined by the model-view matrix - Need a translation (translate(0.0,0.0,-d);) d > 0 Computer Graphics with WebGL Ed Angel, 204 6

9 7 Moving Camera back from Origin default frames frames after translation by d d > 0 Computer Graphics with WebGL Ed Angel, 204 Moving the Camera We can move the camera to any desired position by a sequence of rotations and translations Example: side view - Rotate the camera - Move it away from origin - Model-view matrix C = TR Computer Graphics with WebGL Ed Angel, WebGL code Remember that last transformation specified is first to be applied // Using MV.js var t = translate (0.0, 0.0, -d); var ry = rotatey(90.0); var m = mult(t, ry); or var m = mult(translate (0.0, 0.0, -d), rotatey(90.0);); Computer Graphics with WebGL Ed Angel, 204 9

10 lookat lookat(eye, at, up) Computer Graphics with WebGL Ed Angel, The lookat Function The GLU library contained the function glulookat to form the required model-view matrix through a simple interface Note the need for setting an up direction Replaced by lookat() in MV.js - Can concatenate with modeling transformations Example: isometric view of cube aligned with axes var eye = vec3(.0,.0,.0); var at = vec3(0.0, 0.0, 0.0); var up = vec3(0.0,.0, 0.0); var mv = lookat(eye, at, up); Computer Graphics with WebGL Ed Angel, 204 Other Viewing APIs The lookat function is only one possible API for positioning the camera Others include - View reference point, view plane normal, view up (PHIGS, GKS-3D) - Yaw, pitch, roll - Elevation, azimuth, twist - Direction angles Computer Graphics with WebGL Ed Angel, 204 2

11 Introduction to Computer Graphics with WebGL Ed Angel Projection Computer Graphics with WebGL Ed Angel, 204 Basic Vertex Shader attribute vec4 vposition; attribute vec4 vcolor; varying vec4 fcolor; uniform mat4 modelviewmatrix; uniform mat4 projectionmatrix; void main() { gl_position = projectionmatrix*modelviewmatrix*vposition; fcolor = vcolor; } Computer Graphics with WebGL Ed Angel, Projection Normalization The default projection in the eye (camera) frame is orthogonal For points within the default view volume x p = x y p = y z p = 0 Most graphics systems use view normalization - All other views are converted to the default view by transformations that determine the projection matrix - Allows use of the same pipeline for all views Computer Graphics with WebGL Ed Angel, 204 3

12 4 x p = x y p = y z p = 0 w p = Homogeneous Coordinate Representation default orthographic projection M = p p = Mp In practice, we can let M = I and set the z term to zero later Computer Graphics with WebGL Ed Angel, 204 Simple Perspective Center of projection at the origin Projection plane z = d, d < 0 Computer Graphics with WebGL Ed Angel, Perspective Equations Consider top and side views x p = y p = z p = d Computer Graphics with WebGL Ed Angel, 204 6

13 7 Homogeneous Coordinate Form consider q = Mp where M = p = q = Computer Graphics with WebGL Ed Angel, 204 Perspective Division However w, so we must divide by w to return from homogeneous coordinates This perspective division yields x p = y p = z p = d the desired perspective equations We specify the desired clipping volume with MV.js functions that are equivalent to deprecated OpenGL functions Computer Graphics with WebGL Ed Angel, 204 8

14 Introduction to Computer Graphics with WebGL Ed Angel WebGL Projection Computer Graphics with WebGL Ed Angel, 204 WebGL Orthogonal Viewing ortho(left,right,bottom,top,near,far) near and far measured from camera Computer Graphics with WebGL Ed Angel, ortho.html Computer Graphics with WebGL Ed Angel, 204 3

15 Viewing a Cube camera Computer Graphics with WebGL Ed Angel, Sphere Equations x = rsinθ cosφ y = rsinθ sinφ z = rcosθ θ constant: circles of constant longitude φ constant: circles of constant latitude Computer Graphics with WebGL Ed Angel, Rotating Camera var render = function() { gl.clear( gl.color_buffer_bit gl.depth_buffer_bit); eye = vec3(radius*math.sin(theta)*math.cos(phi), radius*math.sin(theta)*math.sin(phi), radius*math.cos(theta)); modelviewmatrix = lookat(eye, at, up); projectionmatrix = ortho(left, right, bottom, ytop, near, far); gl.uniformmatrix4fv( modelviewmatrixloc, false, flatten(modelviewmatrix) ); gl.uniformmatrix4fv( projectionmatrixloc, false, flatten(projectionmatrix) ); gl.drawarrays( gl.triangles, 0, numvertices ); requestanimframe(render); } Computer Graphics with WebGL Ed Angel, 204 6

16 7 WebGL Perspective frustum(left,right,bottom,top,near,far) Computer Graphics with WebGL Ed Angel, 204 Using Field of View With frustum it is often difficult to get the desired view perpective(fovy, aspect, near, far) often provides a better interface front plane aspect = w/h Computer Graphics with WebGL Ed Angel, Computing Matrices Compute in JS file, send to vertex shader with gl.uniformmatrix4fv Dynamic: update in render() or shader Computer Graphics with WebGL Ed Angel, 204 9

17 Rotating Camera var render = function(){ gl.clear( gl.color_buffer_bit gl.depth_buffer_bit); eye = vec3(radius*math.sin(theta)*math.cos(phi), radius*math.sin(theta)*math.sin(phi), radius*math.cos(theta)); modelviewmatrix = lookat(eye, at, up); projectionmatrix = perspective(fovy, aspect, near, far); gl.uniformmatrix4fv( modelviewmatrixloc, false, flatten(modelviewmatrix) ); gl.uniformmatrix4fv( projectionmatrixloc, false, flatten(projectionmatrix) ); gl.drawarrays( gl.triangles, 0, NumVertices ); requestanimframe(render); } Computer Graphics with WebGL Ed Angel, 204 0

18 Introduction to Computer Graphics with WebGL Ed Angel Orthogonal Projection Matrices Computer Graphics with WebGL Ed Angel, 204 Normalization Rather than derive a different projection matrix for each type of projection, we can convert all projections to orthogonal projections with the default view volume This strategy allows us to use standard transformations in the pipeline and makes for efficient clipping Computer Graphics with WebGL Ed Angel, Pipeline View model-view transformation nonsingular projection transformation perspective division 4D 3D clipping against default cube projection 3D 2D Computer Graphics with WebGL Ed Angel, 204 3

19 4 Notes We stay in four-dimensional homogeneous coordinates through both the modelview and projection transformations - Both these transformations are nonsingular - Default to identity matrices (orthogonal view) Normalization lets us clip against simple cube regardless of type of projection Delay final projection until end - Important for hidden-surface removal to retain depth information as long as possible Computer Graphics with WebGL Ed Angel, 204 Orthogonal Normalization ortho(left,right,bottom,top,near,far) normalization find transformation to convert specified clipping volume to default Computer Graphics with WebGL Ed Angel, Orthogonal Matrix Two steps - Move center to origin T(-(left+right)/2, -(bottom+top)/2,(near+far)/2)) - Scale to have sides of length 2 S(2/(left-right),2/(top-bottom),2/(near-far)) # 2 right left & % 0 0 right left right left ( % ( % 2 top + bottom 0 0 ( P = ST = % top bottom top bottom ( % 2 far + near ( % 0 0 near far far near ( % ( $ ' Computer Graphics with WebGL Ed Angel, 204 6

20 7 Final Projection Set z =0 Equivalent to the homogeneous coordinate transformation M orth = Hence, general orthogonal projection in 4D is P = M orth ST Computer Graphics with WebGL Ed Angel, 204 Oblique Projections The OpenGL projection functions cannot produce general parallel projections such as However if we look at the example of the cube it appears that the cube has been sheared Oblique Projection = Shear + Orthogonal Projection Computer Graphics with WebGL Ed Angel, General Shear top view side view Computer Graphics with WebGL Ed Angel, 204 9

21 xy shear (z values unchanged) Shear Matrix H(θ,φ) = Projection matrix General case: P = M orth H(θ,φ) P = M orth STH(θ,φ) Computer Graphics with WebGL Ed Angel, Equivalency Computer Graphics with WebGL Ed Angel, 204 Effect on Clipping The projection matrix P = STH transforms the original clipping volume to the default clipping volume object top view z = DOP clipping volume near plane far plane Computer Graphics with WebGL Ed Angel, 204 x = - z = - DOP x = distorted object (projects correctly) 2

22 Introduction to Computer Graphics with WebGL Ed Angel Perspective Projection Matrices Computer Graphics with WebGL Ed Angel, 204 Simple Perspective Consider a simple perspective with the COP at the origin, the near clipping plane at z = -, and a 90 degree field of view determined by the planes x = ±z, y = ±z Computer Graphics with WebGL Ed Angel, Perspective Matrices Simple projection matrix in homogeneous coordinates M = Note that this matrix is independent of the far clipping plane Computer Graphics with WebGL Ed Angel, 204 3

23 4 Generalization N = after perspective division, the point (x, y, z, ) goes to x = x/z y = y/z Z = -(α+β/z) which projects orthogonally to the desired point regardless of α and β Computer Graphics with WebGL Ed Angel, 204 Picking α and β If we pick α = β = the near plane is mapped to z = - the far plane is mapped to z = and the sides are mapped to x = ±, y = ± Hence the new clipping volume is the default clipping volume Computer Graphics with WebGL Ed Angel, Normalization Transformation distorted object projects correctly original clipping volume original object new clipping volume Computer Graphics with WebGL Ed Angel, 204 6

24 7 Normalization and Hidden-Surface Removal Although our selection of the form of the perspective matrices may appear somewhat arbitrary, it was chosen so that if z > z 2 in the original clipping volume then the for the transformed points z > z 2 Thus hidden surface removal works if we first apply the normalization transformation However, the formula z = -(α+β/z) implies that the distances are distorted by the normalization which can cause numerical problems especially if the near distance is small Computer Graphics with WebGL Ed Angel, 204 WebGL Perspective frustum allows for a nonsymmetric viewing frustum (although perspective does not) Computer Graphics with WebGL Ed Angel, OpenGL Perspective Matrix The normalization in frustum requires an initial shear to form a right viewing pyramid, followed by a scaling to get the normalized perspective volume. Finally, the perspective matrix results in needing only a final orthogonal transformation P = NSH our previously defined perspective matrix shear and scale Computer Graphics with WebGL Ed Angel, 204 9

25 Why do we do it this way? Normalization allows for a single pipeline for both perspective and orthogonal viewing We stay in four dimensional homogeneous coordinates as long as possible to retain threedimensional information needed for hidden-surface removal and shading We simplify clipping Computer Graphics with WebGL Ed Angel, Perspective Matrices frustum # 2 * near right left % 0 0 right left right left % % 2 * near top + bottom 0 0 P = % top bottom top bottom % far + near % 0 0 far near % $ * far * near far near & ( ( ( ( ( ( ( ' perspective # near % right % % near P = % top % far + near % 0 0 far near % $ * far * near far near & ( ( ( ( ( ( ( ' Computer Graphics with WebGL Ed Angel, 204

26 Introduction to Computer Graphics with WebGL Ed Angel Meshes Computer Graphics with WebGL Ed Angel, 204 Meshes Polygonal meshes are the standard method for defining and displaying surfaces - Approximations to curved surfaces - Directly from CAD packages - Subdivision Most common are quadrilateral and triangular meshes - Triangle strips and fans Computer Graphics with WebGL Ed Angel, Height Fields For each (x, z) there is a unique y Sampling leads to an array of y values If y ij = f(x i, z j ) then the four points (x i, y ij, z j ), (x (i+), y (i+)j, z j ), (x i, y i(j+), z j+ ), (x (i+), y (i+)(j+), z (j+) form a quadrilateral Display as quadrilateral or triangular mesh using strips Computer Graphics with WebGL Ed Angel, 204 3

27 Honolulu Plot Using Line Strips Computer Graphics with WebGL Ed Angel, Lines on Back and Hidden Faces sombrero or Mexican hat function (sin πr)/(πr) Computer Graphics with WebGL Ed Angel, Using Polygons We can use four adjacent data points to form a quadrilateral and thus two triangles which can be shaded Note using a single color for all polygons will not work well - need lighting and shading to see the 3D nature of the data But what if we want to see the grid? - avoids the need for lighting calculations We can display each quadrilateral twice - First as two filled white triangles - Second as a black line loop Computer Graphics with WebGL Ed Angel, 204 6

28 Hat Using Triangles and Lines Computer Graphics with WebGL Ed Angel, Polygon Offset Even though we draw the polygon first followed by the lines, small numerical errors cause some of fragments on the line to be display behind the corresponding fragment on the triangle Polygon offset (gl.polygonoffset) moves fragments slightly away from camera Apply to triangle rendering Computer Graphics with WebGL Ed Angel, Hat with Polygon Offset Computer Graphics with WebGL Ed Angel, 204 9

29 Other Mesh Issues How do we construct a mesh from disparate data (unstructured points) Technologies such as laser scans can produced tens of millions of such points Delaunay triangulation Can we use one triangle strip for an entire 2D mesh? Mesh simplification Computer Graphics with WebGL Ed Angel, 204 0

30 Introduction to Computer Graphics with WebGL Ed Angel Lighting and Shading Computer Graphics with WebGL Ed Angel, 204 Why we need shading Suppose we build a model of a blue sphere using many polygons and color it using a single color. We get something like But we want something that looks like Computer Graphics with WebGL Ed Angel, Shading Why does the image of a real sphere look like Light-material interactions cause each point to have a different color or shade Need to consider - Light sources - Material properties - Location of viewer - Surface orientation Computer Graphics with WebGL Ed Angel, 204 3

31 4 Scattering Light strikes A - Some scattered - Some absorbed Some of scattered light strikes B - Some scattered - Some absorbed Some of this scattered light strikes A and so on Computer Graphics with WebGL Ed Angel, 204 Rendering Equation The infinite scattering and absorption of light can be described by the rendering equation - Cannot be solved in general - Ray tracing is a special case for perfectly reflecting surfaces Rendering equation is global and includes - Shadows - Multiple scattering from object to object Computer Graphics with WebGL Ed Angel, Global Effects shadow translucent surface multiple reflection Computer Graphics with WebGL Ed Angel, 204 6

32 7 Local vs Global Rendering Correct shading requires a global calculation involving all objects and light sources - Incompatible with pipeline model which shades each polygon independently (local rendering) However, in computer graphics, especially real time graphics, we are happy if things look right - Exist many techniques for approximating global effects Computer Graphics with WebGL Ed Angel, 204 Light-Material Interaction Light that strikes an object is partially absorbed and partially scattered (reflected) The amount reflected determines the color and brightness of the object - A surface appears red under white light because the red component of the light is reflected and the rest is absorbed The reflected light is scattered in a manner that depends on the smoothness and orientation of the surface Computer Graphics with WebGL Ed Angel, Light Sources General light sources are difficult to work with because we must integrate light coming from all points on the source Computer Graphics with WebGL Ed Angel, 204 9

33 Simple Light Sources Point source - Model with position and color - Distant source = infinite distance away (parallel) Spotlight - Restrict light from ideal point source Ambient light - Same amount of light everywhere in scene - Can model contribution of many sources and reflecting surfaces Computer Graphics with WebGL Ed Angel, Surface Types The smoother a surface, the more reflected light is concentrated in the direction a perfect mirror would reflected the light A very rough surface scatters light in all directions smooth surface rough surface Computer Graphics with WebGL Ed Angel, 204

34 Introduction to Computer Graphics with WebGL Ed Angel The Phong Model Computer Graphics with WebGL Ed Angel, 204 Phong Model A simple model that can be computed rapidly Has three components - Diffuse - Specular - Ambient Uses four vectors - To source - To viewer - Normal - Perfect reflector Computer Graphics with WebGL Ed Angel, Ideal Reflector Normal is determined by local orientation Angle of incidence = angle of relection The three vectors must be coplanar r = 2 (l n ) n - l Computer Graphics with WebGL Ed Angel, 204 3

35 4 Lambertian Surface Perfectly diffuse reflector Light scattered equally in all directions Amount of light reflected is proportional to the vertical component of incoming light - reflected light ~cos θ i - cos θ i = l n if vectors normalized - There are also three coefficients, k r, k b, k g that show how much of each color component is reflected We can also add a /d 2 term to account for the distance from the light source Computer Graphics with WebGL Ed Angel, 204 Specular Surfaces Most surfaces are neither ideal diffusers nor perfectly specular (ideal reflectors) Smooth surfaces show specular highlights due to incoming light being reflected in directions concentrated close to the direction of a perfect reflection specular highlight Computer Graphics with WebGL Ed Angel, Modeling Specular Relections Phong proposed using a term that dropped off as the angle between the viewer and the ideal reflection increased I r ~ k s I cos α φ reflected shininess coef intensity incoming intensity absorption coef φ Computer Graphics with WebGL Ed Angel, 204 6

36 7 The Shininess Coefficient Values of α between 00 and 200 correspond to metals Values between 5 and 0 give surface that look like plastic cos α φ -90 Computer Graphics with WebGL Ed Angel, 204 φ 90

37 Introduction to Computer Graphics with WebGL Ed Angel Applying the Phong Model Computer Graphics with WebGL Ed Angel, 204 Ambient Light Ambient light is the result of multiple interactions between (large) light sources and the objects in the environment Amount and color depend on both the color of the light(s) and the material properties of the object Add k a I a to diffuse and specular terms reflection coef intensity of ambient light Computer Graphics with WebGL Ed Angel, Distance Terms The light from a point source that reaches a surface is inversely proportional to the square of the distance between them We can add a factor of the form /(a + bd +cd 2 ) to the diffuse and specular terms The constant and linear terms soften the effect of the point source Computer Graphics with WebGL Ed Angel, 204 3

38 4 Light Sources In the Phong Model, we add the results from each light source Each light source has separate diffuse, specular, and ambient terms to allow for maximum flexibility even though this form does not have a physical justification Separate red, green and blue components Hence, 9 coefficients for each point source - I dr, I dg, I db, I sr, I sg, I sb, I ar, I ag, I ab Computer Graphics with WebGL Ed Angel, 204 Material Properties Material properties match light source properties - Nine absorbtion coefficients k dr, k dg, k db, k sr, k sg, k sb, k ar, k ag, k ab - Shininess coefficient α Computer Graphics with WebGL Ed Angel, Adding Up the Components For each light source and each color component, the Phong model can be written (without the distance terms) as I =k d I d l n + k s I s (v r ) α + k a I a For each color component we add contributions from all sources Computer Graphics with WebGL Ed Angel, 204 6

39 7 Modified Phong Model The specular term in the Phong model is problematic because it requires the calculation of a new reflection vector and view vector for each vertex Blinn suggested an approximation using the halfway vector that is more efficient Computer Graphics with WebGL Ed Angel, 204 The Halfway Vector h is normalized vector halfway between l and v h = ( l + v )/ l + v Computer Graphics with WebGL Ed Angel, Using the halfway vector Replace (v r ) α by (n h ) β β is chosen to match shininess Note that halfway angle is half of angle between r and v if vectors are coplanar Resulting model is known as the modified Phong or Phong-Blinn lighting model - Specified in OpenGL standard Computer Graphics with WebGL Ed Angel, 204 9

40 Example Only differences in these teapots are the parameters in the modified Phong model Computer Graphics with WebGL Ed Angel, Computation of Vectors l and v are specified by the application Can computer r from l and n Problem is determining n For simple surfaces it can be determined but how we determine n differs depending on underlying representation of surface WebGL leaves determination of normals to application Computer Graphics with WebGL Ed Angel, 204 Plane Normals Equation of plane: ax+by+cz+d = 0 We know that plane is determined by three points p 0, p 2, p 3 or normal n and p 0 Normal can be obtained by n = (p 2 -p 0 ) (p -p 0 ) Computer Graphics with WebGL Ed Angel, 204 2

41 Normal to Sphere Implicit function f(x,y.z)=0 Normal given by gradient Sphere f(p)=p p- n = [ f/ x, f/ y, f/ z] T =p Computer Graphics with WebGL Ed Angel, Computing Reflection Direction Angle of incidence = angle of reflection Normal, light direction and reflection direction are coplaner Want all three to be unit length r = 2(l n)n l Computer Graphics with WebGL Ed Angel, 204 4

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

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

More information

CS452/552; EE465/505. Intro to Lighting

CS452/552; EE465/505. Intro to Lighting CS452/552; EE465/505 Intro to Lighting 2-10 15 Outline! Projection Normalization! Introduction to Lighting (and Shading) Read: Angel Chapter 5., sections 5.4-5.7 Parallel Projections Chapter 6, sections

More information

Overview. Viewing and perspectives. Planar Geometric Projections. Classical Viewing. Classical views Computer viewing Perspective normalization

Overview. Viewing and perspectives. Planar Geometric Projections. Classical Viewing. Classical views Computer viewing Perspective normalization Overview Viewing and perspectives Classical views Computer viewing Perspective normalization Classical Viewing Viewing requires three basic elements One or more objects A viewer with a projection surface

More information

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 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

More information

WHY WE NEED SHADING. Suppose we build a model of a sphere using many polygons and color it with glcolor. We get something like.

WHY WE NEED SHADING. Suppose we build a model of a sphere using many polygons and color it with glcolor. We get something like. LIGHTING 1 OUTLINE Learn to light/shade objects so their images appear three-dimensional Introduce the types of light-material interactions Build a simple reflection model---the Phong model--- that can

More information

Shading. Why we need shading. Scattering. Shading. Objectives

Shading. Why we need shading. Scattering. Shading. Objectives Shading Why we need shading Objectives Learn to shade objects so their images appear three-dimensional Suppose we build a model of a sphere using many polygons and color it with glcolor. We get something

More information

Three-Dimensional Graphics III. Guoying Zhao 1 / 67

Three-Dimensional Graphics III. Guoying Zhao 1 / 67 Computer Graphics Three-Dimensional Graphics III Guoying Zhao 1 / 67 Classical Viewing Guoying Zhao 2 / 67 Objectives Introduce the classical views Compare and contrast image formation by computer with

More information

Comp 410/510 Computer Graphics. Spring Shading

Comp 410/510 Computer Graphics. Spring Shading Comp 410/510 Computer Graphics Spring 2017 Shading Why we need shading Suppose we build a model of a sphere using many polygons and then color it using a fixed color. We get something like But we rather

More information

Illumination & Shading

Illumination & Shading Illumination & Shading Goals Introduce the types of light-material interactions Build a simple reflection model---the Phong model--- that can be used with real time graphics hardware Why we need Illumination

More information

Classical and Computer Viewing. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico

Classical and Computer Viewing. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico Classical and Computer Viewing Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico Planar Geometric Projections Standard projections project onto a plane Projectors

More information

Shading I Computer Graphics I, Fall 2008

Shading I Computer Graphics I, Fall 2008 Shading I 1 Objectives Learn to shade objects ==> images appear threedimensional Introduce types of light-material interactions Build simple reflection model Phong model Can be used with real time graphics

More information

One or more objects A viewer with a projection surface Projectors that go from the object(s) to the projection surface

One or more objects A viewer with a projection surface Projectors that go from the object(s) to the projection surface Classical Viewing Viewing requires three basic elements One or more objects A viewer with a projection surface Projectors that go from the object(s) to the projection surface Classical views are based

More information

Introduction to Computer Graphics 7. Shading

Introduction to Computer Graphics 7. Shading Introduction to Computer Graphics 7. Shading National Chiao Tung Univ, Taiwan By: I-Chen Lin, Assistant Professor Textbook: Hearn and Baker, Computer Graphics, 3rd Ed., Prentice Hall Ref: E.Angel, Interactive

More information

Building Models. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Building Models. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015 Building Models 1 Objectives Introduce simple data structures for building polygonal models Vertex lists Edge lists 2 Representing a Mesh Consider a mesh v 5 v 6 e e e 3 v 9 8 8 v e 4 1 e 11 e v v 7 7

More information

Overview. Shading. Shading. Why we need shading. Shading Light-material interactions Phong model Shading polygons Shading in OpenGL

Overview. Shading. Shading. Why we need shading. Shading Light-material interactions Phong model Shading polygons Shading in OpenGL Overview Shading Shading Light-material interactions Phong model Shading polygons Shading in OpenGL Why we need shading Suppose we build a model of a sphere using many polygons and color it with glcolor.

More information

Computer Graphics. Shading. Based on slides by Dianna Xu, Bryn Mawr College

Computer Graphics. Shading. Based on slides by Dianna Xu, Bryn Mawr College Computer Graphics Shading Based on slides by Dianna Xu, Bryn Mawr College Image Synthesis and Shading Perception of 3D Objects Displays almost always 2 dimensional. Depth cues needed to restore the third

More information

CS452/552; EE465/505. Models & Viewing

CS452/552; EE465/505. Models & Viewing CS452/552; EE465/505 Models & Viewing 2-03 15 Outline! Building Polygonal Models Vertex lists; gl.drawarrays( ) Edge lists: gl.drawelements( )! Viewing Classical Viewing Read: Viewing in Web3D Angel, Section

More information

Three-Dimensional Graphics V. Guoying Zhao 1 / 55

Three-Dimensional Graphics V. Guoying Zhao 1 / 55 Computer Graphics Three-Dimensional Graphics V Guoying Zhao 1 / 55 Shading Guoying Zhao 2 / 55 Objectives Learn to shade objects so their images appear three-dimensional Introduce the types of light-material

More information

Introduction to Computer Graphics with WebGL

Introduction to Computer Graphics with WebGL Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science Laboratory University of New Mexico 1 Computer Viewing

More information

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. 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

More information

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

3D Viewing. Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller 3D Viewing Introduction to Computer Graphics Torsten Möller Machiraju/Zhang/Möller Reading Chapter 4 of Angel Chapter 13 of Hughes, van Dam, Chapter 7 of Shirley+Marschner Machiraju/Zhang/Möller 2 Objectives

More information

Objectives. Introduce Phong model Introduce modified Phong model Consider computation of required vectors Discuss polygonal shading.

Objectives. Introduce Phong model Introduce modified Phong model Consider computation of required vectors Discuss polygonal shading. Shading II 1 Objectives Introduce Phong model Introduce modified Phong model Consider computation of required vectors Discuss polygonal shading Flat Smooth Gouraud 2 Phong Lighting Model A simple model

More information

CS 4600 Fall Utah School of Computing

CS 4600 Fall Utah School of Computing Lighting CS 4600 Fall 2015 Utah School of Computing Objectives Learn to shade objects so their images appear three-dimensional Introduce the types of light-material interactions Build a simple reflection

More information

Lessons Learned from HW4. Shading. Objectives. Why we need shading. Shading. Scattering

Lessons Learned from HW4. Shading. Objectives. Why we need shading. Shading. Scattering Lessons Learned from HW Shading CS Interactive Computer Graphics Prof. David E. Breen Department of Computer Science Only have an idle() function if something is animated Set idle function to NULL, when

More information

Computer Viewing and Projection. Overview. Computer Viewing. David Carr Fundamentals of Computer Graphics Spring 2004 Based on Slides by E.

Computer Viewing and Projection. Overview. Computer Viewing. David Carr Fundamentals of Computer Graphics Spring 2004 Based on Slides by E. INSTITUTIONEN FÖR SYSTEMTEKNIK LULEÅ TEKNISKA UNIVERSITET Computer Viewing and Projection David Carr Fundamentals of Computer Graphics Spring 24 Based on Slides by E. Angel Projection 1 L Overview Computer

More information

Lighting and Shading II. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Lighting and Shading II. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015 Lighting and Shading II 1 Objectives Continue discussion of shading Introduce modified Phong model Consider computation of required vectors 2 Ambient Light Ambient light is the result of multiple interactions

More information

Objectives. Continue discussion of shading Introduce modified Phong model Consider computation of required vectors

Objectives. Continue discussion of shading Introduce modified Phong model Consider computation of required vectors Objectives Continue discussion of shading Introduce modified Phong model Consider computation of required vectors 1 Lambertian Surface Perfectly diffuse reflector Light scattered equally in all directions

More information

Why we need shading?

Why we need shading? Why we need shading? Suppose we build a model of a sphere using many polygons and color it with glcolor. We get something like But we want Light-material interactions cause each point to have a different

More information

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Lecture 15: Shading-I. CITS3003 Graphics & Animation Lecture 15: Shading-I CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives Learn that with appropriate shading so objects appear as threedimensional

More information

Introduction to Computer Graphics 4. Viewing in 3D

Introduction to Computer Graphics 4. Viewing in 3D Introduction to Computer Graphics 4. Viewing in 3D National Chiao Tung Univ, Taiwan By: I-Chen Lin, Assistant Professor Textbook: E.Angel, Interactive Computer Graphics, 5 th Ed., Addison Wesley Ref: Hearn

More information

C O M P U T E R G R A P H I C S. Computer Graphics. Three-Dimensional Graphics V. Guoying Zhao 1 / 65

C O M P U T E R G R A P H I C S. Computer Graphics. Three-Dimensional Graphics V. Guoying Zhao 1 / 65 Computer Graphics Three-Dimensional Graphics V Guoying Zhao 1 / 65 Shading Guoying Zhao 2 / 65 Objectives Learn to shade objects so their images appear three-dimensional Introduce the types of light-material

More information

Computer Viewing. Prof. George Wolberg Dept. of Computer Science City College of New York

Computer Viewing. Prof. George Wolberg Dept. of Computer Science City College of New York Computer Viewing Prof. George Wolberg Dept. of Computer Science City College of New York Objectives Introduce the mathematics of projection Introduce OpenGL viewing functions Look at alternate viewing

More information

Shading II. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Shading II. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico Shading II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico 1 Objectives Continue discussion of shading Introduce modified Phong model

More information

Objectives. Shading II. Distance Terms. The Phong Reflection Model

Objectives. Shading II. Distance Terms. The Phong Reflection Model Shading II Objectives Introduce distance terms to the shading model. More details about the Phong model (lightmaterial interaction). Introduce the Blinn lighting model (also known as the modified Phong

More information

3D Viewing. With acknowledge to: Ed Angel. Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

3D Viewing. With acknowledge to: Ed Angel. Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico 3D Viewing With acknowledge to: Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico 1 Classical Viewing Viewing plane projectors Classical

More information

CITSTUDENTS.IN VIEWING. Computer Graphics and Visualization. Classical and computer viewing. Viewing with a computer. Positioning of the camera

CITSTUDENTS.IN VIEWING. Computer Graphics and Visualization. Classical and computer viewing. Viewing with a computer. Positioning of the camera UNIT - 6 7 hrs VIEWING Classical and computer viewing Viewing with a computer Positioning of the camera Simple projections Projections in OpenGL Hiddensurface removal Interactive mesh displays Parallelprojection

More information

CS452/552; EE465/505. Lighting & Shading

CS452/552; EE465/505. Lighting & Shading CS452/552; EE465/505 Lighting & Shading 2-17 15 Outline! More on Lighting and Shading Read: Angel Chapter 6 Lab2: due tonight use ASDW to move a 2D shape around; 1 to center Local Illumination! Approximate

More information

Fundamental Types of Viewing

Fundamental Types of Viewing Viewings Fundamental Types of Viewing Perspective views finite COP (center of projection) Parallel views COP at infinity DOP (direction of projection) perspective view parallel view Classical Viewing Specific

More information

Announcement. Project 1 has been posted online and in dropbox. Due: 11:59:59 pm, Friday, October 14

Announcement. Project 1 has been posted online and in dropbox. Due: 11:59:59 pm, Friday, October 14 Announcement Project 1 has been posted online and in dropbox Due: 11:59:59 pm, Friday, October 14 Project 1: Interactive Viewing of Two Teapots How to create a teapot? Before OpenGL 3., glutsolidteapot

More information

Shading II. CITS3003 Graphics & Animation

Shading II. CITS3003 Graphics & Animation Shading II CITS3003 Graphics & Animation Objectives Introduce distance terms to the shading model. More details about the Phong model (lightmaterial interaction). Introduce the Blinn lighting model (also

More information

Building Models. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Building Models. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science Building Models CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science 1 Objectives Introduce simple data structures for building polygonal models - Vertex lists - Edge

More information

CS452/552; EE465/505. Review & Examples

CS452/552; EE465/505. Review & Examples CS452/552; EE465/505 Review & Examples 2-05 15 Outline Review and Examples:! Shaders, Buffers & Binding! Example: Draw 3 Triangles Vertex lists; gl.drawarrays( ) Edge lists: gl.drawelements( )! Example:

More information

Course no. DIS4566 National Chiao Tung Univ, Taiwan By: I-Chen Lin, Assistant Professor

Course no. DIS4566 National Chiao Tung Univ, Taiwan By: I-Chen Lin, Assistant Professor Computer Graphics 3. Viewing in 3D (b) Course no. DIS4566 National Chiao Tung Univ, Taiwan By: I-Chen Lin, Assistant Professor Textbook: E.Angel, Interactive Computer Graphics, 4 th Ed., Addison Wesley

More information

Computer Graphics (CS 4731) Lecture 16: Lighting, Shading and Materials (Part 1)

Computer Graphics (CS 4731) Lecture 16: Lighting, Shading and Materials (Part 1) Computer Graphics (CS 4731) Lecture 16: Lighting, Shading and Materials (Part 1) Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Why do we need Lighting & shading? Sphere

More information

Computer Graphics (CS 543) Lecture 7b: Intro to lighting, Shading and Materials + Phong Lighting Model

Computer Graphics (CS 543) Lecture 7b: Intro to lighting, Shading and Materials + Phong Lighting Model Computer Graphics (CS 543) Lecture 7b: Intro to lighting, Shading and Materials + Phong Lighting Model Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Why do we need Lighting

More information

Computer Viewing Computer Graphics I, Fall 2008

Computer Viewing Computer Graphics I, Fall 2008 Computer Viewing 1 Objectives Introduce mathematics of projection Introduce OpenGL viewing functions Look at alternate viewing APIs 2 Computer Viewing Three aspects of viewing process All implemented in

More information

Computer Viewing. CITS3003 Graphics & Animation. E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley

Computer Viewing. CITS3003 Graphics & Animation. E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley Computer Viewing CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 1 Objectives Introduce the mathematics of projection Introduce OpenGL viewing

More information

Computer Graphics. Bing-Yu Chen National Taiwan University The University of Tokyo

Computer Graphics. Bing-Yu Chen National Taiwan University The University of Tokyo Computer Graphics Bing-Yu Chen National Taiwan Universit The Universit of Toko Viewing in 3D 3D Viewing Process Classical Viewing and Projections 3D Snthetic Camera Model Parallel Projection Perspective

More information

Computer Graphics. Jeng-Sheng Yeh 葉正聖 Ming Chuan University (modified from Bing-Yu Chen s slides)

Computer Graphics. Jeng-Sheng Yeh 葉正聖 Ming Chuan University (modified from Bing-Yu Chen s slides) Computer Graphics Jeng-Sheng Yeh 葉正聖 Ming Chuan Universit (modified from Bing-Yu Chen s slides) Viewing in 3D 3D Viewing Process Specification of an Arbitrar 3D View Orthographic Parallel Projection Perspective

More information

5.8.3 Oblique Projections

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

More information

Models and Architectures

Models and Architectures Models and Architectures Objectives Learn the basic design of a graphics system Introduce graphics pipeline architecture Examine software components for an interactive graphics system 1 Image Formation

More information

Chapter 5. Projections and Rendering

Chapter 5. Projections and Rendering Chapter 5 Projections and Rendering Topics: Perspective Projections The rendering pipeline In order to view manipulate and view a graphics object we must find ways of storing it a computer-compatible way.

More information

Viewing with Computers (OpenGL)

Viewing with Computers (OpenGL) We can now return to three-dimension?', graphics from a computer perspective. Because viewing in computer graphics is based on the synthetic-camera model, we should be able to construct any of the classical

More information

Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation

Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation Lecture 17: Shading in OpenGL CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives Introduce the OpenGL shading methods - per vertex shading

More information

Illumination & Shading I

Illumination & Shading I CS 543: Computer Graphics Illumination & Shading I Robert W. Lindeman Associate Professor Interactive Media & Game Development Department of Computer Science Worcester Polytechnic Institute gogo@wpi.edu

More information

Announcements. Submitting Programs Upload source and executable(s) (Windows or Mac) to digital dropbox on Blackboard

Announcements. Submitting Programs Upload source and executable(s) (Windows or Mac) to digital dropbox on Blackboard Now Playing: Vertex Processing: Viewing Coulibaly Amadou & Mariam from Dimanche a Bamako Released August 2, 2005 Rick Skarbez, Instructor COMP 575 September 27, 2007 Announcements Programming Assignment

More information

Lighting. Figure 10.1

Lighting. Figure 10.1 We have learned to build three-dimensional graphical models and to display them. However, if you render one of our models, you might be disappointed to see images that look flat and thus fail to show the

More information

Virtual Reality for Human Computer Interaction

Virtual Reality for Human Computer Interaction Virtual Reality for Human Computer Interaction Appearance: Lighting Representation of Light and Color Do we need to represent all I! to represent a color C(I)? No we can approximate using a three-color

More information

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models Computergrafik Thomas Buchberger, Matthias Zwicker Universität Bern Herbst 2008 Today Introduction Local shading models Light sources strategies Compute interaction of light with surfaces Requires simulation

More information

Graphics for VEs. Ruth Aylett

Graphics for VEs. Ruth Aylett Graphics for VEs Ruth Aylett Overview VE Software Graphics for VEs The graphics pipeline Projections Lighting Shading VR software Two main types of software used: off-line authoring or modelling packages

More information

Reflection and Shading

Reflection and Shading Reflection and Shading R. J. Renka Department of Computer Science & Engineering University of North Texas 10/19/2015 Light Sources Realistic rendering requires that we model the interaction between light

More information

Graphics for VEs. Ruth Aylett

Graphics for VEs. Ruth Aylett Graphics for VEs Ruth Aylett Overview VE Software Graphics for VEs The graphics pipeline Projections Lighting Shading Runtime VR systems Two major parts: initialisation and update loop. Initialisation

More information

Three Main Themes of Computer Graphics

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

More information

521493S Computer Graphics Exercise 2 Solution (Chapters 4-5)

521493S Computer Graphics Exercise 2 Solution (Chapters 4-5) 5493S Computer Graphics Exercise Solution (Chapters 4-5). Given two nonparallel, three-dimensional vectors u and v, how can we form an orthogonal coordinate system in which u is one of the basis vectors?

More information

QUESTION BANK 10CS65 : COMPUTER GRAPHICS AND VISUALIZATION

QUESTION BANK 10CS65 : COMPUTER GRAPHICS AND VISUALIZATION QUESTION BANK 10CS65 : COMPUTER GRAPHICS AND VISUALIZATION INTRODUCTION OBJECTIVE: This chapter deals the applications of computer graphics and overview of graphics systems and imaging. UNIT I 1 With clear

More information

CHAPTER 1 Graphics Systems and Models 3

CHAPTER 1 Graphics Systems and Models 3 ?????? 1 CHAPTER 1 Graphics Systems and Models 3 1.1 Applications of Computer Graphics 4 1.1.1 Display of Information............. 4 1.1.2 Design.................... 5 1.1.3 Simulation and Animation...........

More information

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

Objectives Shading in OpenGL. Front and Back Faces. OpenGL shading. Introduce the OpenGL shading methods. Discuss polygonal shading 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

More information

CS130 : Computer Graphics Lecture 8: Lighting and Shading. Tamar Shinar Computer Science & Engineering UC Riverside

CS130 : Computer Graphics Lecture 8: Lighting and Shading. Tamar Shinar Computer Science & Engineering UC Riverside CS130 : Computer Graphics Lecture 8: Lighting and Shading Tamar Shinar Computer Science & Engineering UC Riverside Why we need shading Suppose we build a model of a sphere using many polygons and color

More information

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

Lighting and Shading Computer Graphics I Lecture 7. Light Sources Phong Illumination Model Normal Vectors [Angel, Ch 15-462 Computer Graphics I Lecture 7 Lighting and Shading February 12, 2002 Frank Pfenning Carnegie Mellon University http://www.cs.cmu.edu/~fp/courses/graphics/ Light Sources Phong Illumination Model

More information

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014 ECS 175 COMPUTER GRAPHICS Ken Joy Winter 2014 Shading To be able to model shading, we simplify Uniform Media no scattering of light Opaque Objects No Interreflection Point Light Sources RGB Color (eliminating

More information

Illumination in Computer Graphics

Illumination in Computer Graphics Illumination in Computer Graphics Ann McNamara Illumination in Computer Graphics Definition of light sources. Analysis of interaction between light and objects in a scene. Rendering images that are faithful

More information

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models Computergrafik Matthias Zwicker Universität Bern Herbst 2009 Today Introduction Local shading models Light sources strategies Compute interaction of light with surfaces Requires simulation of physics Global

More information

Introduction to Computer Graphics with WebGL

Introduction to Computer Graphics with WebGL Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science Laboratory University of New Mexico Models and Architectures

More information

Today s class. Simple shadows Shading Lighting in OpenGL. Informationsteknologi. Wednesday, November 21, 2007 Computer Graphics - Class 10 1

Today s class. Simple shadows Shading Lighting in OpenGL. Informationsteknologi. Wednesday, November 21, 2007 Computer Graphics - Class 10 1 Today s class Simple shadows Shading Lighting in OpenGL Wednesday, November 21, 27 Computer Graphics - Class 1 1 Simple shadows Simple shadows can be gotten by using projection matrices Consider a light

More information

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

CSE 167: Introduction to Computer Graphics Lecture #6: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016 CSE 167: Introduction to Computer Graphics Lecture #6: Lights Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016 Announcements Thursday in class: midterm #1 Closed book Material

More information

CHAPTER5. We have learned to build three-dimensional graphical models and to LIGHTING AND SHADING

CHAPTER5. We have learned to build three-dimensional graphical models and to LIGHTING AND SHADING LIGHTING AND SHADING CHAPTER5 We have learned to build three-dimensional graphical models and to display them. However, if you render one of our models, you might be disappointed to see images that look

More information

On the Midterm Exam. Monday, 10/17 in class. Closed book and closed notes. One-side and one page cheat sheet is allowed. A calculator is allowed

On the Midterm Exam. Monday, 10/17 in class. Closed book and closed notes. One-side and one page cheat sheet is allowed. A calculator is allowed On the Midterm Exam Monday, 1/17 in class Closed book and closed notes One-side and one page cheat sheet is allowed A calculator is allowed Covers the topics until the class on Wednesday, 1/12 Take-home

More information

CS5620 Intro to Computer Graphics

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

More information

Introduction to Computer Graphics with WebGL

Introduction to Computer Graphics with WebGL 1 Introduction to Computer Graphics with WebGL Ed Angel Transformations General Transformations A transformation maps points to other points and/or vectors to other vectors v=t(u) Q=T(P) 2 Affine Transformations

More information

Chapter 2 A top-down approach - How to make shaded images?

Chapter 2 A top-down approach - How to make shaded images? Chapter 2 A top-down approach - How to make shaded images? Comp. Graphics (U), Chap 2 Global View 1 CGGM Lab., CS Dept., NCTU Jung Hong Chuang Graphics API vs. application API Graphics API Support rendering

More information

Computer Graphics. Illumination and Shading

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

More information

Virtual Cameras & Their Matrices

Virtual Cameras & Their Matrices Virtual Cameras & Their Matrices J.Tumblin-Modified, highly edited SLIDES from: Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 What is Projection? Any operation that reduces

More information

Computer Graphics. Ray Tracing. Based on slides by Dianna Xu, Bryn Mawr College

Computer Graphics. Ray Tracing. Based on slides by Dianna Xu, Bryn Mawr College Computer Graphics Ray Tracing Based on slides by Dianna Xu, Bryn Mawr College Ray Tracing Example Created by Anto Matkovic Ray Tracing Example Ray Tracing Example Ray Tracing Most light rays do not reach

More information

CS 130 Final. Fall 2015

CS 130 Final. Fall 2015 CS 130 Final Fall 2015 Name Student ID Signature You may not ask any questions during the test. If you believe that there is something wrong with a question, write down what you think the question is trying

More information

Pipeline Operations. CS 4620 Lecture 10

Pipeline Operations. CS 4620 Lecture 10 Pipeline Operations CS 4620 Lecture 10 2008 Steve Marschner 1 Hidden surface elimination Goal is to figure out which color to make the pixels based on what s in front of what. Hidden surface elimination

More information

Illumination & Shading: Part 1

Illumination & Shading: Part 1 Illumination & Shading: Part 1 Light Sources Empirical Illumination Shading Local vs Global Illumination Lecture 10 Comp 236 Spring 2005 Computer Graphics Jargon: Illumination Models Illumination - the

More information

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

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,

More information

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon Lighting and Shading Slides: Tamar Shinar, Victor Zordon Why we need shading Suppose we build a model of a sphere using many polygons and color each the same color. We get something like But we want 2

More information

CS452/552; EE465/505. Transformations

CS452/552; EE465/505. Transformations CS452/552; EE465/55 Transformations 1-29-15 Outline! Transformations Read: Angel, Chapter 4 (study cube.html/cube.js example) Helpful links: Linear Algebra: Khan Academy Lab1 is posted on github, due:

More information

So we have been talking about 3D viewing, the transformations pertaining to 3D viewing. Today we will continue on it. (Refer Slide Time: 1:15)

So we have been talking about 3D viewing, the transformations pertaining to 3D viewing. Today we will continue on it. (Refer Slide Time: 1:15) Introduction to Computer Graphics Dr. Prem Kalra Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture - 8 3D Viewing So we have been talking about 3D viewing, the

More information

Viewing. Reading: Angel Ch.5

Viewing. Reading: Angel Ch.5 Viewing Reading: Angel Ch.5 What is Viewing? Viewing transform projects the 3D model to a 2D image plane 3D Objects (world frame) Model-view (camera frame) View transform (projection frame) 2D image View

More information

Chapter 8 Three-Dimensional Viewing Operations

Chapter 8 Three-Dimensional Viewing Operations Projections Chapter 8 Three-Dimensional Viewing Operations Figure 8.1 Classification of planar geometric projections Figure 8.2 Planar projection Figure 8.3 Parallel-oblique projection Figure 8.4 Orthographic

More information

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

Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL International Edition Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL Sixth Edition Edward Angel Dave Shreiner Interactive Computer Graphics: A Top-Down Approach with Shader-Based

More information

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. 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

More information

COMP Computer Graphics and Image Processing. a6: Projections. In part 2 of our study of Viewing, we ll look at. COMP27112 Toby Howard

COMP Computer Graphics and Image Processing. a6: Projections. In part 2 of our study of Viewing, we ll look at. COMP27112 Toby Howard Computer Graphics and Image Processing a6: Projections Tob.Howard@manchester.ac.uk Introduction In part 2 of our stud of Viewing, we ll look at The theor of geometrical planar projections Classes of projections

More information

Chap 7, 2008 Spring Yeong Gil Shin

Chap 7, 2008 Spring Yeong Gil Shin Three-Dimensional i Viewingi Chap 7, 28 Spring Yeong Gil Shin Viewing i Pipeline H d fi i d? How to define a window? How to project onto the window? Rendering "Create a picture (in a synthetic camera)

More information

Viewing. Cliff Lindsay, Ph.D. WPI

Viewing. Cliff Lindsay, Ph.D. WPI Viewing Cliff Lindsa, Ph.D. WPI Building Virtual Camera Pipeline l Used To View Virtual Scene l First Half of Rendering Pipeline Related To Camera l Takes Geometr From ApplicaHon To RasteriaHon Stages

More information

Shading. Brian Curless CSE 557 Autumn 2017

Shading. Brian Curless CSE 557 Autumn 2017 Shading Brian Curless CSE 557 Autumn 2017 1 Reading Optional: Angel and Shreiner: chapter 5. Marschner and Shirley: chapter 10, chapter 17. Further reading: OpenGL red book, chapter 5. 2 Basic 3D graphics

More information

Computer Graphics. Illumination Models and Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL

Computer Graphics. Illumination Models and Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL Computer Graphics Chapter 10 llumination Models and Surface-Rendering Methods Somsak Walairacht, Computer Engineering, KMTL Outline Light Sources Surface Lighting Effects Basic llumination Models Polygon

More information

Viewing and Projection

Viewing and Projection CSCI 480 Computer Graphics Lecture 5 Viewing and Projection January 25, 2012 Jernej Barbic University of Southern California Shear Transformation Camera Positioning Simple Parallel Projections Simple Perspective

More information