1 / 41

How do we control what we see?

How do we control what we see?. World Window and viewport Camera. Window placement Window size Mapping viewport. Window. Window. Zoom:. Set_window( -60, +60, -30, +30 ). Zoom. Set_window( -21, +21, -11, +11 ). Window. Pan. A. Set_window(-40, +20,-15,+15)

lane
Download Presentation

How do we control what we see?

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. How do we control what we see? • World • Window and viewport • Camera

  2. Window placement • Window size • Mapping viewport

  3. Window

  4. Window

  5. Zoom: • Set_window( -60, +60, -30, +30 )

  6. Zoom • Set_window( -21, +21, -11, +11 )

  7. Window • Pan A. Set_window(-40, +20,-15,+15) B.Set_window(-20,+40,-15,+15)

  8. Window in OpenGL glutInitWindowSize(W,H); glutInitWindowPosition(100,100);

  9. Viewport • define a viewport in Normalized Device Coordinates (NDC) • Map from NDC or Physical device using notes from previous class on mappings Set_viewport2(Xvmin,Xvmax,Yvmin,Yvmax)

  10. Now Map [a,b] [c,d] • First map [a,b] to [0,1] • (We already did this) • Then map [0,1] to [c,d]

  11. Now Map [a,b] [c,d] • Scale [0,1] by (d-c) • Then translate by c • That is, in 1D homogeneous form:

  12. All Together: [a,b] [c,d]

  13. Now Map Rectangles

  14. Transformation in x and y

  15. This is the Viewport Transformation • Good for mapping objects from one coordinate system to another • This is what we do with windows and viewports 15

  16. Viewport Set_window( -30, +30, -15, +15); Set_viewport(0.0, 0.5, 0.0, 0.5); -- lower left Draw_house; Set_viewport(0.5, 1.0, 0.0, 0.5); -- lower right Draw_house; Set_viewport(0.0, 0.5, 0.5, 1.0); -- upper left Draw_house; Set_viewport( 0.5, 1.0, 0.5, 1.0); -- upper right Draw_house;

  17. Viewport in OpenGL void glViewport( GLint x, GLint y, GLsizei width, GLsizei height ) x, y Specify the lower left corner of the viewport rectangle, in pixels. The initial value is (0,0). width, height Specify the width and height of the viewport. When a GL context is first attached to a window, width and height are set to the dimensions of that window.

  18. ViewTransformations • Viewport

  19. Specifying Camera

  20. Synthetic camera model

  21. 3D Viewing Projections

  22. Perspective Projection Eye = e Gaze = LookAt = g Up = y Distance to viewplane = d Z = distance to object on z axis viewplane y yp g e d z

  23. Vanishing Points: One Point Perspective

  24. Vanishing Points: Two Point Perspective

  25. Three-Point Perspective

  26. http://www.khulsey.com/3_point_perspective.html

  27. Perspective

  28. y x From side User’s point of view viewplane y z z Out of screen x Out of screen

  29. From the Side viewplane y yL z zL x xL Out of screen Out of screen

  30. Frustum Perspective Specifying perspective view in OpenGL

  31. glFrustum void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far);

  32. gluPerspective aspect = w/h void gluPerspective(GLdouble fovy, GLdouble aspect, GLdouble near, GLdouble far);

  33. Positioning the Camera • Use gluLookAt to specify • Eye location • “Look-at” point • “up” vector • gluLookAt(10,10,10,1,2,3,0,0,1); • Eye is (10,10,10) • Look at point is (1,2,3) • Up is (0,0,1) • Usually done in GL_PROJECTION matrix and combined with perspective matrix

  34. Assignment #3

  35. Credits • Slides and text • Rich Riesenfeld’s Introduction to CG slides • SIGGRAPH Educators Hypercard slides • http:///www.siggraph.org/education/materials/HyperGraph/viewing/view3d/3dprojec.htm • Some Image from Ed Angel’s book

More Related