news
play

News CPSC 314 Computer Graphics labs start this week Jan-Apr 2005 - PDF document

University of British Columbia News CPSC 314 Computer Graphics labs start this week Jan-Apr 2005 Dana Sharon: MWF 12-1 Dan Julius: Tu 1-2, 2-3, Th 10-11 Tamara Munzner project 0 Rendering Pipeline intro to OpenGL/GLUT


  1. University of British Columbia News CPSC 314 Computer Graphics � labs start this week Jan-Apr 2005 � Dana Sharon: MWF 12-1 � Dan Julius: Tu 1-2, 2-3, Th 10-11 Tamara Munzner � project 0 Rendering Pipeline � intro to OpenGL/GLUT � template: spin around obj files OpenGL/GLUT Intro � todo: change color, change rotation axis, change wireframe/solid drawing, start/stop spin Week 2, Mon Jan 10 � do not hand in, not graded http://www.ugrad.cs.ubc.ca/~cs314/Vjan2005 http://www.ugrad.cs.ubc.ca/~cs314/Vjan2005/a0/a0_desc.html 2 Remote Graphics Reading � OpenGL does not work well remotely � RB Chap. Introduction to OpenGL � very slow � RB Chap. State Management and Drawing � only one user can use graphics at a time Geometric Objects � current X server doesn’t give priority to console, just � RB Appendix Basics of GLUT does first come first served � problem: FCFS policy = confusion/chaos � (Basics of Aux in v 1.1) � solution: console user gets priority � only use graphics remotely if nobody else logged on � with ‘who’ command, “:0” is console person � stop using graphics if asked by console user via email � or console user can reboot machine out from under you 3 4 Topics � rendering pipeline � OpenGL � GLUT Rendering Pipeline 5 6

  2. Review: 3D Graphics Rendering � modeling � goal � representing object properties � transform computer models into images � geometry: polygons, smooth surfaces etc. � may or may not be photo-realistic � materials: reflection models etc. � interactive rendering � rendering � fast, but limited quality � roughly follows a fixed patterns of operations � generation of images from models � rendering pipeline � interactive rendering � offline rendering � ray-tracing � ray-tracing � animation � global illumination � making geometric models move and deform 7 8 Rendering Rendering Pipeline � tasks that need to be performed � what is the pipeline? (in no particular order): � abstract model for sequence of operations to transform geometric model into digital image � project all 3D geometry onto the image plane � abstraction of the way graphics hardware works � geometric transformations � determine which primitives or parts of primitives are � underlying model for application programming visible interfaces (APIs) that allow programming of graphics hardware � hidden surface removal � OpenGL � determine which pixels a geometric primitive covers � Direct 3D � scan conversion � actual implementation details of rendering pipeline � compute the color of every visible surface point will vary � lighting, shading, texture mapping 9 10 Rendering Pipeline Geometry Database Geometry Geometry Geometry Model/View Model/View Perspective Geometry Geometry Geometry Model/View Perspective Perspective Lighting Lighting Clipping Lighting Clipping Clipping Database Database Database Database Transform. Transform. Transform. Transform. Transform. Database Database Transform. � geometry database � application-specific data structure for Frame- Frame- Frame- Scan Scan Scan Depth Depth Depth Texturing Texturing Texturing Blending Blending Blending buffer buffer Conversion Conversion buffer Conversion Test Test Test holding geometric information � depends on specific needs of application � triangle soup, points, mesh with connectivity information, curved surface 11 12

  3. Model/View Transformation Lighting Model/View Model/View Geometry Geometry Model/View Model/View Geometry Geometry Model/View Model/View Geometry Geometry Lighting Lighting Lighting Transform. Transform. Transform. Transform. Database Database Database Transform. Database Database Database Transform. � lighting � modeling transformation � map all geometric objects from local coordinate � compute brightness based on property of material and light position(s) system into world coordinates � viewing transformation � computation is performed per-vertex � map all geometry from world coordinates into camera coordinates 13 14 Perspective Transformation Clipping Model/View Geometry Model/View Model/View Model/View Perspective Perspective Geometry Geometry Model/View Model/View Perspective Perspective Perspective Geometry Geometry Perspective Geometry Lighting Lighting Lighting Lighting Lighting Clipping Clipping Lighting Clipping Transform. Transform. Transform. Transform. Database Database Transform. Transform. Transform. Transform. Transform. Database Database Database Transform. Transform. Transform. Database � perspective transformation � clipping � projecting the geometry onto the image plane � removal of parts of the geometry that fall outside the visible screen or window region � projective transformations and model/view transformations can all be expressed with 4x4 � may require re - tessellation of geometry matrix operations 15 16 Scan Conversion Texture Mapping Model/View Model/View Geometry Geometry Model/View Perspective Perspective Perspective Model/View Model/View Perspective Perspective Geometry Geometry Geometry Geometry Model/View Perspective Lighting Lighting Lighting Clipping Clipping Clipping Lighting Lighting Clipping Lighting Clipping Clipping Transform. Transform. Transform. Transform. Database Database Database Transform. Transform. Database Database Transform. Transform. Transform. Transform. Transform. Database Transform. Scan Scan Scan Scan Scan Scan Texturing Texturing Texturing Conversion Conversion Conversion Conversion Conversion Conversion � scan conversion � texture mapping � turn 2D drawing primitives (lines, � “gluing images onto geometry” polygons etc.) into individual pixels � color of every fragment is altered by (discretizing/sampling) looking up a new color value from an � interpolate color across primitive image � generate discrete fragments 17 18

  4. Depth Test Blending Model/View Geometry Geometry Model/View Model/View Model/View Perspective Perspective Geometry Geometry Model/View Model/View Perspective Perspective Perspective Geometry Perspective Geometry Lighting Lighting Lighting Clipping Clipping Lighting Lighting Lighting Clipping Clipping Clipping Clipping Transform. Transform. Transform. Transform. Transform. Database Database Transform. Transform. Transform. Transform. Database Database Database Transform. Transform. Transform. Database Scan Scan Depth Scan Scan Depth Scan Depth Depth Scan Depth Depth Texturing Texturing Texturing Texturing Texturing Blending Texturing Blending Blending Conversion Conversion Conversion Test Test Conversion Conversion Conversion Test Test Test Test � blending � depth test � final image: write fragments to pixels � remove parts of geometry hidden behind � draw from farthest to nearest other geometric objects � no blending – replace previous color � perform on every individual fragment � blending: combine new & old values with arithmetic operations � other approaches (later) 19 20 Framebuffer Pipeline Advantages Geometry Geometry Model/View Model/View Model/View Perspective Perspective Geometry Perspective � modularity: logical separation of different components Lighting Lighting Lighting Clipping Clipping Clipping Transform. Transform. Database Database Transform. Transform. Transform. Transform. Database � easy to parallelize � earlier stages can already work on new data while later stages still work with previous data Frame- Frame- Scan Scan Depth Frame- Scan Depth Depth � similar to pipelining in modern CPUs Texturing Texturing Texturing Blending Blending Blending buffer buffer buffer Conversion Conversion Conversion Test Test Test � but much more aggressive parallelization possible (special purpose hardware!) � framebuffer � important for hardware implementations � video memory on graphics board that holds image � only local knowledge of the scene is necessary � double-buffering: two separate buffers � draw into one while displaying other, then swap � allows smooth animation, instead of flickering 21 22 Pipeline Disadvantages � limited flexibility � some algorithms would require different ordering of pipeline stages � hard to achieve while still preserving OpenGL (briefly) compatibility � only local knowledge of scene is available � shadows � global illumination 23 24

Recommend


More recommend