cs488 introduction to computer graphics
play

CS488 Introduction to Computer Graphics Luc R ENAMBOT 1 What is - PowerPoint PPT Presentation

CS488 Introduction to Computer Graphics Luc R ENAMBOT 1 What is Computer Graphics ? Mathematics + computer science + art = computer graphics Rendering of images on a device Rendering: Creating images from models Models: objects


  1. CS488 Introduction to Computer Graphics Luc R ENAMBOT 1

  2. What is Computer Graphics ? • Mathematics + computer science + art = computer graphics • Rendering of images on a device • Rendering: Creating images from models • Models: objects constructed from geometric primitives (points, lines, polygons) specified by their vertices 2

  3. Models • Models exist in n-dimensional 'mathematically pure' space • n typically 2 or 3 • n can be > 3 with scientific data 3

  4. Rendering • Rendered version typically created on physical 2D media (e.g. a video screen) • Rendered version can be simple or complex (lighting, shadows, colors, texture) • Rendering a single image can take • from a small fraction of a second (game) • to hours or days (movie) 4

  5. Common Uses • Scientific/medical visualization • CAD/CAM • Multimedia • Computer interfaces (Windows, X, Aqua) • Virtual reality • Special effects • Artistic expression • Way cool video games 5

  6. Scientific Visualization

  7. Brief History: 60s • 1960s Vector display devices • 1963 Ivan Sutherland's Sketchpad "A display connected to a digital computer gives us a chance to gain familiarity with concepts not realizable in the physical world. It is a looking glass into a mathematical wonderland." 7

  8. Brief History: 70s • 1970s Raster display devices • 1972 Pong • 1976 Star Wars 8

  9. 1976 Star Wars • 'Pilots Briefing' • CG done here at UIC

  10. 1976 Star Wars • 'Pilots Briefing' • CG done here at UIC

  11. Brief History: 80s • 1980s Raytracing, Realism, Multimedia • 1982 Tron, Star Trek II • 1985 Last Starfighter • 1989 Abyss, The 10

  12. Brief History: 90s • 1990s Virtual reality, Interactivity, 'Cheaper' graphics horsepower • 1991 Terminator 2 • 1993 Jurassic Park • 1995 Toy Story • 1996 Titanic, Twister • 1999 Star Wars - the Phantom Menace • Lots of commercials & TV series using CG 11

  13. Brief History: 2000s • 2000s CG all over the place • 2001 Final Fantasy • 2001 Lord of the Rings: 2001/2002/2003 • 2005 King Kong 12

  14. Software • Many application programs available to produce computer graphics, either as 2D images, 3D models, or animated sequences (Corel Draw, Photoshop, AutoCAD, Maya, SoftImage, etc.) • We will deal with the lower level routines which do the work of converting models into a displayable form on the display device. 13

  15. Various Environments • Graphics languages / libaries / APIs (Application Programming Interfaces) • GKS • DirectX • QuickDraw and X (as in X11 server) • Postscript, PDF • OpenGL 14

  16. For the class • We will be using OpenGL in this course • Linux machines in the CS Computer Graphics lab to give a common grading platform • OpenGL is available for all the major platforms • Accelerated on almost all current graphics cards • Mesa (www.mesa3d.org): open source implementation running on the processor • Usually in C/C++ but various bindings available 15

  17. Hardware • In this class we are going to concern ourselves with producing images on video screens rather than onto printers, or plotters since that allows a much greater amount of interactivity • Convenient to think of models in mathematical terms but hardware brings CG back to reality 16

  18. Video Display Hardware • Vector (calligraphic) displays • Raster displays 17

  19. Vector displays • Lines drawn directly, no predefined grid • Commands tell the electron gun where to move and when to turn on/off • + Lines are smooth • + Close to the 'pure mathematics' of the model • - Slower with more elements to be drawn, can start to flicker • - Only lines possible, no filled polygons, or bitmaps • - Monochrome for each electron gun 18

  20. Raster displays • Image represented by a rectangular grid of pixels (picture elements) • Image stored in a frame buffer • Electron gun(s) continually scanning in a regular pattern (line by line across entire screen) • + Constant time to redraw any number of elements • + No flicker • - Jagged edges from conversion to pixels • - Discretized version of the model 19

  21. Vector vs. Raster • You need to keep redrawing the image on the screen to keep it from fading away • Vector displays redraw as quickly as possible given the number of objects on the screen • CRT based raster displays redraw the image (or refresh the screen) at a fixed rate (e.g. 60 times per second) no matter how complex the scene. 20

  22. Vector Games • Asteroids, Battlezone, ... • Monochrome, color filters, RGB electron guns • Vectrex console in the 80s 21

  23. Buffers in Raster Displays • Pretty much all CG done using raster displays • The screen is represented by a 2D array of elements 22

  24. Frame Buffer • Array of computer memory used to store an image to be displayed • The user manipulates the values in the frame buffer: 60 times a second (or at some other fixed rate) the frame buffer is copied onto the display device. • If video screen is 512 pixels wide by 512 pixels tall the frame buffer must be able to store 512 X 512 elements ... one element for each pixel on the screen 23

  25. Monochrome display • 512 x 512 x 1bit (bit is either 0=off, or 1=on.) • Each of the 512 x 512 pixels can be either on or off (white or black) 24

  26. Grayscale display • 512 x 512 x 8bit (each pixel is 8 bits deep so values 0-255 are possible) • Each of the 512 x 512 pixels can be one of 256 shades of grey (from black to white) 25

  27. Color display: 24-bit • 512 x 512 x 24bit (each pixel has 8 bits for red, 8 bits for green, and 8 bits for blue) • Each pixel can be black->bright red (0-255) combined with black->bright green (0-255) combined with black- >bright blue (0-255) • Each of the 512 x 512 pixels can be one of 16 million colors 26

  28. Color display: 8-bit with colormap • Want benefits of 24 bit color with only 8 bit display • 512 x 512 x 8-bit (each pixel is 8 bits deep so values 0-255 are possible) • Each of the 512 x 512 pixels can be one of 256 index values into a video lookup table • Video lookup table has 256 24-bit RGB values where each value has 8 bits for red, 8 bits for green, and 8 bits for blue • 16 million colors are possible, but only 256 of them can be displayed at the same time 27

  29. Color display: 8-bit with colormap 28

  30. Frame Buffer • Depth of frame buffer (e.g. 8 bit) determines Screen size Monoch 8-bit 24-bit number of simultaneous rome colors possible 512x512 32K 256K 768K • Width of color map (e.g. 640x480 38K 300K 900K 1280x1024 160K 1.3M 3.8M 24 bit) determines 1920x1200 280K 2.2M 6.6M number of colors that can be chosen from 29

  31. Hardware affects on computer animation • A program may take several minutes, hours, or days to render a single image. These images can then be stored and played back or recorded to create animation • A more interesting situation is when the animation is live with the computer generated image changing while the user watches, or as the user interacts with the computer 30

  32. Animation • For animation, a SECOND frame buffer is needed • This is similar to how a motion picture works at 24 frames per second: 1. A new frame is moved in front of the lens 2. The shutter is opened to display the frame 3. The shutter is closed 31

  33. Computer Graphics • In the case of a film, each of the frames has already been generated and its just a question of showing them • In interactive computer graphics the frames are being drawn one at a time. The frame buffer is regularly sent to the display device (eg 60 times per second) whether the frame buffer has been completely updated or not • We don't want the user to see the screen being cleared and the new image being drawn on the screen each time the display refreshes. We only want the user to see a succession of completely drawn images 32

  34. Another buffer needed • Solution is to have two frame buffers • User draws into one buffer while the other is being displayed • When drawing is complete the buffers are swapped • Only swap buffers in between screen refreshes • when electron gun of the CRT is off and moving from bottom of screen to the top 33

  35. Drawing speed • If the screen refreshes 60 times a second you can have a new image on the screen: • 1/60th of a second ... 60 frames per second if all frames take equal time • 1/30th of a second ... 30 frames per second if all frames take equal time • 1/20th of a second ... 20 frames per second if all frames take equal time • 1/10th of a second ... 10 frames per second if all frames take equal time • Very small change in the time it takes to draw a scene into the frame buffer can have a major impact on the speed of the application 34

  36. How to run at 45fps ? • Can your program run at 45 frames per second (fps)? • Yes: • if 30 frames take 1/60th each • the next 15 frames take 1/30th each you will display 45 frames per second 35

  37. Human Perception • For smooth motion you want at least 10 frames per second • Preferably more than 15 frames per second • Movie (theater): 24fps • TV: 30fps (60 updates or fields) • 60 frames is good • More is better up to screen rate 36

  38. Next time... • 2D graphics: “how we convert from geometry to pixels” 37

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend