Computer Graphics - PowerPoint PPT Presentation

1 / 62
About This Presentation
Title:

Computer Graphics

Description:

ES250b - Computer Systems and Engineering Applications 1998 R. O. Buchal. Computer Graphics ... Radiosity is very good at rendering architectural interiors ... – PowerPoint PPT presentation

Number of Views:25
Avg rating:3.0/5.0
Slides: 63
Provided by: ralphb6
Category:

less

Transcript and Presenter's Notes

Title: Computer Graphics


1
Computer Graphics
2
Lecture Outline
  • 2D vs. 3D graphics
  • Basics of 3D graphics
  • Graphics hardware
  • Application Program Interfaces
  • Comparisons and benchmarks
  • Computer Graphics Applications

3
The Emergence of 3-D Graphics
  • 2-D graphics has been used for years for
    illustration, diagrams, 2-D CAD, etc.
  • 3-D graphics has until recently been available
    only on high-end workstations
  • 3-D graphics is now available on standard PCs

4
Applications of 3-D Graphics
  • CAD
  • Scientific visualization
  • virtual reality
  • simulation
  • games

5
Pixel Graphics Vs. Vector Graphics
  • Pixel graphics
  • paint programs
  • eg., Windows Paintbrush
  • Vector graphics
  • lines and polygons
  • eg., Microsoft Draw

6
2-D Versus 3-D Graphics
Two-dimensional
Three-dimensional
7
3-D Wireframe Graphics
  • Three dimensional objects are drawn as meshes of
    connected points
  • Interaction and animation requires geometric
    calculations only
  • The resulting image is often ambiguous

or
?
wireframe image
8
3-D Shaded Solids
  • Three dimensional objects are drawn as smoothly
    shaded solid objects
  • More calculations are needed than for wireframe
  • Slower than wireframe, but more realistic

shaded
wireframe
9
Typical Graphics Functions
  • Draw
  • Pick and Select
  • Transform
  • Shade and Render

10
Draw
  • Draw lines or polygons connecting specified points

11
Pick and Select
  • Identify the graphic object under the cursor
  • Identify the graphic objects inside a region

12
Transform
  • Rotate, scale, translate

Transformed
13
3-D Transform
14
Shade and Render
  • Colour and shade surfaces, and display the image
    on the screen

15
Graphics generation
Geometry and colour calculation
Frame buffer and display
User application
Rasteriz- ation
Graphics pipeline
16
User Application
Z
Y
X
17
Geometry Calculation
Z
(xw, yw, zw)
Y
X
World coordinates
18
Colour Calculation
Colour is calculated based on surface
properties, light direction and colour, using
lighting models.
19
Rasterization
Transform polygon to pixels
20
Hidden Surface Removal
  • When several overlapping polygons are drawn on
    the screen, which one is on top?

Which is right?
21
Z-buffering
This pixel is drawn on screen
  • A fast hardware solution is the Z-buffer
  • The depth of each pixel relative to the screen
    is calculated and saved in a buffer
  • The pixel with the smallest depth is the one that
    is displayed
  • The other pixels are on surfaces that are hidden

Screen
Polygons
Z
22
Lighting Models and Shading
  • For visual realism, lighting models have been
    developed to illuminate the surfaces of solid
    models
  • These models incorporate
  • ambient lighting and illumination
  • diffuse reflection of directional lighting
  • specular reflection of directional lighting

23
Lighting Types
24
Ambient Illumination
  • Ambient light comes from many directions, as a
    result of multiple reflections and emission from
    many sources
  • The resulting surface illumination is uniform
  • Depends only on object material

25
Diffuse Reflection
  • Dull, matte surfaces reflect directional light
    equally in all directions

26
Specular Reflection
  • Shiny surfaces reflect light in one direction
  • The reflection is the colour of the incident
    light, not the colour of the object
  • Specular reflection is the source of highlights

27
Dull and Shiny Surfaces
28
Lighting Models
  • Real objects are illuminated by a combination of
    these three illumination types.
  • CAD systems like IDEAS allow the user to define
  • colour and location of lights
  • types and intensities of lights (point, diffuse,
    etc.)
  • object material properties, including colour,
    specularity, reflection coefficients

29
Example
Powerpoint can vary the lighting and material
30
Lighting Models
  • There are several popular shading algorithms
  • Flat shading
  • each polygon has a uniform colour
  • the surface appears faceted
  • Phong or Gouraud shading
  • the colour is varied smoothly across the polygons
  • the result is a surface that appears to be smooth

Flat
Gouraud
31
Flat Shading
  • The simplest form of shading is flat shading
  • Each polygon is uniformly coloured, depending on
    its orientation relative to the light source

