TA: Zhicheng Yan Sushma S Kini Mary Pietrowicz

Slides:



Advertisements
Similar presentations
Today Composing transformations 3D Transformations
Advertisements

Computer Graphics 2D & 3D Transformation.
This terms course Last term we both worked on learning 2 things –Processing –The concepts of graphics etc. This term will focus more on the basic concepts.
MAT 594CM S2010Fundamentals of Spatial ComputingAngus Forbes Overview Goals of the course: 1. to introduce real-time 3D graphics programming with openGL.
CLASS 4 CS770/870. Translation Scale Multiplying Matrices. The R C rule What happens when we do two translates? What happens when we do two scales?
Projective Texture Mapping
Animation Following “Advanced Animation and Rendering Techniques” (chapter 15+16) By Agata Przybyszewska.
Based on slides created by Edward Angel
1 3D modelling with OpenGL Brian Farrimond Robina Hetherington.
CS 352: Computer Graphics Chapter 5: Viewing. Interactive Computer GraphicsChapter Overview Specifying the viewpoint Specifying the projection Types.
Objectives Learn to build arbitrary transformation matrices from simple transformations Learn to build arbitrary transformation matrices from simple transformations.
1 Project 2: Navigation five ways to navigate Absolute Rotate/Translate Keyboard Absolute Lookat Keyboard move wrt global coordinate system Relative Rolling.
OpenGL (II). How to Draw a 3-D object on Screen?
2D Transformations. World Coordinates Translate Rotate Scale Viewport Transforms Hierarchical Model Transforms Putting it all together.
Computer Graphics 3D Transformations. 3D Translation Remembering 2D transformations -> 3x3 matrices, take a wild guess what happens to 3D transformations.
3D Rendering with JOGL Introduction to Java OpenGL Graphic Library By Ricardo Veguilla
Hierarchical Transformations Hierarchical Models Scene Graphs
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.
Mouse-Based Viewing & Navigation Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, November 3, 2003.
1 OpenGL Basics A Graphics Standard ©Mel Slater, Anthony Steed
TWO DIMENSIONAL GEOMETRIC TRANSFORMATIONS CA 302 Computer Graphics and Visual Programming Aydın Öztürk
Lecture Notes: Computer Graphics.
Image Synthesis Rabie A. Ramadan, PhD 2. 2 Java OpenGL Using JOGL: Using JOGL: Wiki: You can download JOGL from.
Geometric transformations The Pipeline
Homogeneous Form, Introduction to 3-D Graphics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 20,
Shadows via Projection Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, November 5, 2003.
Interactive Computer Graphics CS 418 – Spring 2015 Mesh Rendering, Transformation, Camera Viewing and Projection in OpenGL TA: Zhicheng Yan Sushma S Kini.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Lecture 6: 3D graphics Concepts 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 718,  ex 2271 
Geometry: 2-D Transformations Course web page: Chapter #3.
Interactive Computer Graphics CS 418 MP1: Dancing I TA: Zhicheng Yan Sushma S Kini Mary Pietrowicz Slides Taken from: “An Interactive Introduction to OpenGL.
Modeling with OpenGL Practice with OpenGL transformations.
OpenGL: Introduction Yanci Zhang Game Programming Practice.
Jul 25, 2014IAT 3551 Scene Graphs.  A data structure that stores information about a graphics scene –Each node has information that structures the interpretation.
Computer Science Term 1, 2006 Tutorial 2 Assignment 3 – The Virtual World.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Chapter 15: Working with the Camera.
Advanced Viewing Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, October 31, 2003.
2 COEN Computer Graphics I Evening’s Goals n Discuss viewing and modeling transformations n Describe matrix stacks and their uses n Show basic geometric.
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 OpenGL Transformations.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Chapters 5 2 March Classical & Computer Viewing Same elements –objects –viewer –projectors –projection plane.
Transformations Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
OpenGL: The Open Graphics Language Introduction By Ricardo Veguilla.
Graphics CSCI 343, Fall 2015 Lecture 16 Viewing I
Lecture 5: Introduction to 3D
CS552: Computer Graphics Lecture 4: 2D Graphics. Recap 2D Graphics Coordinate systems 2D Transformations o Translation o Scaling o Rotation Combining.
Computer Graphics Matrices
Visualization Recreate the ping pong scene in 3D using ball and racket coordinates.
Learning Objectives Affine transformations Affine transformations Translation Translation Rotation Rotation Scaling Scaling Reflection Reflection Shear.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
1 Geometric Transformations-II Modelling Transforms By Dr.Ureerat Suksawatchon.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Computer Viewing Isaac Gang University of Mary Hardin-Baylor.
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
TA: Ryan Freedman Sushma Kini Chi Zhou.  Due Date: March , 12:30 PM  We want a zip folder named cs418_mp1_{netid}.zip which contains  Source.
OpenGL LAB III.
OpenGL: The Open Graphics Language Technology and Historical Overview By Ricardo Veguilla.
Introduction to 3-D Viewing Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 27, 2003.
What you will learn about today
IAT 355 Scene Graphs Feb 23, 2017 IAT 355.
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.
Computer Graphics CC416 Week 15 3D Graphics.
Geometric Transformations
What you will learn about today
Transformations in OpenGL
Computer Graphics Computer Viewing
Modeler Code Basics CSE P 557, Autumn 2006
Computer Viewing Ed Angel Professor Emeritus of Computer Science
CS 352: Computer Graphics Chapter 5: Viewing.
Presentation transcript:

