1 / 38

Computer Graphics CSCI 375

Computer Graphics CSCI 375. What do I need to know?. Familiarity with Trigonometry Analytic geometry Linear algebra Data structures OOP. Computer Graphics (& Related Areas). Graphics 3D model => 2D image Image processing Computer vision 2D image => 3D model. Applications. Movies

ban
Download Presentation

Computer Graphics CSCI 375

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. Computer GraphicsCSCI 375

  2. What do I need to know? • Familiarity with • Trigonometry • Analytic geometry • Linear algebra • Data structures • OOP

  3. Computer Graphics (& Related Areas) • Graphics • 3D model => 2D image • Image processing • Computer vision • 2D image => 3D model

  4. Applications • Movies • Video games • Visualization • Simulation

  5. Image Processing • Manipulate 2D bitmaps • Applies directly to pixel grid • Color correction • Scaling • Blurring • Sharpening

  6. Image Synthesis • Graphics deals with image synthesis • Synthesis of 2D image from 3D scene description is called rendering

  7. Photorealistic Rendering • Indistinguishable from reality • Ray tracing

  8. PhotorealRendering CG Choice Award Gallery: http://forums.cgsociety.org/forumdisplay.php?f=121

  9. Non-Photorealistic Rendering • Non-photoreal rendering • artificial water colors • pencil sketches • paint brushstrokes • Scientific and medical visualization

  10. Computer Vision • 2D images => 3D model • Aspects of AI

  11. Animation • Sequence of images • May be generated by physical simulation • Rigid bodies • Deformable objects • Gasses, liquids • Particle effects • Character animation

  12. Modeling • Creating 3D geometric data • 3ds Max, Maya • Procedural modeling algorithms • Digitizers and computer vision • Mesh simplification

  13. Raster Graphics • Modern displays are raster based • Pixels and subpixels • Old style vector displays

  14. Framebuffer • Framebuffer • Space for final image • Grid of pixels • Colors are usu. 24 bits • Depth (z) • Usu. on GPU

  15. Primitives • Complex scenes built from simpler objects • Objects built from primitives • Point • Line • Triangle

  16. 3D Models • Collection of triangles • Each triangle stores 3 vertices • Vertex • position • color • normal

  17. 3D Models • struct Vector3 { • float x, y, z; • }; • struct Vertex { • Vector3 position; • }; • struct Triangle { • Vertex vertices[3]; • }; • class Model { • std::vector<Triangle> triangles; • };

  18. Traditional Graphics Pipeline • Primitives processed in stages • Transformation • Lighting • Clipping • Scan conversion • Fragment processing

  19. The Graphics Pipeline Modeling Transformations Illumination (Lighting) Viewing Transformation (Perspective / Orthographic) Clipping Projection (to Screen Space) Scan Conversion(Rasterization) Visibility / Display

  20. The Graphics Pipeline Modeling Transformations • Primitives are processed in stages • Each stage forwards result to next stage Illumination (Lighting) Viewing Transformation (Perspective / Orthographic) Clipping Projection (to Screen Space) Scan Conversion(Rasterization) Visibility / Display

  21. Transformation • Transformations • Rotation • Translation • Scales • Projection • Matrices

  22. Modeling Transformations Modeling Transformations • 3D models defined in own coordinate system (object/local space) • Modeling transforms orient models within a common coordinate frame (world space) Illumination (Lighting) Viewing Transformation (Perspective / Orthographic) Clipping Projection (to Screen Space) Scan Conversion(Rasterization) Object space World space Visibility / Display

  23. Viewing Transformation Modeling Transformations • Maps world space to eye space • Viewing position is transformed to origin & direction is oriented along some axis (usually z) Illumination (Lighting) Viewing Transformation (Perspective / Orthographic) Clipping Eye space Projection (to Screen Space) Scan Conversion(Rasterization) Visibility / Display World space

  24. Projection Modeling Transformations • Objects are projected to 2D image place (screen space) Illumination (Lighting) Viewing Transformation (Perspective / Orthographic) Clipping NDC Screen Space Projection (to Screen Space) Scan Conversion(Rasterization) Visibility / Display

  25. Lighting • Vertex or fragment color • Different light types • Shadows, reflections, and translucency

  26. Lighting Modeling Transformations • Vertices lit according to material properties, surface properties (normal) and light sources • Local lighting model (diffuse, ambient, Phong, etc.) Illumination (Lighting) Viewing Transformation (Perspective / Orthographic) Clipping Projection (to Screen Space) Scan Conversion(Rasterization) Visibility / Display

  27. Clipping • Camera and view volume • Culling • Clipping • Outputs visible primitives

  28. Clipping Modeling Transformations • Transform to Normalized Device Coordinates (NDC) • Remove portions of object outside view volume Illumination (Lighting) Viewing Transformation (Perspective / Orthographic) Clipping Eye space NDC Projection (to Screen Space) Scan Conversion(Rasterization) Visibility / Display

  29. Scan Conversion • Scan conversion or rasterization • 2D primitives => pixels • Per-vertex data is interpolated across the triangle

  30. Scan Conversion (Rasterization) Modeling Transformations • Rasterizes primitives into pixels • Interpolate values as we go (color, depth, etc.) Illumination (Lighting) Viewing Transformation (Perspective / Orthographic) Clipping Projection (to Screen Space) Scan Conversion(Rasterization) Visibility / Display

  31. Fragment Processing • Output of rasterization • Set of fragments • Z-values • … • Z-buffer algorithm • Texturing and transparency operations

  32. OpenGL • Open Graphics Library (OpenGL) • Standard specification defining a cross-platform API for writing 2D and 3D graphics apps • Cell phones to supercomputers • Developed by SGI in 1992 • Current version 4.4 • Managed by non-profit Khronos Group • Consortium focused on open, royalty-free standards for authoring and acceleration of parallel computing, graphics, and dynamic media (OpenCL, OpenGL, OpenGL ES, WebGL, COLLADA)

  33. Supporting Infrastructure OpenGL Application GLEW GLUT GL GLX, WGL Graphics Drivers Windowing System (X, Windows) GPU

  34. OpenGL Example • Drawing a colored triangle • glBegin (GL_TRIANGLES); • glColor3f (1.0f, 0.0f, 0.0f); • glVertex3f (-1.0f, -1.0f, 0.0f); • glColor3f (0.0f, 1.0f, 0.0f); • glVertex3f (+1.0f, -1.0f, 0.0f); • glColor3f (0.0f, 0.0f, 1.0f); • glVertex3f (0.0f, +1.0f, 0.0f); • glEnd (); • Inefficient; we’ll improve upon this

  35. OpenGL Program Organization • main () { • // Initialize and create window • // Set up key and mouse event handlers • // Initialize OpenGL • // Set up lighting • // Load assets

  36. OpenGL Program Organization (Cont’d) • // Update and render loop • while (userWantsToContinue) { • // Clear screen • // Specify camera position & orientation (pose) • for (Model model : scene) { • // Specify object pose • // Draw model • // Frame completion code (buffer swap) • } • // Cleanup code • }

More Related