What you will learn about today

Slides:



Advertisements
Similar presentations
Computer Graphics - Viewing -
Advertisements

Defining the Viewing Coordinate System
12.6 Rotations and Symmetry Rotation- a transformation in which a figure is turned around a point Center of rotation- the point the figure is rotated around.
Based on slides created by Edward Angel
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Computer Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
CS 352: Computer Graphics Chapter 5: Viewing. Interactive Computer GraphicsChapter Overview Specifying the viewpoint Specifying the projection Types.
3-D Geometry.
Computer Graphics (Fall 2008) COMS 4160, Lecture 4: Transformations 2
OpenGL (II). How to Draw a 3-D object on Screen?
CS 4731: Computer Graphics Lecture 11: 3D Viewing Emmanuel Agu.
Computer Graphics 3D Transformations. 3D Translation Remembering 2D transformations -> 3x3 matrices, take a wild guess what happens to 3D transformations.
Introduction to 3D viewing 3D is just like taking a photograph!
Geometric transformations The Pipeline
CS559: Computer Graphics Lecture 9: Projection Li Zhang Spring 2008.
Viewing Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 4: Transformations 2
CAP4730: Computational Structures in Computer Graphics 3D Transformations.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Jinxiang Chai Composite Transformations and Forward Kinematics 0.
Exam Review Questions. Problem: A cube has vertices with world coordinates: (1, 0, 0) (2, 0, 0) (1, 1, 0) (2, 1, 0) (1, 0, 1) (2, 0, 1) (1, 1, 1) (2,
Stages of Vertex Transformation To specify viewing, modeling, and projection transformations, you construct a 4 × 4 matrix M, which is then multiplied.
Computer Graphics I, Fall 2010 Computer Viewing.
The Camera Course Information CVG: Programming 4 My Name: Mark Walsh Website: Recommended Reading.
OpenGL Viewing and Modeling Transformation Geb Thomas Adapted from the OpenGL Programming Guidethe OpenGL Programming Guide.
The Camera Analogy ► Set up your tripod and point the camera at the scene (viewing transformation) ► Arrange the scene to be photographed into the desired.
©2005, Lee Iverson Lee Iverson UBC Dept. of ECE EECE 478 Viewing and Projection.
Graphics CSCI 343, Fall 2015 Lecture 16 Viewing I
Classical Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Honours Graphics 2008 Session 3. Today’s focus Perspective and orthogonal projection Quaternions Graphics camera.
CS 4731: Computer Graphics Lecture 12: More 3D Viewing Emmanuel Agu.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
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.
End effector End effector - the last coordinate system of figure Located in joint N. But usually, we want to specify it in base coordinates. 1.
OpenGL LAB III.
CS 490: Computer Graphics Chapter 5: Viewing. Interactive Computer GraphicsChapter Overview Specifying the viewpoint Specifying the projection Types.
Ray Tracing Part I Sources: * raytrace/rtrace0.htm * A. Watt & M. Watt. Advanced Animation & Rendering.
CSC Graphics Programming
Viewing 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.
translations, rotations, and reflections
Chapter 11 Three-Dimensional Geometric and Modeling Transformations
Visible Surface Detection
Perspective projection
Viewing.
Computer Viewing.
Courtesy of Drs. Carol O’Sullivan / Yann Morvan Trinity College Dublin
Isaac Gang University of Mary Hardin-Baylor
Chapter 3 Drawing In the World.
CSCE 441 Computer Graphics 3-D Viewing
CENG 477 Introduction to Computer Graphics
Projection v VP u VPN n.
CS451Real-time Rendering Pipeline
CSC461: Lecture 19 Computer Viewing
Computer Graphics Imaging
Introduction to Computer Graphics with WebGL
Three-Dimensional Viewing
Finding Direction Angles of Vectors
What you will learn about today
Type of View Perspective View COP(Center of Plane) Diminution of size
CSCE441: Computer Graphics Coordinate & Composite Transformations
Orthogonal Base Cartesian Coordinate System Works in general:
University of New Mexico
Viewing (Projections)
Computer Graphics 3Practical Lesson
Computer Graphics Computer Viewing
CSCE441: Computer Graphics 2D/3D Transformations
Projection v VP u VPN n.
Computer Viewing Ed Angel Professor Emeritus of Computer Science
Rotation Around a Point
CS 352: Computer Graphics Chapter 5: Viewing.
Presentation transcript:

What you will learn about today Cameras in OpenGL Where this fits into world transformations Various types of cameras

What is moving? frame1 frame3 frame2

Let’s Examine the Camera If I gave you a world, and said I want to render it from another viewpoint, what information do I have to give you? Position Which way we are looking Which way is “up” Aspect Ratio Field of View Near and Far

glm::lookat Orients and positions the “camera” lookat( eyex, eyey, eyez, centerx, centery, centerz, upx,upy, upz); eye – the position of the camera in world coordinates center – the camera is pointed at this point up – the direction defined to be up for the camera

Moving the camera How can we translate the camera? add a vector to the eye and center parameters How far will this move it? the length of the vector What happens if you don’t change the center? the camera will stay fixed on the original point

Camera without glm::lookat? How can we translate and orient the camera without lookat? inverse transforms: translate(-x,-y,-z); rotate(-angle, a,b,c) Where does this go in your openGL program (using lookat or not)? usually at the beginning of your display function

Camera: side view View Right View Up View Normal View Direction

Camera: looking through the camera View Up View Right What are the vectors?

Transformation World->Camera View Right = u 1 0 0  camerax  0 1 0 0 0 1 0 0 0 View Up = V camera  T   y  cameraz     1 n  N  (n , n , n ) N 1 2 3 u  V  N  (u , u , u ) V  N 1 2 3 View Direction = -N v  n  u  (v1 , v2 , v3 ) u1 u2 u3 0 v v v 0 R   3  n1 n2 n3 0  0 0 0 1 1 2   MW CVC  R  T

First Person Camera How is this implemented? Where is the ‘eye’? What is the look at point? What is up? up center eye

First Person Camera How do we move the camera? Add a vector to eye and center up move dir center eye

First Person Camera How do we rotate the camera? Move the center point - add a vector to it Up vector Side vector: lookat x up center up eye

Lookat implementation oddities What will happen if up == lookat direction? Spins around the up axis in a weird way Why does this happen? Two axes of your camera frame are aligned! How can we avoid this? Maintain an orthogonal camera frame - Reset the up vector using lookat X side (e.g., more common in flight games) Constrain the lookat direction to not get to close to the up vector (e.g., common in FPS games) Use quaternions

3rd Person Camera How is this implemented? Where is the ‘eye’? What is the look at point? What is up?

3rd Person Camera Remember, initially the camera is At the origin looking down –z) • Same as glm::lookat(0,0,0, 0,0,-1,0,1,0) How can this be more easily implemented without glm::lookat? translate the character so you can see it Draw the character Rotate the world around Y at the fixed point of the character Translate the world inversely to the character position Render the world

Birds Eye Camera How is this implemented? Where is the ‘eye’? • What is the look at point? What is up?

Review: What you learned about today Cameras in OpenGL Where this fits into world transformation The camera transform is performed after the world transform IS THE SAME AS: The camera is always at 0,0,0 looking down –z The world transforms instead Various types of cameras 1st, 3rd, birdseye