1 Graphics CSCI 343, Fall 2015 Lecture 18 Viewing III--More Projection.

Slides:



Advertisements
Similar presentations
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
Advertisements

1 Computer Graphics Chapter 8 3D Transformations.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Projection Matrices modified by Ray Wisman Ed Angel Professor of Computer.
Projection Matrices CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Projection Matrices Ed Angel
Part I: Basics of Computer Graphics Viewing Transformation and Coordinate Systems Chapter
CS 352: Computer Graphics Chapter 5: Viewing. Interactive Computer GraphicsChapter Overview Specifying the viewpoint Specifying the projection Types.
Objectives Derive the perspective projection matrices used for standard OpenGL projections Derive the perspective projection matrices used for standard.
CS 376 Introduction to Computer Graphics 02 / 26 / 2007 Instructor: Michael Eckmann.
4.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 4 Projection Clipping Viewport Transformation.
Rendering Pipeline Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006 (Slide set originally by Greg Humphreys)
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
12.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 12 – 3D Graphics Transformation Pipeline: Projection and Clipping.
Computer Graphics (fall 2009)
1 Projection Matrices. 2 Objectives Derive the projection matrices used for standard OpenGL projections Introduce oblique projections Introduce projection.
CS559: Computer Graphics Lecture 9: Projection Li Zhang Spring 2008.
1 E. Angel and D. Shreiner : Interactive Computer Graphics 6E © Addison-Wesley 2012 Classical Viewing Sai-Keung Wong ( 黃世強 ) Computer Science National.
Chapter 5 Viewing.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 67 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 67 Computer Graphics Three-Dimensional Graphics III.
Computer Graphics Bing-Yu Chen National Taiwan University.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 5.
CAP4730: Computational Structures in Computer Graphics 3D Transformations.
CS 376 Introduction to Computer Graphics 02 / 23 / 2007 Instructor: Michael Eckmann.
CS559: Computer Graphics Lecture 9: Rasterization Li Zhang Spring 2008.
CS 325 Introduction to Computer Graphics 02 / 22 / 2010 Instructor: Michael Eckmann.
CS 450: COMPUTER GRAPHICS PROJECTIONS SPRING 2015 DR. MICHAEL J. REALE.
CS 325 Introduction to Computer Graphics 02 / 26 / 2010 Instructor: Michael Eckmann.
OpenGL The Viewing Pipeline: Definition: a series of operations that are applied to the OpenGL matrices, in order to create a 2D representation from 3D.
University of North Carolina at Greensboro
Basic Perspective Projection Watt Section 5.2, some typos Define a focal distance, d, and shift the origin to be at that distance (note d is negative)
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
©2005, Lee Iverson Lee Iverson UBC Dept. of ECE EECE 478 Viewing and Projection.
Graphics CSCI 343, Fall 2015 Lecture 16 Viewing I
Rendering Pipeline Fall, D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination.
Viewing and Projection
Viewing and Projection
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
Viewing and Projection. The topics Interior parameters Projection type Field of view Clipping Frustum… Exterior parameters Camera position Camera orientation.
Classical Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
CS5500 Computer Graphics March 20, Computer Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Computer Viewing Isaac Gang University of Mary Hardin-Baylor.
Viewing. Classical Viewing Viewing requires three basic elements - One or more objects - A viewer with a projection surface - Projectors that go from.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CS 490: Computer Graphics Chapter 5: Viewing. Interactive Computer GraphicsChapter Overview Specifying the viewpoint Specifying the projection Types.
Outline 3D Viewing Required readings: HB 10-1 to 10-10
3D Viewing and Clipping Ming Ouhyoung 歐陽明 Professor Dept. of CSIE and GINM NTU.
Chapter 11 Three-Dimensional Geometric and Modeling Transformations
Rendering Pipeline Fall, 2015.
University of North Carolina at Greensboro
Rendering Pipeline Aaron Bloomfield CS 445: Introduction to Graphics
CSCE 441 Computer Graphics 3-D Viewing
CSC461: Lecture 20 Parallel Projections in OpenGL
Projections and Normalization
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
A Photograph of two papers
Isaac Gang University of Mary Hardin-Baylor
Shadows Shadows CSCI 440 textbook section 5.10.
Introduction to Computer Graphics with WebGL
Chap 3 Viewing Pipeline Reading:
Introduction to Computer Graphics with WebGL
Viewing (Projections)
Viewing (Projections)
Computer Graphics Computer Viewing
Computer Viewing Ed Angel Professor Emeritus of Computer Science
CS 352: Computer Graphics Chapter 5: Viewing.
Presentation transcript:

