Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer...

56
Computer Graphics Introduction Taku Komura

Transcript of Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer...

Page 1: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Computer Graphics

Introduction

Taku Komura

Page 2: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

What’s this course all about?

Lecture 1

We will cover…

Graphics programming and algorithms Graphics data structures Applied geometry, modeling and rendering Not covering : how to use software like Maya, 3D Studio Max, etc.

Page 3: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Other important thing:

• You need to know about math

• We will use basic linear algebra

– Dot product, cross product, matrix calculations

– Basic calculus, solving linear systems

• Please don’t take the course if you don’t like

math

Page 4: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Outline for Today • Classic streams of computer graphics

• Application areas of computer graphics

• Overview of the course • Topics in the graphics pipeline • Other topics

• Some terms

Page 5: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Classic streams of computer graphics

• 2D/3D modeling (aircraft, car manufacturing)

• Interactive applications (computer games, design)

• Realistic rendering (Lots of work at University of Utah)

• Computer art (many people)

Page 6: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

2D / 3D modeling

• Designing curved surfaces was important for car

and aircraft manufacturers in the old days

• Such modeling requires a lot of mathematics

• Lots of mathematicians join the graphics research

community nowadays too

Page 7: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Interactive applications

• Sketchpad (1958, Ivan Sutherland)

• Head mount display (1968, Ivan

Sutherland)

• Tennis game (1958), Space war (1962)

Page 8: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Realistic Rendering

(University of Utah) Gouraud shading (Gouraud, 1971)

Phong shading (Phong, 1975)

Phong illumination model (Phong 1973)

Page 9: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Realistic Rendering

(University of Utah)

• Bump mapping (1978)

– Jim Blinn

• Subdivision surface

(Catmull, Clark 1978)

Page 10: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Computer Art (1967-)

Page 11: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

The Application Areas of Computer Graphics

? ? ? ? ? ?

Page 12: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

The Application Areas of Computer Graphics

Computer Animation Computer Games Virtual Reality Computer Aided Design Scientific Visualization Human Computer Interactions

Page 13: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Computer Graphics is about animation (films)

Lecture 1

Major driving force now

Page 14: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

What are the Challenges? • Realistic Lighting and Reflections:

• Need to make the lighting condition appear like real

• Need to make objects reflect the light realistically

• Physical simulations: • Fluids (liquid, fire), rigid bodies

• Realistic movements of the faces, bodies, etc. • Need to make the imaginary characters

appear as if they are really in the environment

Page 15: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Realistic Lighting and Reflections:

• Need to make the lighting condition appear

like real • Need to make objects reflect the light

realistically (modeling the reflection model)

Page 16: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Physical Simulation

• Fluids (liquid, fire), deformable objects (cloth) rigid bodies

Page 17: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Games are very important in Computer Graphics

Lecture 1

Page 18: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

What are the Challenges? • Everything altogether must run in real-time (30 frames per second) • Rendering (drawing the scene) • character control (player characters + non player

characters) • Physical simulation (object collision, deformations) • user input

Page 19: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

User Input • Recognizing the action from the sensor

data, selecting the appropriate action to launch

Page 20: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Character Control

• Controlling the NPCs intelligently • For the PC, launching an action that

satisfies the user requirement

Page 21: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Virtual Reality, Medical Imaging is another driving force

Lecture 1

Page 22: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Computer Aided Design, 3D modelling

Lecture 1

Page 23: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

3D modelling

Modelling a cup by Maya http://vimeo.com/5423236

Page 24: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Scientific Visualisation

Lecture 1

To view below and above our visual range

Page 25: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

What are the challenges?

• Converting the numbers into something that easy to understand

• Making use of human's visual perception

Page 26: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Volume rendering

Page 27: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Human Computer Interactions

• Sketch-based interfaces • Story telling, puppetry • Design

Page 28: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Overview of the Course

• Graphics Pipeline (Today) o Object representatioins o 3D transformations o (Local lighting effects) Illumination, lighting,

shading, mirroring, shadowing o Hidden surface removal o Rasterization o Ray tracing

• Global illumination • Curves and Surfaces

Lecture 1

Page 29: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Graphics Pipeline

• Graphics processes generally execute sequentially

• Pipelining the process means dividing it into stages

• Especially when rendering in real-time, different hardware resources are assigned for each stage

19/09/11 Lecture 1

Page 30: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Graphics Pipeline

• There are three stages o Application Stage o Geometry Stage o Rasterization Stage

Lecture 1

Page 31: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Application stage • Entirely done in software by the CPU • Load Data

o the world geometry database, o User’s input by mice, trackballs, trackers, or

sensing gloves

• In response to the user’s input, the application stage change the view or scene

19/09/11 Lecture 1

Page 32: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Geometry Stage

