introduction to computer graphics mohan sridharan based on slides by edward angel and dave shreiner...

36
Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Upload: shannon-knight

Post on 22-Dec-2015

234 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Introduction to Computer Graphics

Mohan SridharanBased on Slides by Edward Angel and Dave Shreiner

CS4395: Computer Graphics 1

Page 2: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Overview

• Slides based on book by Edward Angel and Dave Shreiner: Interactive Computer Graphics, A Top-down Approach with Shader-Based OpenGL (Sixth Edition), Addison-Wesley, 2011.

• Lots of resources on companion website:http://www.cs.unm.edu/~angel/BOOK/INTERACTIVE_COMPUTER_GRAPHICS/SIXTH_EDITION/

• Some useful resources listed on course website:http://www.cs.ttu.edu/~smohan/Teaching/Spring12_CS4395/index.html

CS4395: Computer Graphics 2

Page 3: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Objectives

• Broad introduction to Computer Graphics:– Software.– Hardware.– Applications.

• Top-down approach:

• Shader-Based OpenGL compatible with:– OpenGL 3.1 (and later).– Open GL ES 2.0– webGL

CS4395: Computer Graphics 3

Page 4: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Prerequisites

• Good programming skills in C (or C++).

• Basic Data Structures:– Linked lists.– Arrays.

• Geometry.

• Simple Linear Algebra.

CS4395: Computer Graphics 4

Page 5: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Requirements

• 4-5 programming projects:– Increasing levels of difficulty: totally 65% of grade.– Will move from 2D to 3D with lighting and texture.

• Term Project:– You pick! – Substantial challenge since it constitutes 25% of grade.

• Responses + classroom participation: 10%

CS4395: Computer Graphics 5

Page 6: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Resources

• Can run OpenGL on any system:– Windows: check graphics card properties for level of OpenGL supported.– Linux.– Mac: may need extensions for 3.1 equivalence.

• Get GLUT from web if needed:– Provided on Macs.– freeglut available on web.

• Get GLEW from web.

• WebGL: most newer browsers.

CS4395: Computer Graphics 6

Page 7: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

References

• www.opengl.org– Standards documents, sample code.

• The OpenGL Programmer’s Guide (the Redbook) 7th Edition:– The definitive reference.– Mixes 3.0 and 3.1

• OpenGL Shading Language, 3rd Edition.

• OpenGL ES 2.0 Programming Guide.

CS4395: Computer Graphics 7

Page 8: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Outline: Part 1

• Part 1: Introduction.

• Text: Chapter 1.

• Chapter topics:– What is Computer Graphics?– Applications Areas.– History.– Image formation.– Basic Architecture.

CS4395: Computer Graphics 8

Page 9: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Outline: Part 2

• Part 2: Basic OpenGL.

• Text: Chapter 2.

• Chapter topics:– Architecture.– GLUT.– Simple programs in two and three dimensions.– Basic shaders and GLSL.– Interaction.

CS4395: Computer Graphics 9

Page 10: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Outline: Part 3

• Part 3: Three-Dimensional Graphics.

• Text: Chapters 3-5.

• Chapter Topics:– Geometry.– Transformations.– Homogeneous Coordinates.– Viewing.– Lighting and Shading.

CS4395: Computer Graphics 10

Page 11: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Outline: Part 4

• Part 4: Implementation.

• Text: Chapter 6.

• Chapter topics:– Approaches (object vs. image space).– Implementing the pipeline.– Clipping.– Line drawing.– Polygon Fill.– Display issues (color).

CS4395: Computer Graphics 11

Page 12: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Outline: Part 5

• Part 5: Discrete Methods.

• Text: Chapter 7.

• Chapter topics:– Buffers.– Texture Mapping.– Shader Applications.– Compositing and Transparency.

CS4395: Computer Graphics 12

Page 13: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Outline: Part 6

• Part 6: Hierarchy and Procedural Methods.

• Text: Chapters 8-9.

• Chapter topics:– Tree Structured Models.– Traversal Methods.– Scene Graphs.– Particle Systems.

CS4395: Computer Graphics 13

Page 14: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Outline: Part 7

• Part 7: Curves and Surfaces.

• Text: Chapter 10.

CS4395: Computer Graphics 14

Page 15: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Outline: Part 8

• Part 8: Advanced Rendering.

• Text: Chapter 11.

• We are finally done!

CS4395: Computer Graphics 15

Page 16: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Extra Lectures

• Marching Squares.• Virtual Trackball.

• Environment Mapping.

• Shadows, fractals.• Display Issues.

• Bump Mapping, sampling and aliasing.

• Reflection and transmission.

