48
CG-IDC 1 Computer Graphics Instructor: Oren Kapah ([email protected]) Office Hours: T.B.A. The slides for this course were created by Toky & Hagit Hel-Or

Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

  • Upload
    others

  • View
    18

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 1

Computer Graphics

• Instructor: Oren Kapah

([email protected])

• Office Hours: T.B.A.

The slides for this course were created by Toky & Hagit Hel-Or

Page 2: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 2

Page 3: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 3

Exercise and Homework

• The exercise will cover practical

aspects of the material taught in class.

• OpenGL will be covered in the

exercise.

• Homework will be written in OpenGL

and Java

• Homework may be submitted in pairs

(No triplets).

• In general - two weeks due date.

• No exercise this week.

Page 4: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 4

Grading Policy:

• 50% homework assignments+50% exam.

• Homework assignments are weighted.

• Exam will include class and exercise

material.

• Homework appeals can be submitted no

later than one week after they’re returned!

IMPORTANT!

You must pass the exam in order to pass

the course.

Page 5: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 5

Course Web site:

• Lessons (PDF format).

• Homework.

• Handouts and program examples.

• Grades.

• News.

• Mailing Group

Page 6: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 6

Books

Computer Graphics

Hearn and Baker

Second Edition, Prentice Hall, 1994.

Computer Graphics Principles and Practice,

Foley, Van Dam, Feiner, and Hughes

Second Edition, Addison Wesley, 1996.

Mathematical Elements for Computer

Graphics

Rogers and Adams

Second edition, McGraw-Hill, 1990.

• OpenGL SuperBible

S. Richard, JR Wright, M. Sweet

Waite Group Press

Page 7: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 7

Goals:

• Implementing Practical Math.

• Getting acquainted with

graphical models, basic

techniques, and algorithms.

• Getting acquainted with a

Graphical Language (OpenGL).

Page 8: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 8

The Visual Sciences

Computer

Vision

Rendering

ImageImage

Processing

Model

3D Object

Geometric

Modeling

Page 9: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 9

Context

• Image Processing: images => images

• Computer Vision: images => models

• Computer Graphics:

– Geometric Modeling: object => models

– 3D-rendering: 2D/3D models =>images

– Animation: 4D models => images.

Page 10: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 10

Applications

• CAD - Computer Aided Design (mechanical,

architectural)

• Simulators (flight, driving)

• Architectural visualization

• Advertising

• Virtual Reality

• Art

• Games

• Special effects

• Education

• Scientific visualization

Page 11: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 11

Tin Toy – Pixar 1988

Page 12: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 12

Rendered image

Page 13: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 13

Rendered image

Lighting

Geometry

Viewing

Material properties

&Texture

Page 14: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 14

Reality – Non realistic rendering

Page 15: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 15

Photo-realistic rendering

Page 16: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 16

Non-realistic rendering

Pensive - 2000

Page 17: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 17

Illumination & Color Models. object’s surfaces physical properties

Solid modelingObject’s Geometrical properties

Objects:

Camera:

Projections

Light Source:

Color

theory

Spatial set-up:

3D transformations,

Coordinate Systems.

Y

XZ

Y

Viewing Factors

Page 18: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 18

Scope and Course Flow:

• 2D Drawing.

• Vector analysis.

• 2D transformations.

• 2D viewing.

• 3D transformations.

• 3D Modeling.

• 3D viewing

• Color Models.

• Shading Models.

Page 19: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 19

Drawing in 2D

Goal: Getting acquainted with images.

• Displays types (raster vs. vector).

• Basic image definitions:

– Pixel, Resolution, dynamic range…

• Scan conversion:

– Techniques for Line drawing

– Techniques for drawing circles.

– Fill polygons.

Page 20: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 20

Vector Analysis

Goal: Refreshing Linear Algebra basics.

• Mathematical entities:

– Scalar, Points, Vectors.

• Fundamental operations:

– point+vector, vector+vector,

vector*scalar, dot product, cross product,

etc.

• Vector representation - the basis.

• Point representation - the frame.

Page 21: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 21

Transformations in 2D

Goal: Introduction to 3D.

• Basic 2D transformations:

– Translation, Scaling, Rotation, Shear.

