* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Computer Graphics - United International College
Survey
Document related concepts
Waveform graphics wikipedia , lookup
Ray tracing (graphics) wikipedia , lookup
InfiniteReality wikipedia , lookup
Anaglyph 3D wikipedia , lookup
Graphics processing unit wikipedia , lookup
Framebuffer wikipedia , lookup
Apple II graphics wikipedia , lookup
Image editing wikipedia , lookup
Indexed color wikipedia , lookup
Spatial anti-aliasing wikipedia , lookup
Tektronix 4010 wikipedia , lookup
Computer vision wikipedia , lookup
Stereo display wikipedia , lookup
BSAVE (bitmap format) wikipedia , lookup
Molecular graphics wikipedia , lookup
Stereoscopy wikipedia , lookup
Transcript
Computer Graphics Dr. Amy Zhang Assistant Professor of Computer Science United International College 1 Welcome! Applications Introductions What is computer graphics? OpenGL and GLUT Overview 2 Applications Movies and games Visualization techniques for creating images, diagrams, or animations to communicate a message. Digital photography Computer aided design (CAD) the use of computer technology for the design of objects, real or virtual. 3 Virtual reality a technology which allows a user to interact with a computersimulated environment, whether that environment is a simulation of the real world or an imaginary world. Augmented reality a live direct or indirect view of a physical real-world environment whose elements are merged with (or augmented by) virtual computer-generated imagery - creating a mixed reality. Art 4 Movies & Games http://v.ku6.com/show/NzTgFbaxHf7FtACc.html http://v.youku.com/v_show/id_XMTExMTAyMjY4.html 5 Visualization http://www.earthol.com/ 6 Digital Photography http://www.easypano.com/virtual-tour-gallery.html# 7 Computer Aided Design (CAD) 8 Virtual and Augmented Reality v.zol.com.cn/video62155.html 9 Art “Contact Water” Taisuke Murakami, 2001 Steven Parente http://www.alohablooms.com/atomica1.html Artificial Evolution for Computer Graphics Karl Sims, SIGGRAPH ’91 10 What is Computer Graphics? Computer graphics Computer graphics deals with all aspects of creating images with a computer Graphics often combine text, illustration, and color, visual presentations on surfaces, e.g. a wall, canvas, computer screen, paper, or stone to brand, inform, illustrate, or entertain. Examples: photographs, drawings, line art, graphs, diagrams, typography, numbers, symbols, geometric designs, maps, engineering drawings, etc. 11 General concepts Image an artifact, usually two-dimensional, that has a similar appearance to some subject—usually a physical object or a person. They may be captured by optical devices—such as cameras, mirrors, lenses, telescopes, microscopes, etc. and natural objects and phenomena, such as the human eye or water surfaces. A digital image is a representation of a two-dimensional image using ones and zeros (binary). Pixel the smallest piece of information in an image. normally arranged in a regular 2-dimensional grid, and are often represented using dots or squares. The intensity of each pixel is variable; in color systems, each pixel has typically three components such as red, green, and blue. 12 Rendering the process of generating an image from a model, by means of computer programs, is also used to describe the process of calculating effects in a video editing file to produce final video output. Model a description of 3 dimensional objects in a strictly defined language or data structure. It would contain geometry, viewpoint, texture, lighting, and shading information. 13 Animation the rapid display of a sequence of images of 2-D or 3-D artwork or model positions in order to create an illusion of movement. 14 The graphics process Process to simulate interaction of light and matter 15 1.Modeling Vertex Polygon a plane figure that is bounded by a closed path or circuit, composed of a finite sequence of straight line segments Vertex Surface Model 16 Graphical Models Geometric 2D and 3D objects Triangles, quadrilaterals, polygons Spheres, cones, boxes Surface characteristics Color Texture Composite objects Objects and their relationships to each other Lighting, shading, animation, fog, etc. 17 The basic idea Describe an object using surfaces, which are polygons Triangles, quadrilaterals, whatever Important thing is that they are flat They must also be convex Provide points in counterclock-wise order From the visible side 18 2.Transformations Scaling Translation Rotation Skew (Shear) 1 0 d x 0 1 0 0 0 1 19 3.Texturing Texture - A bitmap image applied to a surface in computer graphics Make 3D objects realistic without texture with texture 20 Texture/Displacement/Bump Map 21 4.Viewing and projections Central projection Parallel projection 22 5.Light and Color 23 6. Illumination Models 24 7. Shading models 25 Rasterization Conversion of 3D model to 2D image Projection Determine pixel Determine color 26 8.Ray Tracing Back tracing the ray coming into the viewer’s eye 27 9. Curves & Surfaces Free shape control/animation Less storage 28 Animation 29 OpenGL and GLUT Overview 30 What Is OpenGL? Graphics rendering API high-quality color images composed of geometric and image primitives window system independent operating system independent 31 OpenGL as a Renderer Geometric primitives points, lines and polygons Image Primitives images and bitmaps separate pipeline for images and geometry linked through texture mapping Rendering depends on state colors, materials, light sources, etc. 32 Preliminaries Headers Files Libraries #include <GL/gl.h> #include <GL/glu.h> #include <GL/glut.h> glut.h automatically include the others gult3d.lib, glut32.dll Enumerated Types OpenGL defines numerous types for compatibility GLfloat, GLint, GLenum, etc. 33 Compilation on Windows Get glut.h, glut32.lib, glut32.dll from web Create a console application Store glut.h in Additional include directory Add opengl32.lib, glut32.lib to project settings (under link tab) and store them in Additional library directory Add glut32.dll to c:/windows/system32 34 GLUT Basics Application Structure Configure and open window Initialize OpenGL state Register input callback functions render resize input: keyboard, mouse, etc. Enter event processing loop 35 Sample Program void main( int argc, char** argv ) { int mode = GLUT_RGB|GLUT_DOUBLE; glutInitDisplayMode( mode ); glutCreateWindow( argv[0] ); init(); glutDisplayFunc( display ); glutReshapeFunc( resize ); glutKeyboardFunc( key ); glutIdleFunc( idle ); glutMainLoop(); } 36 OpenGL Initialization Set up whatever state you’re going to use void init( void ) { glClearColor( 0.0, 0.0, 0.0, 1.0 ); glClearDepth( 1.0 ); } glEnable( GL_LIGHT0 ); glEnable( GL_LIGHTING ); glEnable( GL_DEPTH_TEST ); 37 GLUT Callback Functions Routine to call when something happens window resize or redraw user input animation “Register” callbacks with GLUT glutDisplayFunc( display ); glutIdleFunc( idle ); glutKeyboardFunc( keyboard ); 38 Rendering Callback Do all of your drawing here glutDisplayFunc( display ); void display( void ) { glClear( GL_COLOR_BUFFER_BIT ); glBegin( GL_TRIANGLE_STRIP ); glVertex3fv( v[0] ); glVertex3fv( v[1] ); glVertex3fv( v[2] ); glVertex3fv( v[3] ); glEnd(); glutSwapBuffers(); } 39 Idle Callbacks Use for animation and continuous update glutIdleFunc( idle ); void idle( void ) { t += dt; glutPostRedisplay(); } 40 User Input Callbacks Process user input glutKeyboardFunc( keyboard ); void keyboard( char key, int x, int y ) { switch( key ) { case ‘q’ : case ‘Q’ : exit( EXIT_SUCCESS ); break; case ‘r’ : case ‘R’ : rotate = GL_TRUE; break; } } 41 Summary There is one field called the primary key which uniquely identify a record SQL can be used to Create the tables Add, change, and delete data Query the DB for specific information DB vs File System ER model 42