3 Week 2 Let s get drawing! How does your computer draw? A review on 2D graphics
4 Michelangelo and You [Michelangelo 1504] [Koller et al. 2004]
5 Basic Graphics System Output device Input devices Image formed in FB
6 Raster Graphics Image produced as an array (the raster) of picture elements (pixels) in the frame buffer
7 Depth of Frame Buffer Depth or precision of the frame buffer Determines how many colors can be represented on a give system 1-bit-deep frame buffer 2 colors 8-bit-deep frame buffer 2^8(256) colors
8 CPU vs GPU NVIDIA Adam & Jamie draw a MONA LISA in 80 milliseconds! Parallel processing on GPU's (short version) (full version)
9 Object Seen by Different Viewers FIGURE 1.6 Image seen by three different viewers. (a) A s view. (b) B s view. (c) C s view.
10 Image Formation 2D 3D
11 See the Difference?
12 Elements of Image Formation Objects Viewer Light source(s) Attributes that govern how light interacts with the materials in the scene Note the independence of the objects, the viewer, and the light source(s)
13 Ray Interactions FIGURE 1.11 Ray interactions. Ray A enters camera directly. Ray B goes off to infinity. Ray C is reflected by a mirror. Ray D goes trough a transparent sphere.
14 Ray Tracing and Geometric Optics One way to form an image is to follow rays of light from a point source finding which rays enter the lens of the camera. However, each ray of light may have multiple interactions with objects before being absorbed or going to infinity.
15 Three-Color Theory Human visual system has two types of sensors Rods: monochromatic, night vision Cones Color sensitive Three types of cones Only three values (the tristimulus values) are sent to the brain Need only match these three values Need only three primary colors
16 Object Where did this image come from?
17 Wireframe Graphics wireframe representation of sun object
18 Raster Graphics Allows us to go from lines and wire frame images to filled polygons
19 Recently Realism comes to computer graphics smooth shading environment mapping bump mapping
20 CSE4030 Break and Q&A
21 The Programmer s Interface Programmer sees the graphics system through a software interface: the Application Programmer Interface (API) OpenGL Open Graphics Library API for 2D and 3D graphics programming GLUT The OpenGL Utility Toolkit
22 First Example type of object location of vertex glbegin(gl_polygon) glvertex3f(0.0, 0.0, 0.0); glvertex3f(0.0, 1.0, 0.0); glvertex3f(1.0, 0.0, 0.0); glend( ); end of object definition
23 Simplified Pipeline
24 Geometric Pipeline Pipeline architecture application program display All steps can be implemented in hardware on the graphics card
25 Vertex Processing Much of the work in the pipeline is in converting object representations from one coordinate system to another Object coordinates Camera (eye) coordinates Screen coordinates Every change of coordinates is equivalent to a matrix transformation Vertex processor also computes vertex colors
26 Projection Projection is the process that combines the 3D viewer with the 3D objects to produce the 2D image Perspective projections: all projectors meet at the center of projection Parallel projection: projectors are parallel, center of projection is replaced by a direction of projection
27 Clipping Just as a real camera cannot see the whole world, the virtual camera can only see part of the world or object space Objects that are not within this volume are said to be clipped out of the scene
28 Primitive Assembly Vertices must be collected into geometric objects before clipping and rasterization can take place Line segments Polygons Curves and surfaces
29 Rasterization The primitives that emerge from the clipper are still in terms of their vertices They must be further processed to generate pixels in the frame buffer The output of rasterizer is a set of fragments for each primitive Fragments are potential pixels Have a location in frame buffer Color and depth attributes
30 Fragment Processing Fragments are processed to determine the color of the corresponding pixel in the frame buffer Colors can be determined by texture mapping or interpolation of vertex colors Fragments may be blocked by other fragments closer to the camera Hidden-surface removal
31 Lab 2 How to Start Graphics Programming GLUT setup Visual Studio environment setting GLUT API Preparing for a canvas (window) Input devices (keyboard, mouse)
32 Reading Assignment Appendix B Spaces Appendix C Matrices