CS4395: Computer Graphics 16

Page 17: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

What is Computer Graphics?

CS4395: Computer Graphics 17

Page 18: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Computer Graphics

• Computer graphics deals with all aspects of creating images with a computer:– Hardware.– Software.– Applications.

CS4395: Computer Graphics 18

Page 19: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Example

• Where did this image come from?

• What hardware/software did we need to produce it?

CS4395: Computer Graphics 19

Page 20: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Preliminary Answer

• Application: object is an artist’s rendition of the sun for an animation to be shown in a domed environment (planetarium).

• Software: Maya for modeling and rendering but Maya is built on top of OpenGL.

• Hardware: PC with graphics card for modeling and rendering.

CS4395: Computer Graphics 20

Page 21: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Basic Graphics System

CS4395: Computer Graphics 21

Input devicesOutput device

Image formed in frame buffer

Page 22: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

CRT

Can be used either as a line-drawing device (calligraphic) or to display contents of frame buffer (raster mode)

CS4395: Computer Graphics 22

Page 23: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Computer Graphics: 1950-1960

• Computer graphics goes back to earliest days of computing:– Strip charts.– Pen plotters.– Simple displays using A/D converters to go from computer to

calligraphic CRT.

• Cost of refresh for CRT too high:– Computers slow, expensive, unreliable (not anymore!).

CS4395: Computer Graphics 23

Page 24: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Computer Graphics: 1960-1970

• Wireframe graphics:– Draw only lines!

• Sketchpad.• Display Processors.• Storage tube.

CS4395: Computer Graphics 24

wireframe representationof sun object

Page 25: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Sketchpad

• Ivan Sutherland’s PhD thesis at MIT:– Recognized the potential of man-machine interaction.

– Loop:• Display something.• User moves light pen.• Computer generates new display.

– Sutherland also created many of the now common algorithms for computer graphics.

CS4395: Computer Graphics 25

Page 26: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Display Processor

• Rather than have the host computer try to refresh display, use a special purpose computer called a display processor (DPU).

• Graphics stored in display list/file on display processor.

• Host compiles display list and sends to DPU.

CS4395: Computer Graphics 26

Page 27: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Direct View Storage Tube

• Created by Tektronix:– Did not require constant refresh.

– Standard interface to computers:• Allowed for standard software.• Plot3D in Fortran.

– Relatively inexpensive:• Opened door to use of computer graphics for CAD community.

CS4395: Computer Graphics 27

Page 28: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Computer Graphics: 1970-1980

• Raster Graphics.

• Beginning of graphics standards.– IFIPS:

• GKS: European effort.– Becomes ISO 2D standard.

• Core: North American effort.– 3D but fails to become ISO standard.

• Workstations and PCs.

CS4395: Computer Graphics 28

Page 29: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Raster Graphics

• Image produced as an array (the raster) of picture elements (pixels) in the frame buffer.

CS4395: Computer Graphics 29

Page 30: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Raster Graphics

• Allows us to go from lines and wire frame images to filled polygons!

CS4395: Computer Graphics 30

Page 31: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

PCs and Workstations

• Although we no longer make the distinction between workstations and PCs, they evolved from different roots:

– Early workstations characterized by:• Networked connection: client-server model.• High-level of interactivity.

– Early PCs included frame buffer as part of user memory:• Easy to change contents and create images.

CS4395: Computer Graphics 31

Page 32: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Computer Graphics: 1980-1990

Realism comes to computer graphics

CS4395: Computer Graphics 32

smooth shading environment mapping

bump mapping

Page 33: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Computer Graphics: 1980-1990

• Special purpose hardware:– Silicon Graphics geometry engine: VLSI implementation of graphics

pipeline.

• Industry-based standards:– PHIGS.– RenderMan.

• Networked graphics: X Window System.• Human-Computer Interface (HCI).

CS4395: Computer Graphics 33

Page 34: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Computer Graphics: 1990-2000

• OpenGL API.

• Completely computer-generated feature-length movies (Toy Story) are successful.

• New hardware capabilities:– Texture mapping.– Blending.– Accumulation, stencil buffers.

CS4395: Computer Graphics 34

Page 35: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

Computer Graphics: 2000-

• Photorealism.

• Graphics cards for PCs dominate market: Nvidia, ATI.

• Game boxes and game players determine market direction.

• Computer graphics routine in movie industry: Maya, Lightwave.

• Programmable pipelines.

CS4395: Computer Graphics 35

Page 36: Introduction to Computer Graphics Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner CS4395: Computer Graphics 1

What next?

• Overview of image formation.

• Overview of graphics architectures.

CS4395: Computer Graphics 36