32
Flat Shading
33
Flat Shading
n
?
d
34
Gouraud and Phong Shading
  • Flat shading is simple, but gives a faceted
    appearance
  • Gouraud and Phong developed techniques to
    smoothly interpolate the illumination across
    polygons
  • The resulting shading is smooth and continuous

35
Gouraud Shading
  • The surface normal at the vertices is calculated
    by averaging the adjoining face normals
  • The vertex intensity is then calculated
  • The intensity is interpolated across the polygon
    based on the vertices

vertex normal
face normals
36
Phong Shading
  • Rather than interpolating the lighting, Phong
    shading interpolates the surface normal across
    the polygons
  • The intensity is then calculated based on the
    interpolated normal
  • This gives more realistic specular lighting

37
Ray Tracing and Radiosity
  • Ray tracing and radiosity are two techniques for
    achieving the ultimate in visual realism
  • These techniques work well with curved surfaces

38
Ray Tracing
  • Ray tracing traces a ray of light from the eye to
    a light source
  • Along the way, the light ray may be occluded (in
    shadow), reflected or refracted
  • Ray tracing realistically renders scenes with
    shiny and transparent objects

39
Radiosity
  • In many scenes, illumination is primarily diffuse
  • Diffuse illumination results from the absorption
    and reflection of diffuse light from many objects
    in the scene
  • Radiosity uses thermal models of emission and
    reflection of radiation to accurately calculate
    diffuse lighting
  • Radiosity is very good at rendering architectural
    interiors

40
Texture Mapping
  • For realism, photographic textures are mapped
    onto the surfaces of objects
  • Example textures
  • woodgrain
  • concrete
  • grass
  • marble
  • Texture mapping is very computationally intensive

41
Other Graphics Effects
  • Effects that are fairly easy to achieve include
  • Fog
  • Transparency

42
Example - Wireframe
43
Example - Flat Shaded
44
Example - Smooth Shaded
45
Example - Texture Mapped
46
Example - Shadows
47
Example - Ray Traced
Green glass
48
Examples
texture mapping
reflections
shadows
49
Graphics Standards
  • Graphics functions are incorporated into a C,
    FORTRAN, or Pascal program by using a library of
    functions or subroutines
  • This library of functions is known as an
    Application Program Interface (API)
  • There is no single standard, but several APIs are
    in wide use.

50
A Selection of Graphics APIs
  • GKS
  • 2-D graphics only
  • Windows GDI (Graphics Device Interface)
  • 2-D only
  • PHIGS (Programmers Hierarchical Interactive
    Graphics Standard)
  • Xlib
  • X-windows graphics commands
  • PEX
  • PHIGS Extension to X

51
Emerging Standards in APIs
  • OpenGL (developed by Silicon Graphics)
  • open standard
  • available on all platforms
  • intended for professional-level graphics like CAD
  • Direct3D
  • developed by Microsoft
  • Windows only
  • intended for games

52
Double Buffering
  • For smooth animations, some graphics cards
    support double buffering
  • A new image is drawn in one buffer while the
    other buffer is displayed on the screen
  • When the update is finished, the buffers swap
    so that change on the screen is instantaneous
  • This prevents flicker as the image is redrawn.

53
Frame Buffers
  • A generic VGA frame buffer typically stores 8
    bits per pixel (256 colours)
  • Graphics cards with more memory use 24 bit frame
    buffers
  • 16 million colours
  • For most PCs, this is as good as it gets

54
Frame Buffers
  • High end graphics hardware supports frame buffers
    with over 100 bits per pixel!
  • two 24 bit images
  • 24 bit Z-buffer (depth)
  • overlay bits
  • alpha bits for transparency
  • and other special purpose bits
  • These bits are sometimes called bit planes
  • This requires much more graphics memory than in
    common in PCs

55
Stereo vision using 3-D glasses
  • One frame buffer contains the left eye view, the
    other contains the right eye view
  • The views are rapidly alternated on the screen
  • Glasses with liquid crystal shutters synchronize
    the left and right views
  • The results are amazing!

56
Graphics Generation
Geometry and colour calculation
Frame buffer and display
User application
Rasteriz- ation
Graphics pipeline
57
Graphics Designs
  • Software pipeline
  • all processing done in software
  • slow, inexpensive
  • example PC with 2D graphics card
  • Software geometry, hardware rasterization
  • good compromize
  • example Matrox Millenium graphics card
  • Hardware pipeline
  • all processing done in hardware
  • very fast, expensive
  • high-end Silicon Graphics workstations

58
Graphics Performance Comparison
Source OPC CDRS results
59
Price Comparison
Source OPC CDRS results
60
Price/Performance Comparison
Source OPC CDRS results
61
Summary
  • 3D graphics important for engineering
    applications
  • 3D graphics is now available on standard PCs

62
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com