Graphics Systems and Models
-
Upload
garrett-tucker -
Category
Documents
-
view
30 -
download
0
description
Transcript of Graphics Systems and Models
Graphics Systems and Graphics Systems and ModelsModels
Chapter 1Chapter 1
CS 480/680 2Chapter 1 -- Graphics Systems and Models
Introduction:Introduction: Computer GraphicsComputer Graphics
What is it?What is it?
Overview of what we will cover:Overview of what we will cover: A graphics overviewA graphics overview Graphics TheoryGraphics Theory A graphics Software System: OpenGLA graphics Software System: OpenGL
Our approach will be top-down.Our approach will be top-down. We want you to start writing application programs We want you to start writing application programs
that generate graphical output as quickly as possiblethat generate graphical output as quickly as possible
CS 480/680 3Chapter 1 -- Graphics Systems and Models
1. Applications of Computer 1. Applications of Computer GraphicsGraphics
The development of Computer Graphics has been The development of Computer Graphics has been driven by the needs of the user community and by driven by the needs of the user community and by the advances in hardware and software.the advances in hardware and software.
Applications can be split into four major areas:Applications can be split into four major areas: Display of informationDisplay of information DesignDesign SimulationSimulation User InterfacesUser Interfaces
CS 480/680 4Chapter 1 -- Graphics Systems and Models
1.1 Display of Information1.1 Display of Information Classical graphics techniques Classical graphics techniques
arose as a medium to convey arose as a medium to convey information among people:information among people:
4,000 years ago -- Babylonians: 4,000 years ago -- Babylonians: floor plans of buildings on stonesfloor plans of buildings on stones
2,000 years ago -- Greeks: 2,000 years ago -- Greeks: Architectural ideas Architectural ideas
Now we have Computer-based Now we have Computer-based drafting programsdrafting programs
CS 480/680 5Chapter 1 -- Graphics Systems and Models
For centuries -- Cartographers have For centuries -- Cartographers have developed maps to display celestial developed maps to display celestial and geographical information.and geographical information.
Now maps can be developed and Now maps can be developed and manipulated in real-time over the manipulated in real-time over the internet.internet.
CS 480/680 6Chapter 1 -- Graphics Systems and Models
Over the past 100 years -- workers in statistics have Over the past 100 years -- workers in statistics have explored techniques for generating plots to convey explored techniques for generating plots to convey informationinformation
Now we have computer plotting packagesNow we have computer plotting packages
CS 480/680 7Chapter 1 -- Graphics Systems and Models
Medicine poses interesting and important data-Medicine poses interesting and important data-analysis problemsanalysis problems
CAT Scans, MRI’s ultrasound, and other 3D data CAT Scans, MRI’s ultrasound, and other 3D data producing technologiesproducing technologies
CS 480/680 8Chapter 1 -- Graphics Systems and Models
The field of Scientific Visualization provides The field of Scientific Visualization provides graphical tools that help these researchers and others graphical tools that help these researchers and others interpret the vast quantities of data generatedinterpret the vast quantities of data generated
CS 480/680 9Chapter 1 -- Graphics Systems and Models
1.2 Design1.2 Design Engineering and Architecture are concerned Engineering and Architecture are concerned
with designwith design starting with a set of specificationstarting with a set of specification seek a cost-effective (and esthetic) solutionseek a cost-effective (and esthetic) solution This is an iterative processThis is an iterative process
The power of interacting with images on the The power of interacting with images on the screen screen
has been known for at least 40 years.has been known for at least 40 years. and today the use of interactive tools pervades the and today the use of interactive tools pervades the
CAD field in areas such as architecture and VLSI CAD field in areas such as architecture and VLSI designdesign
CS 480/680 10Chapter 1 -- Graphics Systems and Models
1.3 Simulation1.3 Simulation When did graphics begin to be used?When did graphics begin to be used? Why?Why? The field of VR has opened up many new The field of VR has opened up many new
horizons.horizons. Same (or different) image in each eyeSame (or different) image in each eye position trackingposition tracking interactive devicesinteractive devices This has led to training capabilitiesThis has led to training capabilities
NASA research grantNASA research grant
CS 480/680 11Chapter 1 -- Graphics Systems and Models
1.4 User Interfaces1.4 User Interfaces Our interaction with computers has become Our interaction with computers has become
dominated by a visual paradigm that includes:dominated by a visual paradigm that includes: windows,windows, icons,icons, menus, and menus, and a pointing devicea pointing device
We have become so accustomed to this style of We have become so accustomed to this style of interface that we often forget that what we are doing interface that we often forget that what we are doing is working with computer graphics.is working with computer graphics.
CS 480/680 12Chapter 1 -- Graphics Systems and Models
2. A Graphics System2. A Graphics System
There are 5 major elements in our systemThere are 5 major elements in our system
Processor, Memory, Frame Buffer, Input Devices, Processor, Memory, Frame Buffer, Input Devices, Output DevicesOutput Devices
CS 480/680 13Chapter 1 -- Graphics Systems and Models
2.1 Pixels and the Frame Buffer2.1 Pixels and the Frame Buffer At present, almost all graphics systems are At present, almost all graphics systems are
raster-basedraster-based A picture is produced from an array (the raster) of A picture is produced from an array (the raster) of
picture elements (pixels)picture elements (pixels)
Def: depth of the frame bufferDef: depth of the frame buffer
CS 480/680 14Chapter 1 -- Graphics Systems and Models
Definitions:Definitions: Depth of the frame bufferDepth of the frame buffer
1-bit 1-bit 8-bit deep8-bit deep full-color is 24-bit or morefull-color is 24-bit or more
ResolutionResolution the number of pixels in the frame bufferthe number of pixels in the frame buffer
Rasterization or scan conversionRasterization or scan conversion The converting of geometric primitives into pixel The converting of geometric primitives into pixel
assignments in the frame bufferassignments in the frame buffer
CS 480/680 15Chapter 1 -- Graphics Systems and Models
2.2 Output Devices2.2 Output Devices The dominate type of display is the Cathode-The dominate type of display is the Cathode-
ray tube (CRT)ray tube (CRT)
Def: refresh rateDef: refresh rate
CS 480/680 16Chapter 1 -- Graphics Systems and Models
CS 480/680 17Chapter 1 -- Graphics Systems and Models
Color CRT’s Color CRT’s have three different colored phosphors arranged in have three different colored phosphors arranged in
small groups (typically triads).small groups (typically triads).
CS 480/680 18Chapter 1 -- Graphics Systems and Models
2.3 Input Devices2.3 Input Devices Most graphics systems provide a keyboard and Most graphics systems provide a keyboard and
at least one other input deviceat least one other input device mousemouse joystickjoystick data tabletdata tablet
We will study these devices in Chapter 3We will study these devices in Chapter 3
CS 480/680 19Chapter 1 -- Graphics Systems and Models
3. Images: 3. Images: Physical and SyntheticPhysical and Synthetic
The Usual pedagogical approach:The Usual pedagogical approach: construct raster imagesconstruct raster images
simple 2D entities (points, lines, polygons)simple 2D entities (points, lines, polygons) Define objects based upon 2DDefine objects based upon 2D
Because such functionality is supported by most Because such functionality is supported by most present computer graphics systems, we are going present computer graphics systems, we are going to learn to create images here, rather than expand a to learn to create images here, rather than expand a limited model.limited model.
CS 480/680 20Chapter 1 -- Graphics Systems and Models
3.1 Objects and Viewers3.1 Objects and Viewers Two basic entities must be part of any image-Two basic entities must be part of any image-
formation process:formation process: the objectthe object the viewerthe viewer
The object exists in space independent of any The object exists in space independent of any image-formation process, and of any viewer.image-formation process, and of any viewer.
CS 480/680 21Chapter 1 -- Graphics Systems and Models
What we will study NowWhat we will study Now Both the object and the viewer exist in a Both the object and the viewer exist in a
3D world. However, the image they 3D world. However, the image they define is 2Ddefine is 2D
The process by which the specification The process by which the specification of the object is combined with the of the object is combined with the specification of the viewer to produce an specification of the viewer to produce an image is the essence of image formation.image is the essence of image formation.
Future:Future: In Chapter 2, we show how OpenGL In Chapter 2, we show how OpenGL
allows us to build simple objectsallows us to build simple objects In Chapter 9 we learn how to define In Chapter 9 we learn how to define
objects in a manner that incorporates objects in a manner that incorporates relationships among objects.relationships among objects.
CS 480/680 22Chapter 1 -- Graphics Systems and Models
3.2 Light and Images3.2 Light and Images Much information was missing from the Much information was missing from the
preceding picture:preceding picture: We have yet to mention light!We have yet to mention light!
If there were no light sources the objects would be dark, If there were no light sources the objects would be dark, and there would be nothing visible in our image.and there would be nothing visible in our image.
We have not mentioned how color enters the pictureWe have not mentioned how color enters the picture Or, what are the effects of different kinds of Or, what are the effects of different kinds of
surfaces on the objects.surfaces on the objects.
CS 480/680 23Chapter 1 -- Graphics Systems and Models
Taking a more physical approach, we can start Taking a more physical approach, we can start with the following arrangement:with the following arrangement:
The details of the interaction between light and the The details of the interaction between light and the surfaces of the object determine how much light surfaces of the object determine how much light enters the camera.enters the camera.
CS 480/680 24Chapter 1 -- Graphics Systems and Models
Light is a form of electromagnetic radiation:Light is a form of electromagnetic radiation:
CS 480/680 25Chapter 1 -- Graphics Systems and Models
3.3 Ray Tracing3.3 Ray Tracing We can start building an imaging model by We can start building an imaging model by
following light from a source.following light from a source.
CS 480/680 26Chapter 1 -- Graphics Systems and Models
Ray tracing is an image formation technique Ray tracing is an image formation technique that is based on these ideas and that can form that is based on these ideas and that can form the basis for producing computer generated the basis for producing computer generated images.images.
CS 480/680 27Chapter 1 -- Graphics Systems and Models
4. The Human Visual System4. The Human Visual System
Our extremely complex visual system has all the Our extremely complex visual system has all the components of a physical imaging system, such as a components of a physical imaging system, such as a camera or a microscope.camera or a microscope.
CS 480/680 28Chapter 1 -- Graphics Systems and Models
5. The Pinhole Camera5. The Pinhole Camera
What is one?What is one?
A Pinhole camera is a box A Pinhole camera is a box with a small hole in the center on one side, with a small hole in the center on one side, and the film on the opposite sideand the film on the opposite side
CS 480/680 29Chapter 1 -- Graphics Systems and Models
Pinhole camera near Cliff House in San FranciscoPinhole camera near Cliff House in San Francisco
CS 480/680 30Chapter 1 -- Graphics Systems and Models
6. The Synthetic Camera Model6. The Synthetic Camera Model
Consider the imaging system shown here:Consider the imaging system shown here:
CS 480/680 31Chapter 1 -- Graphics Systems and Models
A few Basic principles:A few Basic principles: First, the specification of the objects is independent First, the specification of the objects is independent
of the specification of the viewer.of the specification of the viewer. In a graphics library we would expect separate functions In a graphics library we would expect separate functions
for specifying objects and the viewer.for specifying objects and the viewer.
Second, we can compute the image using simple Second, we can compute the image using simple trigonometric calculationstrigonometric calculations
CS 480/680 32Chapter 1 -- Graphics Systems and Models
Because of this, we can move the image plane in Because of this, we can move the image plane in front of the lens (call this the projection plane) and front of the lens (call this the projection plane) and end up with:end up with:
In Chapter 5, we discuss this process in detail and In Chapter 5, we discuss this process in detail and derive the relevant mathematical formulasderive the relevant mathematical formulas
CS 480/680 33Chapter 1 -- Graphics Systems and Models
We must also consider the limited size of the image. We must also consider the limited size of the image.
Therefore, we must discuss clipping:Therefore, we must discuss clipping:
CS 480/680 34Chapter 1 -- Graphics Systems and Models
7. The Programmer’s Interface7. The Programmer’s Interface
There are numerous ways that a user can interact There are numerous ways that a user can interact with a graphics system.with a graphics system.
In a typical paint program it would look like:In a typical paint program it would look like:
CS 480/680 35Chapter 1 -- Graphics Systems and Models
7.1 Application Programmer’s Interfaces7.1 Application Programmer’s Interfaces What is an API?What is an API?
Why do you want one?Why do you want one?
CS 480/680 36Chapter 1 -- Graphics Systems and Models
If we are to follow the synthetic camera model, If we are to follow the synthetic camera model, we need functions in the API to specify:we need functions in the API to specify:
ObjectsObjects ViewerViewer Light SourcesLight Sources Material PropertiesMaterial Properties
CS 480/680 37Chapter 1 -- Graphics Systems and Models
Objects are usually defined by a set of verticesObjects are usually defined by a set of vertices
The following code fragment defines a triangular The following code fragment defines a triangular polygon in OpenGLpolygon in OpenGL
glBegin(GL_POLYGON);glBegin(GL_POLYGON); glVertex3f(0.0,0.0,0.0);glVertex3f(0.0,0.0,0.0); glVertex3f(0.0,1.0,0.0);glVertex3f(0.0,1.0,0.0); glVertex3f(0.0,0.0,1.0);glVertex3f(0.0,0.0,1.0); glEND();glEND();
CS 480/680 38Chapter 1 -- Graphics Systems and Models
We can define a viewer or camera in a variety We can define a viewer or camera in a variety of waysof ways
We can identify four types of necessary We can identify four types of necessary specifications:specifications:
PositionPosition OrientationOrientation Focal lengthFocal length Film planeFilm plane
CS 480/680 39Chapter 1 -- Graphics Systems and Models
Light sources can be defined by their location, Light sources can be defined by their location, strength, color, and directionality.strength, color, and directionality.
API’s provide a set of functions to specify these API’s provide a set of functions to specify these parameters for each source.parameters for each source.
Material properties are characteristics, or Material properties are characteristics, or attributes, of the objectsattributes, of the objects
such properties are usually defined through a series such properties are usually defined through a series of function calls at the time that each object is of function calls at the time that each object is defined.defined.
CS 480/680 40Chapter 1 -- Graphics Systems and Models
7.2 A Sequence of Images7.2 A Sequence of Images In Chapter 2 , we begin our detailed discussion In Chapter 2 , we begin our detailed discussion
of the OpenGL APIof the OpenGL API Color Plates 1 through 8 show what is possible Color Plates 1 through 8 show what is possible
with available hardware and a good API, but with available hardware and a good API, but also they are not difficult to generatealso they are not difficult to generate
CS 480/680 41Chapter 1 -- Graphics Systems and Models
8. Graphics Architectures8. Graphics Architectures
On one side of the API is the application program. On one side of the API is the application program. On the other is some combination of hardware and On the other is some combination of hardware and software that implements the functionality of the software that implements the functionality of the APIAPI
Researchers have taken various approaches to Researchers have taken various approaches to developing architectures to support graphics APIsdeveloping architectures to support graphics APIs
CS 480/680 42Chapter 1 -- Graphics Systems and Models
Early systems used general purpose computersEarly systems used general purpose computers single processing unitsingle processing unit
In the early days of computer graphics, computers In the early days of computer graphics, computers were so slow that refreshing even simple images, were so slow that refreshing even simple images, containing a few hundred line segments, would containing a few hundred line segments, would burden an expensive computerburden an expensive computer
CS 480/680 43Chapter 1 -- Graphics Systems and Models
8.1 Display Processors8.1 Display Processors The earliest attempts to build a special purpose The earliest attempts to build a special purpose
graphics system were concerned primarily with graphics system were concerned primarily with relieving the task of refreshing the displayrelieving the task of refreshing the display
CS 480/680 44Chapter 1 -- Graphics Systems and Models
8.2 Pipeline Architectures8.2 Pipeline Architectures The major advances in graphics architectures The major advances in graphics architectures
parallel closely the advances in workstations.parallel closely the advances in workstations. For computer graphics applications, the most For computer graphics applications, the most
important use of custom VLSI circuits has been in important use of custom VLSI circuits has been in creating pipeline architecturescreating pipeline architectures
A simple arithmetic pipeline is shown here:A simple arithmetic pipeline is shown here:
CS 480/680 45Chapter 1 -- Graphics Systems and Models
If we think in terms of processing the geometry of If we think in terms of processing the geometry of our objects to obtain an image, we can use the our objects to obtain an image, we can use the following block diagram:following block diagram:
We will discuss the details of these steps in We will discuss the details of these steps in subsequent chapters.subsequent chapters.
CS 480/680 46Chapter 1 -- Graphics Systems and Models
8.3 Transformations8.3 Transformations Many of the steps in the imaging process can be Many of the steps in the imaging process can be
viewed as transformations between viewed as transformations between representations of objects in different representations of objects in different coordinate systemscoordinate systems
for example: from the system in which the object for example: from the system in which the object was defined to the system of the camera was defined to the system of the camera
We can represent each change of coordinate We can represent each change of coordinate systems by a matrixsystems by a matrix
We can represent successive changes by multiplying We can represent successive changes by multiplying (or concatenating) the individual matrices into a (or concatenating) the individual matrices into a single matrix.single matrix.
CS 480/680 47Chapter 1 -- Graphics Systems and Models
8.4 Clipping8.4 Clipping Why do we Clip?Why do we Clip?
Efficient clipping algorithms are developed in Efficient clipping algorithms are developed in Chapter 7Chapter 7
CS 480/680 48Chapter 1 -- Graphics Systems and Models
8.5. Projection8.5. Projection In general three-dimensional objects are kept in In general three-dimensional objects are kept in
three dimensions as long as possible, as they three dimensions as long as possible, as they pass through the pipeline. pass through the pipeline.
Eventually though, they must be projected into Eventually though, they must be projected into two-dimensional objects.two-dimensional objects.
There are various projections that we can There are various projections that we can implement.implement.
We shall see in Chapter 5 that we can We shall see in Chapter 5 that we can implement this step using 4 x 4 matrices, and, implement this step using 4 x 4 matrices, and, thus, also fit it into the pipeline.thus, also fit it into the pipeline.
CS 480/680 49Chapter 1 -- Graphics Systems and Models
8.6 Rasterization8.6 Rasterization Finally, our projected objects must be Finally, our projected objects must be
represented as pixels in the frame buffer.represented as pixels in the frame buffer. We discuss this scan-conversion or rasterization We discuss this scan-conversion or rasterization
process in Chapter 7process in Chapter 7
CS 480/680 50Chapter 1 -- Graphics Systems and Models
8.7 Performance Characteristics8.7 Performance Characteristics There are two fundamentally different types of There are two fundamentally different types of
processing processing Front end -- geometric processing, based on the Front end -- geometric processing, based on the
processing of verticesprocessing of vertices ideally suited for pipelining, and usually involves ideally suited for pipelining, and usually involves
floating-point calculations.floating-point calculations. The geometry engine developed by SGI was a VLSI The geometry engine developed by SGI was a VLSI
implementation for many of these operations in a special implementation for many of these operations in a special purpose chip. These became the basis for a series of purpose chip. These became the basis for a series of graphics workstations.graphics workstations.
Back end -- involves direct manipulation of bits in Back end -- involves direct manipulation of bits in the frame buffer.the frame buffer.
Ideally suited for parallel bit processors.Ideally suited for parallel bit processors.
CS 480/680 51Chapter 1 -- Graphics Systems and Models
9. Summary9. Summary
In this chapter we have set the stage for our top-In this chapter we have set the stage for our top-down development of computer graphics.down development of computer graphics.
Computer graphics is a method of image formation that Computer graphics is a method of image formation that should be related to classical methods -- in particular to should be related to classical methods -- in particular to camerascameras
Our next step is to explore the application side of Our next step is to explore the application side of Computer Graphics programmingComputer Graphics programming
We will use the OpenGL APIWe will use the OpenGL API
CS 480/680 52Chapter 1 -- Graphics Systems and Models
10. Suggested Readings10. Suggested Readings
Journals:Journals: Computer GraphicsComputer Graphics -- ACM -- ACM IEEE Compute Graphics and ApplicationsIEEE Compute Graphics and Applications
Textbooks:Textbooks: Foley et.al.Foley et.al. Hearn and BakerHearn and Baker HillHill