ch01_Survey_of_Comp_Graphics

Download Report

Transcript ch01_Survey_of_Comp_Graphics

• Donald Hearn and M. Pauline Baker
Computer Graphics with OpenGL
Third Edition.
Prentice Hall 2003
ISBN: 0131202383
Expanded by Jozef Goetz
Glossary
• CG – Computer Graphics
• Rasterization: The process of determining values
for the pixels in a rendered image. Translating an
image into pixels. Also called scan conversion.
• Texture refers to the surface quality (color).
• Texture mapping is a method of adding realism to a
computer-generated graphic.
– When a picture is mapped onto an object, the
correspondence between the picture's pixels and points on
the object's surface is calculated.
• Specular: reflective, especially light from materials
with glossy surfaces
Expanded by Jozef Goetz
Glossary
• Bump mapping: The process of creating and
displaying a texture where the values of the texture
are used to simulate the bumpiness of an object's
surface.
– Bump mapping is used to add detail to an image without
increasing the number of polygons.
– Bump maps do not move the geometry of an object, but
they do affect the shading of a surface, giving the illusion
of a pattern being embossed on the surface
– Bumps are applied by matching up a series of grayscale
pixels with colored pixels on the rendered, colored object.
Lighter grayscale pixels create a sense of maximum relief or
maximum
Expanded by Jozef Goetz
Academic Integrity
• You may discuss general ideas with
classmates.
• You must do each programming
assignment entirely by yourself.
• You may discuss or but not share
programs with other students.
• LV regulations require the professor
to report suspected violations of
academic integrity.
Expanded by Jozef Goetz
Class Web Page
• Syllabus
– Overview of the course.
– Schedule of topics and readings.
• Programming assignments.
• Guidelines
• Professor’s lecture notes.
• Links to resources
Expanded by Jozef Goetz
Facilities, Languages, Libraries
• Facilities:
– Computer Lab (Windows XP).
–– Your own PC (Windows XP).
• Languages:
– Visual Studio 6.0 with C++
• Libraries:
– OpenGL: Library developed by Silicon
Graphics.
– GLUT: Library combining OpenGL with
window systems.
Expanded by Jozef Goetz
Chapter 1
A Survey of Computer Graphics
Expanded by Jozef Goetz
What is Computer Graphics CG?
• is the field of visual computing, where one utilizes
computers both to generate visual images
synthetically and to integrate or alter visual and
spatial information sampled from the real world
http://en.wikipedia.org/wiki/Computer_graphics
– Generation of (possibly realistic) images of virtual scenes
using computer hardware.
• In this context it refers to the algorithms, conceptual
constructions and mathematical background needed to render
virtual scenes either 2D or 3D
• Really a sub-field of the more general “Virtual
Reality” (VR) field,
– though VR is usually considered a sub-field of graphics!
• Distinct from “Image Processing” and CG in which
images are scanned into the computer.
Expanded by Jozef Goetz
Expanded by Jozef Goetz
Computer Graphics = Drawing
Pictures with a Computer
• Rendering is the process of producing the pixels of an
image from a higher-level description (object
coordinates) of its components.
http://en.wikipedia.org/wiki/Rendering
• 2D Rendering
– Issues: 2D geometry (curves, 2D objects, ..), drawing algorithms
• 3D Rendering
– Generating realistic images of non-existent 3D objects/scenes
– Issues:
•
•
•
•
geometry (surfaces, 3D objects, …);
lighting;
view transformations;
rendering algorithms;…
© 2005 Burkhard Wuensche & Richard Lobb
Expanded by Jozef Goetz
Modeling
• 3D artists make 3D models (“virtual worlds”)
– Highly skilled job
– Slow work (= expensive!)
© by Ken Brilliant, © 2005 Burkhard Wuensche & Richard Lobb
Expanded by Jozef Goetz
Computer Graphics
used
• science
• art
• engineering
• business
• industry
• medicine
• government
• entertainment
• advertising
• education
• training
• home applications etc.
Expanded by Jozef Goetz
Computer Graphics Methods
Applied in
• the design of most products
• training simulators
• production of music videos
• tv commercials
• motion pictures
• data analysis
• scientific studies etc.
Expanded by Jozef Goetz
Current trend
• To produce a realistic view of a natural scene,
a graphics program must simulate the effects of
– actual reflections and refractions (bending of a ray)
from physical objects
• So the current trend is to incorporate physics
principles into graphics algorithms
– to better simulate the complex interactions
between objects and a lighting environment
Expanded by Jozef Goetz
1-1 Graphs and Charts
for
• printed reports
• slides
• transparencies
• animated video
p.2-3, fig. 1-2
used to summarize
• financial
• statistical
• mathematical
• scientific
• engineering
• economic data for
– research paper
– managerial summaries
– consumer info bulletins etc.
Expanded by Jozef Goetz
1-2 Computer-Aided Design CAD
• for engineering and architectural systems
• used in the design of
–
–
–
–
–
–
–
–
buildings
automobiles
aircraft
watercraft
spacecraft
computers
textiles
home appliances etc.
Expanded by Jozef Goetz
1-2 Computer-Aided Design CAD or
Computer-Aided Drafting and Design CADD
• the shapes used in a design represent the
different network or circuit components
• standard shapes and links between them for
mechanical, electrical, electronic, and logic
circuit are supplied by the design package
– designer can create personalized symbols
Expanded by Jozef Goetz
Computer Aided Design (CAD)
•
Expanded by Jozef Goetz
1-2 Computer-Aided Design CAD
• Real time, computer animation is used to
test a vehicle performance
– wire-frame displays (p.7, fig 1-11) allow the
designer to see into the interior of the vehicles and
to watch the behavior of inner components during
motion
• When object designs are complete,
– realistic lighting conditions and surface
rendering are applied to produce displays of the
final product or ad of the product
Expanded by Jozef Goetz
1-2 Computer-Aided Design CAD
p.5-10
• If the fabrication of a product can be
automated is referred to as CAM ComputerAided Manufacturing p.8
• Architects use interactive computer graphics
(CG) methods in CAD packages to lay out
rooms, doors, windows, stairs etc. in a building
design in a way to optimize space utilization
or arrange electrical elements on the circuit
board
– CAD packages provide facilities for
experimenting with 3D interior layouts and
lighting
Expanded by Jozef Goetz
1-3 Virtual-Reality Environment
p.10
• Users can interact with objects in a 3D scene
– to examine options by taking a simulated “walk”
to find better effect/option of a particular design
The new cultural Centre as restoring the old Savona Hospital San Paolo
Expanded by Jozef Goetz
1-3 Virtual-Reality Environment
p.10
• Computer Graphics are a popular means for
evaluating the design of large public complexes,
therefore virtual reality is quite a new approach in
this area that allows the user to freely navigate and
interact http://www.liophant.org/itim/websim1999/w134.html
• By connecting these environments with simulation
models, it becomes possible to perform a
quantitative analysis of system efficiency.
– By evaluating the facilities of a public cultural center or
the viability of a town,
• it is easy to measure the crossing and waiting times and to
obtain references for comparing different potential solutions and
for optimizing the design
Expanded by Jozef Goetz
1-4 Data Visualizations
p.12-18
• are produced as graphical representations for
– scientific
– engineering
– medical etc data sets, referred to as scientific
visualization
or
– commerce
– industry
– Nonscientific data sets referred to as business
visualization
Expanded by Jozef Goetz
1-4 Data Visualizations
p.12-18
used to:
• scan the large data sets to determine trends
and relationships amount data values
• data sets (a collection of data) can contain scalar values,
vectors, higher-order tensors, or any combination of these
by converting to a color-coded display (modeling
data or color coded visualization)
• aid in the understanding and analysis of
complex processes and mathematical functions
fig. 1-24 p.12
• simulate of effects (of the 1991 Kuwaiti oil
fires fig. 1-38 p.17)
Expanded by Jozef Goetz
Scientific Visualization
Expanded by Jozef Goetz
Scientific Visualization
Expanded by Jozef Goetz
1-5 Education and Training
p.19-23
used
• models of physical processes, physiological
functions, population trends, or equipment to help
trainees to understand the operation of a system.
• Examples of such specialized system are simulators
for
–
–
–
–
training of ship captain
aircraft pilots
heavy equipment operator
air traffic personnel
• Most simulators provide screens for visual displays
of the external environment
Expanded by Jozef Goetz
1-5 Education and Training
p.19-23
Monitoring flight conditions and Set airplane and environment parameters
Expanded by Jozef Goetz
1-6 Computer Art
p. 23-28
used
• computer-graphics methods and tools for fine
and commercial (ex. a logo fig. 1-62, p.27)
arts
• Tools include
– commercial software packages (such as Lumena)
– symbolic mathematics programs (such as
Mathematica)
– CAD packages
– desktop publishing software
– animation software
– paintbrush program etc.
Expanded by Jozef Goetz
1-6 Computer Art
p. 23-28
• Computer-generated animations are used in
producing TV commercials.
• How can we do it?
– ad spots are generated frame by frame
• each frame is rendered (made) and saved as a separate image file
– in each successive frame, object positions are displayed
slightly to simulate the motions involved in the animation
– when all frames in the animation sequence have been
rendered, the frames is transferred to film (or stored in a
video for playback.
• Film animations require 24 frames for each sec in the
animation sequence (or 30 frames to play back on a
video monitor)
Expanded by Jozef Goetz
1-6 Computer Art
Expanded by Jozef Goetz
p. 23-28
1-7 Entertainment
p. 28-31
used
• computer-graphics methods such as computer modeling,
computer-rendering and animation for
– TV productions
– motion pictures
– music videos
to get special effects, animations, characters, and scenes.
For example
• combine computer-generated figures of people, animals, or
cartoon characters with the live actors in a scene p.29, fig. 1-67
• or transform an actor’s face into another shape or object p.30
– morphing = one object is transformed (metamorphosed) into another
• or generate buildings, terrain features, or other background
scenes p.29, fig. 1-65
Expanded by Jozef Goetz
1-7 Entertainment
•
Expanded by Jozef Goetz
p. 28-31
Games
Expanded by Jozef Goetz
1-8 Image Processing
p.31-33
used to
• modify (improve picture quality), analyze
and interpret (recognize visual pattern)
existing pictures, such as photographs, and TV
scans
– CG is used to create pictures
• Typically, a photo/picture is digitized into an
image file before image-processing methods
are applied
Expanded by Jozef Goetz
1-8 Image Processing
p.31-33
• image-processing methods are used to
–
–
–
–
–
enhance the quality of the picture p.31 fig. 1-70
rearrange picture parts
enhance color separations
improve the quality of shading or
retouching
Example:
• medical applications:
– tomography
• is a technique of X-ray photography that allows cross-sectional views of
physiological systems
– ultrasonics
• high-frequency sound waves to generate digital data
– nuclear medicine scanners
• collect digital data from radiation that is emitted by ingested
radionuclides, and the data is then plotted as color-coded images
– computer-aided surgery
• simulate actual surgical procedure and try out different surgical cuts
Expanded by Jozef Goetz
Medical Visualization
The Visible Human Project
Expanded by Jozef Goetz
1-9 Graphical User Interface GUI
• used for applications and operating system software
e.g.
– Internet Browsers
– Innovative Interfaces
– Desktop Interfaces
• a major component is a window manager that allows a
user to display multiple rectangular screen areas,
called windows
• GUI includes:
– menus
• selection of options, color values, and graphics parameters
– tool bars
– icons
– popup menus
Expanded by Jozef Goetz
1-9 Graphical User Interface GUI
Expanded by Jozef Goetz
Properties of Light
• We perceive
electromagnetic
energy having
wavelengths in the
range 400-700 nm as
visible light.
– The perceived color is
as much psychological
as it is physical.
Expanded by Jozef Goetz
The Eye
The retina is largely composed of rods and cones. We
concentrate on the cones as they determine color perception.
Expanded by Jozef Goetz
Color Space
Expanded by Jozef Goetz
CIE Color Spaces
Norm Color System
•In 1931 the CIE ( Commission
Internationale de l'Eclairage)
developed the XYZ color system,
also called the "norm color system."
•This system is often represented as a
2D graphic which more or less
corresponds to the shape of a sail.
www.linocolor.com
•The red components of a color are tallied along
the x (horizontal) axis of the coordinate plane and
•the green components along the y (vertical) axis.
•In this way every color can be assigned a
particular point on the coordinate plane.
•Colors on the left tend toward gray, which
means that their spectral purity is decreased.
Expanded by Jozef Goetz
CIE Color Spaces
Color spaces can be drawn for different devices (eyes, printer, screen) for comparisons.
Expanded by Jozef Goetz
RGB
Go to: All Programs->Accessories->Paint->Color->Define Custom Colors
RGB Color cube (what we
use in computer graphics)
Other color spaces include HSV,
YUV, YCrCb, and YIQ
Hue, Saturation, Luminance or
Hue, Saturation, Value or
Hue, Saturation, Brightness)
Expanded by Jozef Goetz
Graphics Pipelines
• Graphics processes generally execute
sequentially typical ‘pipeline’ model
• There are two ‘graphics’ pipelines
– The Geometry or 3D pipeline
– The Imaging or 2D pipeline
Expanded by Jozef Goetz
Geometry Pipeline
Application –
generate geometrical representation from application data
Modelling: shapes
Shading: reflection and lighting
Transformation: viewing
Hidden Surface Elimination
Imaging
Pipeline
Expanded by Jozef Goetz
Imaging Pipeline
Geometry
Pipeline
Rasterization and Sampling
Texture Mapping
Image Composition
Intensity and Colour Quantization
Framebuffer/Display
Rasterization: The process of determining values for the pixels
in a rendered image. Translating an image into pixels. Also called scan conversion.
Texture refers to the surface quality. When a picture is mapped onto an object, the
correspondence between the picture's pixels and points on the object's surface is
calculated.
•Texture mapping is a method of adding
realism
Expanded
by Jozef Goetzto a computer-generated graphic.
An example through the pipeline…
The scene we are trying to represent:
Images courtesy of Picture Inc.
Expanded by Jozef Goetz
Wireframe model – Orthographic views
three different views
Expanded by Jozef Goetz
Perspective View
Expanded by Jozef Goetz
Depth Cue
A typical such depth cue is interposition, that is, the occlusion (obstruction)
of an object by another ...
Expanded by Jozef Goetz
Hidden Line Removal – add colour
Expanded by Jozef Goetz
Constant Shading – Ambient (surrounding)
Expanded by Jozef Goetz
Faceted Shading - Flat
i.e. each individual surface is clearly visible
Expanded by Jozef Goetz
Gouraud shading, no specular highlights
•In 3D graphics, a technique developed by Henri Gouraud in the early 1970s that computes
a shaded surface based on the color and illumination at the corners of every triangle.
•Gouraud shading is the simplest rendering method and is computed faster than Phong shading.
•It does not produce shadows or reflections.
•The surface normals at the triangle's points are used to create RGB values,
which are averaged across the triangle's surface
Expanded by Jozef Goetz
Specular highlights added
Specular: reflective, especially light from materials with glossy surfaces
Expanded by Jozef Goetz
Phong shading
Phong shading is a sophisticated smooth shading method, originated by Phong Bui-tuong.
•Phong shading requires much more computation for the hardware than Gouraud shading.
•Without it, objects may look faceted, ie each individual surface is clearly visible.
Expanded by Jozef Goetz
Texture mapping
Texture refers to the surface quality (color).
Texture mapping is a method of adding realism to a
computer-generated graphic.
–When a picture is mapped onto an object, the correspondence between the picture's
pixels and points on the object's surface is calculated.
Expanded by Jozef Goetz
Texture mapping
Expanded by Jozef Goetz
Reflections, shadows & Bump mapping
•Bump mapping: The process of creating and displaying a texture where
the values of the texture are used to simulate the bumpiness of an object's surface.
•Bump mapping is used to add detail to an image without increasing the number of polygons.
•Bump maps do not move the geometry of an object, but they do affect the shading of a surface
giving the illusion of a pattern being embossed on the surface.
Expanded by Jozef Goetz