On to 3D Introduction to Computer Graphics and Animation (Principle of Computer Graphics) Rattapoom Waranusast.

Slides:



Advertisements
Similar presentations
MAT 594CM S2010Fundamentals of Spatial ComputingAngus Forbes Overview Goals of the course: 1. to introduce real-time 3D graphics programming with openGL.
Advertisements

Hidden Surface Removal CSE 581. Visibility Assumption: All polygons are opaque What polygons are visible with respect to your view frustum?  Outside:
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
1 L44 Introduction to Java Applets. 2 OBJECTIVES  To differentiate between applets and applications.  To observe some of Java's exciting capabilities.
Sierpinski Gasket Program
OpenGL (II). How to Draw a 3-D object on Screen?
CS 4731: Computer Graphics Lecture 11: 3D Viewing Emmanuel Agu.
Informationsteknologi Wednesday, November 14, 2007Computer Graphics - Class 81 Today’s class Orthogonal matrices Quaternions Shears Synthetic camera Viewing.
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.
Introduction to 3D viewing 3D is just like taking a photograph!
3D coordinate systems X Y Z Right-Hand Coordinate System X Y Z Left-Hand Coordinate System OpenGL uses this! Direct3D uses this!
Geometric Perspectives. Everything has a name… Face Corner (Vertex) Edges.
CSE 381 – Advanced Game Programming Basic 3D Graphics
GLWidget Description Jason Goffeney 3/8/2006. GLWidget The GLWidget class extends the Qt QGLWidget. The QGLWidget is a Qt Widget that happens to have.
The Viewing Pipeline (Chapter 4) 5/26/ Overview OpenGL viewing pipeline: OpenGL viewing pipeline: – Modelview matrix – Projection matrix Parallel.
Triangulation Introduction to Computer Graphics and Animation (Principle of Computer Graphics) Rattapoom Waranusast.
2 COEN Computer Graphics I Evening’s Goals n Discuss the mathematical transformations that are utilized for computer graphics projection viewing.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 5 Working with Images Starting Out with Games & Graphics in.
ISOMETRIC PROJECTION Part II
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 7 The Game Loop and Animation Starting Out with Games & Graphics.
Homogeneous Form, Introduction to 3-D Graphics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 20,
MATH 306 Chapter 1.
PowerPoint Basics Tutorial 3: Graphics In this tutorial we’ll be looking at graphics, and the various types of illustrations that can be included in a.
Two-Point Perspective
Animate picture to peek from bottom (1 of 3) 1. Right click on picture you want to animate. 2. Click on Custom Animation. 2 1 R.
Lecture 6: 3D graphics Concepts 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 718,  ex 2271 
Computer Graphics Through OpenGL: From Theory to Experiments, Second Edition Chapter 3.
Computer Graphics Through OpenGL: From Theory to Experiments, Second Edition Chapter 2.
Laboratory Exercise # 9 – Inserting Graphics to Documents Office Productivity Tools 1 Laboratory Exercise # 9 Inserting Graphics to Documents Objectives:
Computer Graphics Bing-Yu Chen National Taiwan University.
1. Click the arrow beside the SOLIDWORKS symbol 2. Under this arrow click on the “File” button 3. Click on the “Open…” button 4. Find your folder wherever.
On to OpenGL Introduction to Computer Graphics and Animation (Principle of Computer Graphics) Rattapoom Waranusast.
CS324e - Elements of Graphics and Visualization Java 3D Intro.
Computer Graphics Zhen Jiang West Chester University.
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.
1 A first OpenGL program Brian Farrimond Robina Hetherington.
8.2 Area of a Surface of Revolution
Chapters 5 2 March Classical & Computer Viewing Same elements –objects –viewer –projectors –projection plane.
Projections. Viewports Windows can have separate viewports void glViewport(GLint x, GLint y, GLsizei width, GLsizei height ) x, y - Specify the lower.
Navigating in 3D MAX CTEC V part 1. Viewing Objects and/or Scenes Depending upon the software program, the image on the monitor could be a Perspective.
Coordinate Systems Lecture 1 Fri, Sep 2, The Coordinate Systems The points we create are transformed through a series of coordinate systems before.
Blueprints. Definition: a reproduction of a technical or engineering design.
Viewing and Projection. The topics Interior parameters Projection type Field of view Clipping Frustum… Exterior parameters Camera position Camera orientation.
CIS 205—Web Design & Development Flash Chapter 3 Working with Symbols and Interactivity.
CSC Graphics Programming Budditha Hettige Department of Statistics and Computer Science.
Introduction of OpenGL - 3D Graphic and Animation
School of Computer Science
Computer Graphics Implementation II
Transformations Introduction to Computer Graphics and Animation
Camera Position (5.6) we specify the position and orientation of the camera to determine what will be seen. use gluLookAt (eye x, y, z, at x, y, z, up.
Hidden Surface Removal
Intro to 3D Graphics.
INTRODUCTION TO 3-D 3-D CAD TERMINOLOGY 2-D
CSC461: Lecture 20 Parallel Projections in OpenGL
Unit 4 3D Viewing Pipeline Part - 2
Chapter 5 Working with Images
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University View & Projection.
Implementation II Ed Angel Professor Emeritus of Computer Science
Introduction to OpenGL
drawing curved surfaces
OpenGL program.
Viewing (Projections)
The View Frustum Lecture 10 Fri, Sep 14, 2007.
Viewing (Projections)
Introduction to Computer Graphics with WebGL
Computer Graphics 3Practical Lesson
The Framebuffer 1 Lecture 37 Fri, Nov 30, 2007.
3-D Views of Solid Figures
Making an Ice Cream Cone
Implementation II Ed Angel Professor Emeritus of Computer Science
Presentation transcript:

On to 3D Introduction to Computer Graphics and Animation (Principle of Computer Graphics) Rattapoom Waranusast

Experiment 6.1 Run circularAnnuluses.cpp, three identical-looking circular annuluses are drawn in three different ways: –Upper-left: the black disc overwrites the red disc –Upper-right: the black disc is draw closer to the viewer –Lower: a true circular annulus. Interchange the drawing orders of the red and black discs in either of the top two annuluses. Try to comment out glEnable(GL_DEPTH_TEST); and glDisable(GL_DEPTH_TEST); of the upper-right annulus.

The Depth (z) Buffer Eliminate prior to rendering parts of objects that are obscured by others. Hidden surface removal Depth testing Visibility determination

Enabling Hidden Surface Removal glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); in main(). glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); in the main drawing routine. glEnable(GL_DEPTH_TEST); and glDisable(GL_DEPTH_TEST); in the main drawing routine.

