Presentation is loading. Please wait.

Presentation is loading. Please wait.

COMPUTER GRAPHICS CSCI 375. What do I need to know?  Familiarity with  Trigonometry  Analytic geometry  Linear algebra  Data structures  OOP.

Similar presentations


Presentation on theme: "COMPUTER GRAPHICS CSCI 375. What do I need to know?  Familiarity with  Trigonometry  Analytic geometry  Linear algebra  Data structures  OOP."— Presentation transcript:

1 COMPUTER GRAPHICS CSCI 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 Photoreal Rendering CG Choice Award Gallery: http://forums.cgsociety.org/forumdi splay.php?f=121

9

10 Non-Photorealistic Rendering  Non-photoreal rendering  artificial water colors  pencil sketches  paint brushstrokes  Scientific and medical visualization

11

12 Computer Vision  2D images => 3D model  Aspects of AI

13 Animation  Sequence of images  May be generated by physical simulation  Rigid bodies  Deformable objects  Gasses, liquids  Particle effects  Character animation

14 Modeling  Creating 3D geometric data  3ds Max, Maya  Procedural modeling algorithms  Digitizers and computer vision  Mesh simplification

15 Raster Graphics  Modern displays are raster based  Pixels and subpixels  Old style vector displays

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

17 Primitives  Complex scenes built from simpler objects  Objects built from primitives  Point  Line  Triangle

18 3D Models  Collection of triangles  Each triangle stores 3 vertices  Vertex  position  color  normal

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

20 Traditional Graphics Pipeline  Primitives processed in stages  Transformation  Lighting  Clipping  Scan conversion  Fragment processing

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

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

23 Transformation  Transformations  Rotation  Translation  Scales  Projection  Matrices

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

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

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

27 Lighting  Vertex or fragment color  Different light types  Shadows, reflections, and translucency

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

29 Clipping  Camera and view volume  Culling  Clipping  Outputs visible primitives

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

31 Scan Conversion  Scan conversion or rasterization  2D primitives => pixels  Per-vertex data is interpolated across the triangle

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

33 Fragment Processing  Output of rasterization  Set of fragments  Z-values  …  Z-buffer algorithm  Texturing and transparency operations

34 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)

35 Supporting Infrastructure OpenGL Application GLEW GLUTGLX, WGL Windowing System (X, Windows) GPUGraphics Drivers GL

36 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

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

38 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  }


Download ppt "COMPUTER GRAPHICS CSCI 375. What do I need to know?  Familiarity with  Trigonometry  Analytic geometry  Linear algebra  Data structures  OOP."

Similar presentations


Ads by Google