TA: Zhicheng Yan Sushma S Kini Mary Pietrowicz Interactive Computer Graphics CS 418 – Spring 2015 MP2 Flight Simulator TA: Zhicheng Yan Sushma S Kini Mary Pietrowicz

Agenda About MP2 Flight Control Multiple Object Rendering

MP2 : Flight Simulator Due on March 10th at 12:30PM Camera Control ( Flight Simulator ) Some Features: Multiple Object rendering ( Model Transformation ) Object control Terrain Texturing / Lighting

Flight Control Move your camera based on user keyboard input Intuitive Ways(rotate camera) Update gluLookAt parameters keep track your own matrix transformation Easier to think, but more work Recommended if you don’t want to mess with OpenGL transformation. Less intuitive Way(rotate the world) Update OpenGL transformation Easier to implement, but difficult to make it correct Recommended if you are absolutely sure what to do.

Flight Control gluLookAt : Eye position Look At point ( direction ) Up vector Eye LookAt Up Eye LookAt Up M1 M2 M3 M4 Eye LookAt Up

Flight Control Initilize Eye position and Up,LookAt, R vector. Move forward : Offset Eye position in LookAt direction Tilt Up/Down Rotate LookAt,Up about R axis. Turn Left/Right Rotate UP, R about LookAt axis. Then tilt up and down Eye LookAt Up R=Cross(LookAt,Up)

Flight Control Every time you press arrow keys, update Up,LookAt, R vector accordingly. Every time period ( Ex : 1/30 sec ), move Eye position. In display function, set look at function : gluLookAt(Eye, Eye+LookAt, Up); Eye LookAt Up R=Cross(LookAt,Up)

Flight Control Arrow Key Called-back function glutSpecialFunc instead of glutKeyboardFunc Refer to OpenGL doc. for its parameters. Reset OpenGL matrix before calling gluLookAt. You may use the formula in lecture slides to generate rotation matrix ( axis-angle ).

Flight Control Less Intuitive way Moving camera is equivalent to moving every object in the world towards a stationary camera Using a fixed gluLookAt, but call OpenGL transformation command instead. Where should you put glTranslate/glRotate to simulate a flight simulator ? Before or after gluLookAt ? Remember premultiply? (link to docs glMultMatrix) “glMultMatrix multiplies the current matrix with the one specified using m, and replaces the current matrix with the product.”

Multiple Object Rendering Model Transformation Specify scaling, translation for each object Apply different transformation on each mesh Utilize push/pop matrix to backup matrix state M4 M2 M1 M3

Push/Pop Matrix glPushMatrix() glPopMatrix() Create a copy of top matrix & push it into stack. glPopMatrix() Remove the top matrix from stack

Multiple Object Rendering Drawing each object : glPushMatrix(); glTranslate() glScale() glBegin() …. glEnd() glPopMatrix();

Object Manipulation Once we select the object, we can animate that specific object. Object translational animation Move object along a pre-defined direction. Update its position periodically and redraw. Change velocity based on UI. Move along a direction

Object Manipulation Animation Example Init : m_T = Vec3(0,0,0); m_V = Vec3(0,0,1); m_Speed = 1.0; Rendering : glPushMatrix(); glTranslate(m_T); glBegin(); …. glEnd(); glPopMatrix(); Timer : m_T += m_V*m_Speed Change Speed : m_Speed ++ (or --) Awkward for flying a plane

Object Manipulation Move object along a fixed direction is not enough. Rotate the object to change its moving direction. Problem : What kind of UI to use ? Keyboard ? Mouse ? How to rotate its moving direction ?

Object Manipulation Choice of UI ? Keyboard Mouse R=Rkey*R Press Key & Tilt Choice of UI ? Key requirements : Must be able to orient object to any directions. Rotation about only one fixed axis won’t get full credit. Keyboard Change the angle/axis of rotation based on key-press. Analogy to flight simulator  3rd Person view control. Keep track a total accumulated rotations. Mouse Make use of mouse movement to define a rotation. Sounds familiar ?  Euler’s Angle, Arcball, etc. R=Rkey*R

Object Manipulation How to re-orient object ? Maintain a model rotation matrix. Change its values based on user input. Object also needs to be rotated accordingly. Apply the rotation for both Velocity vector Object model transformation

Object Manipulation Re-orientation Example Init : Rendering : m_Rot = Identity m_InitV = m_V = Vec3(0,0,1) Rendering : glPushMatrix(); glTranslate(m_T); glMultMatrix(m_Rot); glBegin(); …. glEnd(); glPopMatrix(); UI Input : Determine fAngle,vAxis Mat4 newR = (fAngle,vAxis); m_Rot = newR*m_Rot; Update Orientation m_V = m_Rot*m_InitV; m_T += m_V*m_Speed

Q&A A useful link to help you with the matrices in OpenGl (http://stackoverflow.com/questions/5162620/opengl-glmatrixmode-help)