Experiment 6.2 Run helix.cpp x = Rcos(t), y = Rsin(t), z = t – 60.0, - 10   t  10 

Experiment 6.2 Try to modify helix.cpp, so that the helix spirals up the y-axis, and x-axis. Modify the code to make the helix to coil more and less round about its axis.

Perspective Projection Frustum

glFrustum (left, right, bottom, top, near, far) (0,0,0) (left, top, -near) (right, top, -near) (right, bottom, -near) (left, bottom, -near) ((far/near) left, (far/near) top, -far) ((far/near) right, (far/near) top, -far) ((far/near) right, (far/near) bottom, -far) ((far/near) left, (far/near) bottom, -far)

Frustum

Experiment 6.3 Modify helix.cpp, by replacing glOrtho(-50.0, 50.0, -50.0, 50.0, 0.0, 100.0) with glFrustum(-5.0, 5.0, -5.0, 5.0, 5.0, 100.0) Compute the co-ordinates of the frustum Try with the y-axis and x-axis versions of the helix Replace the glfrustum() with –glFrustum(-5.0, 5.0, -5.0, 5.0, 10.0, 100.0) –glFrustum(-5.0, 5.0, -5.0, 5.0, 5.0, 120.0) –glFrustum(-10.0, 10.0, -10.0, 10.0, 10.0, 100.0)

Experiment 6.4 Run moveSphere.cpp, press left, right, up, and down keys to move the sphere, the space bar to rotate it, and the ‘r’ to reset.

Perspective Distortion

gluPerspective() gluPerspective (fovy, aspect, near, far) –Calls a utility library routine built on top of glFrustum() –fovy – field of view angle –aspect – aspect ratio (width/height) –near, far – same as in glFrustum()

gluPerspective()

Experiment 6.5 The projection statement of helix.cpp is the sysmetric –glFrustum(-5.0, 5.0, -5.0, 5.0, 5.0, 100.0); Determine the equivalent gluPerspective() call. Change the near value to 10.0 as –glFrustum(-5.0, 5.0, -5.0, 5.0, 10.0, 100.0); Determine the equivalent gluPerspective() call. Determine the equivalent glFrustum() call of –gluPerspective(60.0, 2.0, 10.0, 100.0); –gluPerspective(60.0, 1.0, 5.0, 100.0);

Experiment 6.6 Run helix.cpp. Drag a corner to change its size. Replace the perspective projection with –gluPerspective(90.0, 1.0, 10.0, 100.0); Try to change window size Replace the perspective projection with –gluPerspective(90.0, (float)w/(float)h, 10.0, 100.0); Try to change window size

Assignment 3 1.Draw a red box and a blue pyramid using perspective projection. 2.Draw a cone and a cylinder using perspective projection. You can freely color your objects. 3.Draw two lampshades as in the figures. Color them as you like.

Assignment 3 Note on assignment 3 –Make sure you have your shapes valid triangulation –Allow the user to toggle between the filled rendering and wireframe by pressing the space bar. –Instructions for user interaction should always be output to the main C++ Window and also be written as comments at the top of your program file.