Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals...

37
Introduction to Computer Graphics Kadi Bouatouch IRISA Email: [email protected]

Transcript of Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals...

Page 1: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Introduction to Computer Graphics

Kadi Bouatouch IRISA

Email: [email protected]

Page 2: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

What is Computer Graphics?

Computer graphics deals with: – Geometric modeling: creating mathematical

models of 2D and 3D objects. – Rendering: producing images given these

models. – Animation: defining/representing time

dependent behavior of objects.

Page 3: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Applications •  Simulators (flight,

driving) •  Mechanical CAD

(Computer Aided Design)

•  Architectural visualization

•  Virtual reality Virtual reality

•  Advertising

Page 4: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Applications •  Computer games •  Special effects •  Computer art

Page 5: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Applications •  Education •  Scientific

visualization •  Medical

imaging

Page 6: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

What is Computer Graphics?

•  Computer graphics deals with: –  Geometric modeling : creating mathematical

models of 2D and 3D objects. –  Rendering: producing images given these

models. – Animation: defining/representing time

dependent behavior of objects.

Page 7: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Rendering Engine

Geometric Model

Appearance Model

Rendering Engine

Page 8: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Modeling

•  From a concept (or a real object) to a geometric model representable on a computer.

•  Example: a sphere can be described by four real numbers: (x,y,z,r).

•  Example: a polygon can be described by listing the coordinates of its vertices.

Page 9: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Modeling

How to represent more complex shapes? •  Polygon meshes: a large collection of

polygonal facets, connected with each other.

•  Free Free-form surfaces: using low-degree polynomial functions.

•  CSG: construct a shape by applying boolean operations on primitive shapes.

Page 10: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

LS=list of vertices LS = {P0, P1, P2, P3} F1 = (LS [0], LS [1], LS [2]) F2 = (LS [0], LS [2], LS [3]) F3 = (LS [3], LS [1], LS [0]) F4 = (LS [3], LS [2], LS [1]) Fi = Facet i Object = {F1, F2, F3, F4}

Modeling: polygonal facets

•  Facets sharing vertices •  Avoids data duplication

P0

P1

P2

P3

Page 11: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Huge models :

700,000 13 million

82 million 372,422,615

Page 12: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Modeling: Sweeping, revolution

•  Extrusion

•  Revolution

Page 13: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

CSG Objects •  Description of complex shapes

•  Definition

– Object = set of points – Object = sphere, cylinder, cone, box, … – Object = Obj1 bop Obj2 – bop = union, intersection, difference

Page 14: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Modeling: CSG examples

•  Union

•  Intersection

•  Difference

Page 15: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Modeling: CSG examples

•  Binary tree :

-

+

Page 16: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Modeling: Parametric Surfaces

•  Free form curves and surfaces

•  Defined with control points

Page 17: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Modeling: Parametric Surfaces

Tensor product of parametric curves, functions of u and v. Q (u, v) = Σij Bi(u) Bj(v) Vij

u

v

Page 18: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Surfaces splines

Page 19: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Rendering

•  Given a scene and viewing parameters, produce an image = a 2D array of pixels.

Page 20: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Rendering

Important sub-tasks: •  Scan conversion: Which pixels in the

image are covered by each object? •  Visible surface algorithms: What is visible

at each pixel of the image? •  Illumination and shading: What color

should be assigned to each pixel?

Page 21: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Animation

•  How to define complex time-dependent behavior of objects?

•  Examples: – Automatic inbetweening (interpolation key-

frames). •  Physically-based simulation.

Page 22: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Surface Appearance

•  Surface: Appearance –  What are the properties of material? –  How the surface reacts to light? –  In what direction and what part of the spectra

is it reflecting? –  Is it fuzzy? –  Is the surface bumped like metal? –  etc.

Page 23: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Summary •  How the image is created?

– Put objects into the memory – Assign appearance and/or textures to their

surfaces – Assign lights – Position camera(s) – Run the illumination algorithm: different

techniques (scan conversion, ray tracing) – Display images

Page 24: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Context

•  Image Processing: from images to images •  Computer Vision: from images to models •  Computer Graphics: from models to

images

Page 25: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Examples of different effects

The scene we are trying to represent:

Images courtesy of Picture Inc.

Page 26: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Wireframe model – Orthographic views

Page 27: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Perspective View

Page 28: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Depth Cue

Page 29: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Hidden Line Removal – add colour

Page 30: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Constant Shading - Ambient

Page 31: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Faceted Shading - Flat

Page 32: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Gouraud shading, no specular highlights

Page 33: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Specular highlights added

Page 34: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Phong shading

Page 35: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Texture mapping

Page 36: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Texture mapping

Page 37: Introduction to Computer Graphics - IRISAWhat is Computer Graphics? • Computer graphics deals with: – Geometric modeling : creating mathematical models of 2D and 3D objects. –

Reflections, shadows & Bump mapping