540 likes | 672 Views
CAP 4703 Computer Graphic Methods. Prof. Roy Levow Lecture 1. Computer Graphics. Broadly concerned with producing images by computer Many applications Still image generation and editing Animation and film, Computer games Design Scientific and medical data visualization
E N D
CAP 4703Computer Graphic Methods Prof. Roy Levow Lecture 1
Computer Graphics • Broadly concerned with producing images by computer • Many applications • Still image generation and editing • Animation and film, Computer games • Design • Scientific and medical data visualization • Simulation and Virtual reality • Publishing, …
Graphical System • Main Components • Processor • Memory • Frame Buffer • Output Devices • Input Devices
Processor and Memory • Depending on the application, the system can range from • Capable personal computer to a • Super-computer
Image Output • Images may be • Vector graphics • Formed by drawing lines to create image • Raster graphics • Composed of individual picture elements in an array or raster • Individual elements are pixels • Stored in a frame buffer • Raster graphics is most common • Vector graphics provides better scalability
Frame Buffer • Normally • Video RAM (VRAM) – designed to support fast transfer of large amounts of data • Dynamic RAM (DRAM) • Number of bits per pixel is the depth of the frame buffer • Determines number of distinct color values • B&W=1 • Full color >= 24
Frame Buffer .2 • True color systems are also known as RGB • Number of bits per pixel is divided by 3 • Each group represents one of the colors • Red, Green, Blue • Resolution is the number of pixels per frame buffer • Usually reported as width x height
Frame Buffer .3 • To reduce number of bits per pixel, a color buffer may be used • Color buffer holds actual RGB values • Frame buffer holds index into color buffer • Reduces size when number of colors used is small relative to total number possible
Grapihic Processor • Processing of graphic information may be done by • Normal CPU • Specialized Graphic Processor • High performance graphic display systems generally use separate graphic processor • Optimized for image processing and display • Specialized operations and high data throughput
Output Devices • Previously, most common output device was the cathode-ray tube or CRT • Image is created by a moving electron beam that causes a coating on the tube face to glow • Most commonly CRT scans a line at a time across the screen • But may be random scan
CRT • The image is not retained but must be refreshed (recreated) periodically • Most commonly at least 50 times per second • This is the refresh rate • Scan lines may be produced consecutively, non-interlaced • Or half at a time, interlaced
Color CRT • Each screen pixel consists of three closely spaced color dots, a RGB triad • Shadow mask helps focus electron beam on a single dot
LCD Display • Each pixel is a layered solid state device that can be turned on or off to produce that color component • Generally cannot support as rapid refresh as CRT
Input Devices • Keyboard • Pointing devices • Mouse • Joystick • Game console • Data tablet
Images • Physical image is generated by physical object • Computer graphic systems generate synthetic image • Produced by program
Objects and Viewers • World is populated with three dimensional objects • How object is seen depends on relationship to viewer and other attributes • Generally a viewer can see only some parts of an object • Different relationships between object and viewer can produce different images
Light • Without light all would be uniformly black • Light makes images visible and changes features through • Intensity • Color • Direction • Interaction with light is complex
Light • Visible spectrum has wavelengths between 350 nm and 780 nm • Color depends on wavelength • Blue ~450 nm • Green ~520 nm • Red ~650 nm
Modeling Light • Geometric Optics • Light assumed to come from point source • Fixed intensity • Travels in straight lines • Assume monochromatic (single color) • More complex sources can be viewed as collection of point sources
Ray Tracing • Effect of light can be viewed by following ray from source to viewer • Light travels in straight line until it hits surface • Surface point then acts as new point source • Ray behavior determined by trig laws • Infinite possibilities but only those that reach viewer matter
Radiosity • When surface scatters incoming light in all directions, ray tracing does not produce accurate results • Energy conservation based calculation is more accurate but also more computationally intensive
Human Visual System • Light enters eye through lens • Focused on retina at back of eye • Retina contains light sensitive cells • Rods – brightness only • Cones – three kinds for three colors • RGB cones allow RGB displays to function • Sensitivity is not uniform
Pinhole Camera • A simple model of a camera • Assumes light enters through a pin hole • Small enough that only one ray enters in any direction
Pinhole Camera Image • Can calculate point where ray from point source is projected on back of camera yp = -y/(z/d), similar for x
Pinhole Camera Image .2 • Point at back of camera is called the projection of the source • Field or angle of view is angle made by triangle from lens to image plane • Θ=2 arctan(h/2d)
Synthetic Camera Model • Standard approach for three-dimensional computer graphics • Compute image that would be captured by bellows camera • Bellows allows depth of camera to be changed as desired • Image is formed on projection plane, where back of camera would be
Clipping Window or Rectangle • Determines the edge boundaries of the image
Programmer’s Interface • Visual interface • Allows image creation by arranging visual components • Programming interface • Function library • Application Programmer’s Interface (API) • Defines available operations • Images build combining operations
Pen-Plotter Model • Typical of early vector drawing systems • Move pen from point to point drawing lines to create image moveto(0, 0); lineto(1, 0); lineto(1, 1); lineto(0, 1); lineto(0, 0);
Pen-Plotter Image • Adding additional lines could produce the image of a cube
Pen-Plotter Model • Limited functionality • Difficult to produce three-dimensional images
Three-Dimensional APIs • Synthetic Camera model is common • OpenGL • PHIGS • Direct3D • VRML • JAVA-3D
3-D API Components • Objects • Viewer • Light Sources • Material Properties
Primitive Objects • Points • Line segments • Polygons • Text • Curves • Surfaces
OpenGL Object Definition • List of components bounded by function calls • A triangle glBegin(GL_POLYGON); glVertex3f(0.0, 0.0, 0.0); glVertex3f(0.0, 1.0, 0.0); glVertex3f(0.0, 0.0, 1.0); glEnd();
Camera or Viewer • Specification requires a number of attributes • Position • Orientation • Focal length • Film plane