1 / 37

Graphics II Syllabus Selection and Picking

Graphics II Syllabus Selection and Picking. Session 1. Course Website:. www.cs.uml.edu/~hmasterm/graphics2.html. Parametric Surfaces. Shadowing Techniques. Rendered with Gouraud Shading. Rendered with Ray Tracing. Rendered with Radiosity. Environment Mapping. Realistic Materials.

chaela
Download Presentation

Graphics II Syllabus Selection and Picking

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. Graphics II SyllabusSelection and Picking Session 1

  2. Course Website: www.cs.uml.edu/~hmasterm/graphics2.html

  3. Parametric Surfaces

  4. Shadowing Techniques

  5. Rendered with Gouraud Shading

  6. Rendered with Ray Tracing

  7. Rendered with Radiosity

  8. Environment Mapping

  9. Realistic Materials Image: R. Rost: OpenGL Shading Language, Addison Wesley

  10. Diffraction and Chromatic Aberration Image: R. Rost: OpenGL Shading Language, Addison Wesley

  11. Noise Textures Image: R. Rost: OpenGL Shading Language, Addison Wesley

  12. Volume Rendering

  13. Volume Rendering:Medical Application

  14. Image Based Rendering View Morph Demo:

  15. Simple Legged AnimationAnkle Rotation Script

  16. Simple Legged AnimationResulting Animation

  17. Nonlinear Global DeformationAn Example Undeformed Taper Twist Bend

  18. Factor Curves:An Example: the Animated Spoon

  19. PICKING Direct Manipulation Demo

  20. Computer GraphicsConceptual Model API Output Devices Application Program Application Model Graphics System Input Devices Function Calls or Protocol Data

  21. Interaction with Graphics System Graphics System User Display React to Change Change Image Input Device

  22. Logical Input Devices • String • Provides ASCII strings to user program • Usually implemented as physical keyboard • Locator • Inputs position in defined coordinate system • Absolute vs. relative • Direct vs. indirect • Choice • Choice among a discrete number of options • Implemented by menus or control button widget • Valuator (or Dial) • Provides analog input to user program • Bounded vs. unbounded • Often implemented as slidebar widget

  23. Logical Input Devices, contd. • Pick • Returns identifier of an object to user program • Can be implemented by locator and choice • Stroke • Returns an array of locations • Can be implemented by locator and choice

  24. Event Mode Input Trigger Trigger Process Measure Process Event: Device & Measure Await Event Queue Program Events Event

  25. OpenGL Geometric Pipline Vertex Coordinates x, y, z, w Object Coordinates Modelview Transformation Modelview Matrix Eye Coordinates Projection Transformation Projection Matrix Clip Coordinates Perspective Division Device Coordinates Viewport Transformation Viewport Transformation Part of OpenGL State Window Coordinates x,y

  26. Object Picking by Ray Tracing Object 2 Object 1 p2 p1 COP Window Coordinates

  27. Picking is supported bySelection in OpenGL Name Stack Yellow Cube y Select Buffer x 1 # Names on Stack zmin z zmax Yellow Cube

  28. OpenGL Rendering Mode GL_RENDER glRenderMode() GL_SELECT 1 zmin zmax glRenderMode(GL_RENDER) returns the number of hits while in SELECT mode Yellow Cube

  29. Selection in OpenGL:The Basic Steps • Specify the array to be used for the returned hit records using: glSelectBuffer() • Enter the selection mode using: glRenderMode(GL_SELECT); • Initialize the name stack using: glInitNames(); • Define the viewing volume you want to use for selection. This does not have to be the same as used for viewing. • Alternately issue primitive drawing commands and commands to manipulate the name stack so that each primitive of interest has a name assigned. • Exit selection mode using: glRenderMode(GL_RENDER); and process the returned selection data in the select buffer.

  30. Initializing a Select Buffer Void glSelectBuffer(Glsizeisize,Gluint*buffer); 32-bit unsigned integers 0 1 2 size-1 You must call glSelectBuffer() before entering select mode.

  31. Manipulating the Name Stack glInitNames(void);Clears the name stack so that it’s empty glPushName(Gluint name);Pushes name onto name stack glPopName(void);Pops one name off the top of the name stack glLoadName(Gluint name);Replaces the value on top of the name stack Note: returns error if stack is empty. Therefore push at least one name on stack using glPushName()first.

  32. Interpreting the Hit Record:Contents of the Selection Buffer glRenderMode()returns the number of hits that can be used to index into Selection Buffer num_hits is an unsigned integer corresponding to the number of hits before name stack is manipulated zmin and zmax store the maximum and minimum z-buffer value values for each hit. Z ranges in [0.0, 1.0] which is normalized as a 32 bit unsigned integer in range [0, 232-1] name is an unsigned integer num_hits zmin zmax name

  33. Selection:Code Example 120 goto 120

  34. Picking in OpenGL Perspective View Volume Canonical View Volume Projection Transform Pick Matrix Transform Screen Coordinates

  35. Generating a Pick Matrix Void gluPickMatrix(GLdouble x, Gldouble y, Gldouble width, Gldouble height, Gl int viewport[4]); x cursor x location in window coordinates y cursor y location in window coordinates width width of the picking region in screen coordinates height height of the picking region in screen coordinates viewport current viewport boundaries in pixel screen coordinates Typical usage: glMatrixMode (GL_PROJECTION); glPushMatrix(); glLoadIdentity(); gluPickMatrix(. . .); gluPerspective( or glOrtho, glFrustrum, etc) /* draw the scene for picking */ . . . glPopMatrix();

  36. Picking:Code Example 120 goto 120

  37. y x z Backup Slide:OpenGL: Pick Matrix Transformation

More Related