CSC 706 Computer Graphics Course basics: Instructor Dr. Natacha Gueorguieva MW, 8:20 pm-10:00 pm Materials will be available at www.cs.csi.cuny.edu/~natacha 1 midterm, 2 projects, 1 presentation, homeworks, final Syllabus read it as it is your contract Some Resources Computer Graphics using OpenGL, Hill, Prentice Hall, 2001 OpenGL Programming Guide, Second Edition, Mason Woo, Jackie Neider, and Tom Davis, Addison-Wesley Developers Press, 1997 OpenGL Reference Manual, Second Edition, OpenGL Architecture Review Board Editors: Renate Kempf and Chris Frazier, Addison-Wesley Developers Press, 1997 Angel, Edward, Interactive Computer Graphics, Addison-Wesley, Reading, MA, 1997 What will I learn? Fundamentals of Computer Graphics Uses of Computer Graphics Programming for Computer Graphics Computer Graphics Algorithms Applied Linear Algebra Modelling Rendering Animation What won t I learn? Painting and Imaging Software (Paintshop Pro, Adobe Photoshop) CAD Packages (AutoCAD) Animation Software (Maya) Rendering Software (Renderman) 3D Modelling (3D Studio Max) The OpenGL Graphics APIs Topics Introduction to Computer Graphics Drawing Figures Drawing Algorithms Vectors for Graphics Transformations Modelling with Polygons 3D Viewing Rendering Fractals Raster Display Tools Curves and Surface Design Colour Theory Outline and approach Computer graphics is concerned with all aspects of producing pictures or images using a computer. Hardware Software Applications
So, what is computer graphics? Computer Graphics is concerned with producing images using a computer. Modelling The representation of the form of objects Rendering The appearance of objects Animation The movement of objects So, what is computer graphics? Modelling Taking the real and turning it into the virtual. Explaining real world or fantastic objects using mathematics. If the image does not exist in real life, a blueprint is drawn by an artist. A wire frame is the simplest form of model. So, what is computer graphics? Rendering Drawing the Image Colour Lighting Shading Surface Texture Shadows Reflection and Transparency Intersection So, what is computer graphics? Animation Controlling the movement of objects. Laws of Physics Biomechanics/ Kinesiology Lip Sink Special Effects Progression of a CG Character Example Where did this image come from? Wireframe Model Skeletal Model Muscle Model What software and/or hardware was necessary? Skin Hair Final Render
Preliminary answer Application: The object is an artist s rendition of the sun for an animation to be shown in a domed environment (planetarium) Software: Maya for modeling and rendering but Maya is built on top of OpenGL Hardware: PC with graphics card for modeling and rendering Main tasks in CG Main tasks: modeling: creating and representing the geometry of objects in the 3D world rendering: generating 2D images of the objects animation: describing how objects change in time Why study CG? Graphics is cool I like to see what I m doing I like to show people what I m doing Graphics is interesting Involves simulation, algorithms, architecture I ll never get an Oscar for my acting But maybe I ll get one for my CG special effects Graphics is fun Art, publicity Graphics applications Scientific visualization Education and training CAD User interfaces Geographical info
Terrain modeling Entertainment: Cinema Medical Square: Final Fantasy Pixar: Monster s Inc. Entertainment: Games Video Games GT Racer 3 Polyphony Digital: Gran Turismo 3, A Spec Medical Visualization Computer Aided Design (CAD) The Visible Human Project MIT: Image-Guided Surgery Project
More Cool Pictures Scientific Visualization Video! Graphics Programming OpenGL API Graphic functions: primitive (points, lines, polygons, pixels, text, curves, surfaces) attribute (colors, fills, type face for titles of graphs) viewing (types of views) transformation (rotation, translation, scaling) input control (communicate with window system, initialize programs, deal with errors) Introduction to OpenGL What is an application programmer s interface? Software library Layer between programmer and graphics hardware and software Where does OpenGL fit in? Between application and graphics system Between high level API and system software Why OpenGL? Fast Simple Well-defined architecture Window system independent Supports high-end features Both geometric and pixel processing Standard, available on many platforms
Why OpenGL industry standard stable reliable and portable evolving scalable easy to use well-documented AP provides a full set of 3D graphics routines The Graphics Rendering Pipeline The Graphics Rendering Pipeline Rendering: The conversion of a scene into an image: Scene: Composed of models placed in 3D space. Models: Composed of collections of primitives. Primitives: Graphic components supported by a Render. Output Image: May be drawn on a monitor or printed on a laser printer or written to a raster in memory or to a file or......must consider device independence. The Graphics Pipeline: The model to image conversion broken into stages. Some version of the pipeline is implemented in graphics hardware to get interactive speeds. The viewing pipeline is a group of processes common from wireframe display through to near photo-realistic image generation, and is basically concerned with transforming objects to be displayed from specific viewpoint and removing surfaces that cannot be seen from this viewpoint. The input to the viewing pipeline is a list of objects with their points defined in their own local coordinate system, and the position and orientation of the viewpoint. The output is the same list of objects with their points defined in a two dimensional screen coordinate system. Computer Graphics and Image Processing The Graphics Rendering Pipeline Computer Graphics Input: objects model Output: realistic image Pictures that move Image Processing Input: a real image Output: objects model A sequence of images (frames) Computer Animation Video Processing
Coordinate Systems in the Graphics Pipeline OCS - object coordinate system WCS - world coordinate system VCS - viewing coordinate system CCS - clipping coordinate system NDCS - normalized device coordinate system DCS - device coordinate system Event driven programming Almost all window based programs follow the event driven paradigm program waits for events to occur takes appropriate action Events are typically stored in an event queue Application programs specify the types of events that are of interest The window system passes events to apps. Event driven programming Appropriate action is implemented by the application calling a unique, user defined function for each event of interest these functions are referred to as callback functions Associating callback functions with events is not a rendering issue, OpenGL does not provide for this GLUT (OpenGL Utility Toolkit) does Registering Events The function call: glutmousefunc(mouse) associates the callback function mouse with all mouse events button press/release When a mouse button is pressed or released in the graphics application window, the user defined function mouse is called Application ignores all mouse events without this function call OpenGL Buffers OpenGL supports a variety of buffers that can be used for advanced rendering Color buffers (front, back, right, left) Depth (z) buffer Accumulation Stencil Window system interactions must be handled outside of OpenGL
OpenGL Related Libraries OpenGL Utility Library (GLU) GLX (X Window extension), glx... WGL (MS Windows extension), wgl GLUT (OpenGL Utility Toolkit), glut OpenInventor C++ high level three-dimensional applications Clearing Clearing color has to be set glclearcolor(r,g,b,alpha) Buffers can be cleared all at once glclear(bitfield) Color buffer Depth buffer Accumulation buffer Stencil buffer OpenGL Interface