• Applying transformations to the object vertices (scaling, rotating, translating)

• View transformation (viewing from the camera)

• Illumination and shading (for Gouraud shading)

Page 33: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Rasterization Stage

• Converting the continuous representation (curves

and lines) into the discrete representation (pixels)

• Anti-aliasing

• Texture mapping

• Bump mapping

• Illumination and shading (for Phong shading)

Page 34: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

An example thro’ the pipeline…

Lecture 1

The scene we are trying to represent:

Images courtesy of Picture Inc.

Page 35: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Preparing Shape Models (Lecture 2)

Lecture 1

Designed by polygons, parametric curves/surfaces, implicit surfaces and etc.

Defined in its own coordinate system

Page 36: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Model Transformation (Lecture 3)

19/09/11 Lecture 1

• Objects put into the scene by applying translation, scaling and rotation

• Linear transformation called homogeneous transformation is used

• The location of all the vertices are updated by this transformation

Page 37: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Perspective Projection (Lecture 4)

Lecture 1

• We want to create a picture of the scene viewed from the camera

• We apply a perspective transformation to convert the 3D coordinates to 2D coordinates of the screen

• Objects far away appear smaller, closer objects appear bigger

Page 38: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Hidden Surface Removal (Lecture 7)

Lecture 1

• Objects occluded by other objects must not be drawn

Page 39: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Shading and Lighting (Lecture 6)

Lecture 1

• Now we need to decide the colour of each pixels taking into account the object’s colour, lighting condition and the camera position

Object

point light source

Page 40: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Shading : Constant Shading - Ambient

Lecture 1

• Objects colours by its own colour

Page 41: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Shading – Flat Shading

Lecture 1

• Objects coloured based on its own colour and the lighting condition

• One colour for one face

Page 42: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Gouraud shading, no specular highlights

19/09/11 Lecture 1

• Lighting calculation per vertex

Page 43: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Specular high lights added

Lecture 1

Page 44: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Rasterization (Lecture 5) • Converts the vertex information output

by the geometry pipeline into pixel information needed by the video display

• Aliasing: distortion artifacts produced when representing a high-resolution signal at a lower resolution.

• Anti-aliasing : technique to remove aliasing

Lecture 1

Page 45: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Anti-aliasing

Lecture 1

Aliased polygons (jagged edges)

Anti-aliased polygons

Page 46: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Lecture 1

• How is anti-aliasing done? Each pixel is subdivided

(sub-sampled) in n regions, and each sub-pixel has a color; • Compute the average color value

Page 47: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Texture mapping (Lecture 8)

Lecture 1

Page 48: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Other effects: Bump mapping (Lecture 9)

Reflections(Lecture 10), shadows (Lecture 11)

Lecture 1

Page 49: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Other covered topics: Global Illumination (Lecture 12,13)

Lecture 1

Page 50: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Other covered topics:

Polynomial Curves, Surfaces (Lecture 14,15)

Page 51: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Graphics Definitions

• Point o a location in space, 2D or 3D o sometimes denotes one pixel

• Line o straight path connecting two points o infinitesimal width, consistent density o beginning and end on points

Lecture 1

Page 52: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Graphics Definitions • Vertex

o point in 3D

• Edge o line in 3D connecting two vertices

• Polygon/Face/Facet o arbitrary shape formed by connected vertices o fundamental unit of 3D computer graphics

• Mesh • set of connected polygons forming a surface

(or object)

Lecture 1

Page 53: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Graphics Definitions

• Rendering : process of generating an image from the model

• Framebuffer, colorbuffer : a video output device that drives a video display from a memory containing the color for every pixel

• Fragment : a surface area that corresponds to a pixel

Lecture 1

Page 54: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Course support resources

• Graphics course website • http://www.inf.ed.ac.uk/teaching/course

s/cg o lecture material, o recommended reading, o Links to support material for lectures and projects, o Practical description and resources

Lecture 1

Page 55: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Summary

• The course is about algorithms, not applications o Lots of mathematics

• Graphics have many applications • Graphics execution is a pipelined

approach • Basic definitions presented • Some support resources indicated

Lecture 1

Page 56: Computer Graphics Introduction · Text books •Foley, van Dam, Feiner and Hughes, Computer Graphics--Principles and Practice, 2nd ed., Prentice Hall 1997 . (some topics are outdated)

Text books

• Foley, van Dam, Feiner and Hughes, Computer

Graphics--Principles and Practice, 2nd ed.,

Prentice Hall 1997 . (some topics are outdated)

• Tomas Akenine-Moller, Eric Haines Real-time

Rendering, 2nd ed. , A K Peters 2002 or 3rd ed.

2008

• The Cg tutorial

http://http.developer.nvidia.com/CgTutorial/cg_t

utorial_chapter01.html

• Others shown in the course website