Computer Science 385.3 Term 1, 2006 Tutorial 2 Assignment 3 – The Virtual World.

Slides:



Advertisements
Similar presentations
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Building Models modified by Ray Wisman Ed Angel Professor of Computer Science,
Advertisements

2 COEN Computer Graphics I Evening’s Goals n Discuss the fundamentals of lighting in computer graphics n Analyze OpenGL’s lighting model n Show.
Projective Texture Mapping
OpenGL Texture Mapping
MAT 594CM S2010Fundamentals of Spatial ComputingAngus Forbes Overview Today: - Make sure everyone is set up with an OpenGL environment - OpenGL basics:
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer.
OpenGL (II). How to Draw a 3-D object on Screen?
CS 4731: Computer Graphics Lecture 17: Texturing Emmanuel Agu.
3D Rendering with JOGL Introduction to Java OpenGL Graphic Library By Ricardo Veguilla
Texture Mapping A way of adding surface details Two ways can achieve the goal:  Surface detail polygons: create extra polygons to model object details.
Introduction to OpenGL Jian Huang This set of slides are extracted from the Interactive OpenGL Programming course given by Dave Shreine, Ed Angel and Vicki.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 19 Other Graphics Considerations Review.
1 OpenGL Basics A Graphics Standard ©Mel Slater, Anthony Steed
Texture Mapping. To add surface details… World of Warcraft, Blizzard Inc. More polygons (slow and hard to handle small details) Less polygons but with.
Computer Graphics Texture Mapping Eriq Muhammad Adams
OpenGL Shading Language (Advanced Computer Graphics) Ernest Tatum.
Image Synthesis Rabie A. Ramadan, PhD 2. 2 Java OpenGL Using JOGL: Using JOGL: Wiki: You can download JOGL from.
Geometric transformations The Pipeline
Hank Childs, University of Oregon
2IV60 Computer Graphics set 10: Texture mapping Jack van Wijk TU/e.
Lecture 8: Texture Mapping 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 718,  ex 2271
Computer Graphics. Requirements Prerequisites Prerequisites CS 255 : Data Structures CS 255 : Data Structures Math 253 Math 253 Experience with C Programming.
Texture Mapping Course: Computer Graphics Presented by Fan Chen
Computer Graphics Ben-Gurion University of the Negev Fall 2012.
Buffers Textures and more Rendering Paul Taylor & Barry La Trobe University 2009.
Hank Childs, University of Oregon Nov. 5th, 2014 CIS 441/541: Introduction to Computer Graphics Lecture 11: 2D textures, lighting and materials.
CSE 470: Computer Graphics. 10/15/ Defining a Vertex A 2D vertex: glVertex2f(GLfloat x, GLfloat y); 2D vertexfloating pointopenGL parameter type.
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
CS380 LAB IV OpenGL Jonghyeob Lee Reference1. [OpenGL course slides by Rasmus Stenholt] Reference2. [
Homogeneous Form, Introduction to 3-D Graphics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 20,
Lecture 27: Texture Mapping Li Zhang Spring 2008
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CG1 Labs Wei Li. Back Face Culling // enable back-face culling glEnable( GL_CULL_FACE ); // orientation of front-facing polygons glFrontFace( GL_CCW );
1Computer Graphics Lecture 4 - Models and Architectures John Shearer Culture Lab – space 2
Lecture 11: Exam Revision 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 718,  ex 2271  Coursework.
Representation. Objectives Introduce concepts such as dimension and basis Introduce coordinate systems for representing vectors spaces and frames for.
Texture Mapping Drawing Pictures on Polygons. Texture Mapping.
TEXTURES & OTHER GOODIES Computer Graphics. glTexCoord2f(...); + =
Image Synthesis Rabie A. Ramadan, PhD 4. 2 Review Questions Q1: What are the two principal tasks required to create an image of a three-dimensional scene?
TEXTURE CSE 410. Add Texture to Polygon glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D,texid); // here texid corresponds a bitmap image. glNormal3f(1.0,0.0,0.0);
Advanced Viewing Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, October 31, 2003.
Chapters 5 2 March Classical & Computer Viewing Same elements –objects –viewer –projectors –projection plane.
1 Angel: Interactive Computer Graphics5E © Addison- Wesley 2009 Image Formation Fundamental imaging notions Fundamental imaging notions Physical basis.
11/5/2002 (c) University of Wisconsin, CS 559 Last Time Local Shading –Diffuse term –Specular term –All together –OpenGL brief overview.
Where We Stand So far we know how to: –Transform between spaces –Rasterize –Decide what’s in front Next –Deciding its intensity and color.
MP3.. Start at the very beginning. Almost. Either start from nothing yourself, or use the empty template for this MP. Run through the provided files are.
Chapter 1 Graphics Systems and Models Models and Architectures.
CSC Graphics Programming Budditha Hettige Department of Statistics and Computer Science.
OpenGL LAB III.
Texture Mapping CEng 477 Introduction to Computer Graphics.
Recap Last lecture we looked at local shading models –Diffuse and Phong specular terms –Flat and smooth shading Some things were glossed over –Light source.
Chapter 5. Lighting Computer Graphics (spring, 2009) School of Computer Science University of Seoul.
School of Computer Science
Transformations Introduction to Computer Graphics and Animation
Madhulika (18010), Assistant Professor, LPU.
Hank Childs, University of Oregon
Texture Mapping 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.
Texture Mapping We can improve the realism of graphics models by mapping a texture pattern (image) onto the modeled object surface. We refer to this technique.
OpenGL Texture Mapping
Models and Architectures
Models and Architectures
Computer Graphics, Lee Byung-Gook, Dongseo Univ.
Assignment 3b Q&A.
Chapters 5/4 part2 understanding transformations working with matrices
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009
Models and Architectures
Models and Architectures
Computer Graphics 3Practical Lesson
Computer Graphics 5Practical Lesson
Programming Textures Lecture 15 Fri, Sep 28, 2007.
Presentation transcript:

Computer Science Term 1, 2006 Tutorial 2 Assignment 3 – The Virtual World

Some Assignment Requirements: -Use of a cube to contain the world. -Interactive controls. -Use of the three-term lighting model. -Some extra geometry. -Some texture mapping.

Assignment 3 – The Virtual World World Cube Your virtual world will be inside the World Cube, so make sure that the sides of the cube are pointing inwards – if the vertices are written counter- clockwise, you are looking at the front of the polygon. Also, remember that you are required to use glFrustum(), not any of the utility routines such as gluPerspective, etc. glFrustum(Left, Right, Bottom, Top, Near, Far);

Assignment 3 – The Virtual World Interactive Controls -The user should be able to wander through your world freely using some key or mouse commands. -You should use the ModelView matrix to accomplish this. A series of rotatations and translations can be applied to the world in order to show the user's perspective.

Assignment 3 – The Virtual World Interactive Controls Remember: The rotation and translation matrix multiplications are applied in reverse order. GLfloat direction; // can be modified when user inputs commands. Vector position; // the user's position in the scene. display (void) {... glPushMatrix(); glLoadIdentity(); glTranslatef(position.x, position.y, position.z); glRotatef(direction,0,1,0); // Rotation should go after renderScene(); // translation! glPopMatrix();... }

Assignment 3 – The Virtual World Interactive Controls The multiplication matrix used on the ModelView is similar to a stack – hence, the glPushMatrix() and glPopMatrix() commands. These can be used to save and load a previous matrix, which is very useful when you only want to transform specific parts of the scene (such as a spotlight moving through the scene.) void handleKeystroke(int key, int x, int y) { if (key == GLUT_KEY_LEFT) { … } Arrow keys can be captured using:

Assignment 3 – The Virtual World 3-Term Lighting Model Light point = Ambient point + Diffuse point + Specular point OpenGL does these calculations for you, if you set up the lighting properly. To use OpenGL lighting, the programmer is expected to define: -Surface normals (normalized). -Material properties. -Light information.

Assignment 3 – The Virtual World 3-Term Lighting Model Each light can have: -Position in the world -Ambient, diffuse and specular components. -Direction and spotlight variables. -Attenuation variables – best made small in OpenGL. glEnable(GL_LIGHTING); glShadeModel(GL_SMOOTH); glEnable(GL_LIGHT1); Setting up the lighting:

Assignment 3 – The Virtual World Texture Mapping Can add precious detail to flat polygons. Can simulate some aspects of complicated geometry without the cost. Must have a texture to map. Must load texture into the program. Must provide a mapping between texture coordinates and surface coordinates – trivial for square shapes.

Assignment 3 – The Virtual World Texture Mapping Setting up the textures for mapping: glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glEnable(GL_TEXTURE_2D); glTexImage2D(GL_TEXTURE_2D, 0, 0, dimension, dimension, 0, GL_BGR_EXT, GL_UNSIGNED_BYTE, x); glBegin(GL_POLYGON); glTexCoord2f( 0, 0 ); glVertex3f( -50, -50, -50 ); glTexCoord2f( 1, 0 ); glVertex3f( 50, -50, -50 ); glTexCoord2f( 1, 1 ); glVertex3f( 50, 50, -50 ); glTexCoord2f( 0, 1 ); glVertex3f( -50, 50, -50 ); glEnd(); Texture Mapping:

Questions?