• Composition of transformations and

transformation groups:

Rigid

Affine

Similarity

Page 22: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 22

• Transformations in Matrix notation:

• Composition of transformations in

matrix notation.

• The homogeneous coordinates in 2D:

• Change of coordinates:

y

x

dc

ba

y

x

'

'

x

y

x’y’

),,(),,(),( ttytxWYXyx

Page 23: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 23

Viewing in 2D

Goal: Preperation to 3D and some

rendering concepts.

• Viewing transformation pipe-line:

• Line and Polygon Clipping techniques:

x world

y world

Clipping

Page 24: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 24

Transformations in 3D

Goal: Geometrical transformations to be

used in viewing pipe-line.

• Similar to 2D but in 3D.

Page 25: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 25

Viewing in 3D

Goal: Geometrical transformations in

viewing pipe-line.

• From Model coordinates to Viewer

coordinates.

yw

zw

xw

world

P0

xv

yv

zvViewer

System

Body

System

Front-

Wheel

System

Page 26: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 26

• Projections:

– Orthographic.

– Oblique.

– Perspective.

• The Viewing Volume:

zv

far

near

yv

xv

Page 27: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 27

Solid Modeling

Goal: Learn how to define solid objects.

• 1D Curves in 3D

– Primitive based: line segments.

– Free form:

• Implicit, Explicit, Parametric (polynomials,

splines)

• 2D Surfaces in 3D

– Primitive Based: Polygon mesh.

– Free Form: As above

Page 28: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 28

• 3D volumes in 3D

– Volume Rep.

• Sweep volumes

• Spatial Occupancy(voxels, Octree, BSP)

• Constructive Solid Geometry

– Boundary Rep.

• Polyhedra

• Free form: as above

Page 29: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 29

Approximated/Interpolated

Parametric Surfaces

• Bilinear interpolation.

• Splines:

– Cardinal spline.

– Hermite spline.

– Bezier Spline.

– B spline.

Page 30: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 30

y

x

650

610

590

550

570

600

580

560

540

505

500

510

520530

490

495

485

480

470450

1.00.50.0

0.5

0.9

green

yellow-green

yellow

orange

red

magenta

purple

blue

cyan white

pink

Goal: Understanding what a color is.

• The Trichromatic Color Theory.

• Linear color space and color

representations: RGB, CMY,HSB.

• Perceptual color spaces: LAB,YIQ.

• The CIE Chromaticity Diagram.

Color Theory

R

G

B

Brightness

Hue

Page 31: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 31

Illumination Models &

ShadingGoal: Understanding the physical properties of

an object.

• Light source parameters (shape,

position, color, intensity).

• Surface parameters: Ambient, diffuse,

specular.

• Polygon Rendering methods.

• Transparency.

• Shadow.

Page 32: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 32

Ambient, Diffuse, and

Specular components

Page 33: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

Composition of Light

Sources

Page 34: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,
SHADOW.EXE
Page 35: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 35

Image based lighting - 2000

Page 36: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 36

Example: A Sequence of creating

an images from a given model.

(from Foley Van Dam)

Page 37: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 37

Polygonal model generated from spline patches.

Orthographic projection

Polygonal model generated from spline patches.

Perspective projection

Page 38: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 38

Depth cueing.

Page 39: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 39

Colored vectors.

Depth Clipping

Page 40: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 40

Hidden line removal

Visible surface determination with ambient illumination

Page 41: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 41

Individually shaded polygon with diffuse reflection

Gouraud shaded polygon with diffuse reflection

Page 42: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 42

Gouraud shaded polygon with specular reflection

Phong shaded polygon with specular reflection

Page 43: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 43

Curved surfaces with specular reflection

multiple lights

Page 44: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 44

Texture mapping

shadows

Page 45: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 45

Final image

Page 46: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 46

Pixar 1986 – best of Siggraph 1986

Page 47: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 47

Real time – off line rendering

Page 48: Computer Graphics - BIUu.cs.biu.ac.il/~kapaho/CG/01_Intro.pdfComputer Graphics Hearn and Baker Second Edition, Prentice Hall, 1994. Computer Graphics Principles and Practice, Foley,

CG-IDC 48