1 Graphics CSCI 343, Fall 2015 Lecture 18 Viewing III--More Projection

2 Orthographic and Oblique projections Orthographic Projection: 1)Translate clipping volume to origin 2)Scale sides of clipping volume to be 2x2x2 M = M ORTHO ST Oblique Projection: 1)Shear clipping volume to be rectangular box. 2)Translate to origin 3)Scale sides to 2x2x2 M = M ORTHO STH

3 Perspective Normalization Consider a perspective projection where the viewing angle is 90 deg and the focal distance is 1. x z x = z x = -z Clipping Volume enclosed by: x = +/- z, y = +/- z, z min < z < z max

4 Splitting the projection matrix To fit this in the canonical volume, we want to find a matrix, N, such that: P PROJ = M ORTH N We know that we will have to translate along the Z axis and scale the Z components. Try the following:

5 Fitting the canonical volume At x = -z, x'' = (-(-z/z)) = 1 At x = z, x'' = (-z/z) = -1 Sides of canonical volume The same is true for y. For z max and z min : z min '' = -(  +  /z min ) = -1 z max '' = -(  +  /z max ) = +1 Solve for  and  :

6 Scaling the X and Y edges If the perspective projection does not have a 90 deg viewing angle: We must first scale x and y so the sides are at x = +/-z, y=+/-z x z (x min, z max ) (x max, z max ) P PROJ = M ORTH NS S = ?

7 Dealing with a non-centered clipping volume If the frustum that defines the clipping volume is not a right frustum (i.e. the near and far planes are not centered on the Z axis), we must first Shear the clipping volume to center these. z (x min, z max ) (x max, z max )  Shear along x: Shear along y: x

8 The Shear Matrix Note that this matrix transforms the center point: to Full Perspective Projection: P = M ORTHO NSH

9 Projections and Shadows In simple situations we can generate shadows with a projection trick. Suppose we have a light source at (x a, y a, z a ) The "shadow" of a polygon is its projection onto the x,z plane. (x a, y a, z a ) z x y

10 Projecting a shadow 1.Translate the image so that the light source is at the origin. T(-x a, -y a, -z a ) 2.Compute the projection along the Y axis, with the focal distance equal to -y a. 3.Translate back to the original position: T(x a, y a, z a ) Step 2: Projection Matrix: z x y -y a

Shadow projection in OpenGL Setting up the matrix, M: light = vec3(0.0, 2.0, 0.0); m = mat4(); m[3][3] = 0; m[3][1] = -1/light[1]; Rendering a square: // model-view matrix for square modelViewMatrix = mat4( ); modelViewMatrix = mult(modelViewMatrix, rotate(30.0, 1.0, 0.0, 0.0)); // send color and matrix for square then render gl.uniformMatrix4fv( modelViewMatrixLoc, false, flatten(modelViewMatrix) ); gl.uniform4fv(fColor, flatten(red)); gl.drawArrays(gl.TRIANGLE_FAN, 0, 4);

Drawing the shadow // rotate light source light[0] = Math.sin(theta); light[2] = Math.cos(theta); // model-view matrix for shadow then render modelViewMatrix = mult(modelViewMatrix, translate(light[0], light[1], light[2])); modelViewMatrix = mult(modelViewMatrix, m); modelViewMatrix = mult(modelViewMatrix, translate(-light[0], -light[1], -light[2])); // send color and matrix for shadow gl.uniformMatrix4fv( modelViewMatrixLoc, false, flatten(modelViewMatrix) ); gl.uniform4fv(fColor, flatten(black)); gl.drawArrays(gl.TRIANGLE_FAN, 0, 4);