slides part 1

45
1 7M836 Animation & Rendering Introduction, color, raster graphics, modeling, transformations Arjan Kok, Kees Huizing, Huub van de Wetering [email protected]

Upload: buinga

Post on 01-Jan-2017

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: slides part 1

1

7M836 Animation & Rendering

Introduction, color, raster graphics, modeling, transformations

Arjan Kok, Kees Huizing, Huub van de Wetering

[email protected]

Page 2: slides part 1

2

Purpose Understand 3D computer graphics principles

• Terminology• Basic algorithms• Complexity

Get better results using modern animation and rendering packages

Page 3: slides part 1

3

7M836

Lectures Exercises Assignments

http://www.ds.arch.tue.nl/7M836/

Page 4: slides part 1

4

Contents

1. IntroductionComputer graphics, color, raster graphics, graphics pipeline, geometric modeling, transformation.

2. Viewing and visible surface determinationViewing, clipping, projection, visible surface determination

3. Illumination and shadingLight sources, reflection, shading

4. Ray tracing

Page 5: slides part 1

5

Contents

5. Radiosity

6. Mapping techniquesTexture mapping, bump mapping, environment mapping, aliasing

7. AnimationAnimation process, keyframe animation, forward and inverse kinematics

8. Examples and virtual reality

Page 6: slides part 1

6

Literature

Computer Graphics – Principles and Practice(second edition)Foley, van Dam, Feiner, Hughes

3D Computer GraphicsA. Watt

Advanced Animation and Rendering Techniques:Theory and PracticeA. Watt, M. Watt

3D Graphics : A Visual ApproachR.J. Wolfe

and many more

Page 7: slides part 1

7

Computer graphics

ImageMathematical

Model

Image Analysis(pattern recognition)

Image Synthesis(rendering)

Modeling Image processing

Page 8: slides part 1

8

Supporting disciplines

Computer science• algorithms, data structures, software engineering,

… Mathematics

• geometry, numerical, … Physics

• optics, mechanics, … Psychology

• color, perception Art and design

Page 9: slides part 1

9

Color models

RGB red, green, blue HSV hue, saturation, value

Page 10: slides part 1

10

RGB-model

3 primary colors: red, green, and blue Color cube:

• Color = point in cube Additive:

• C = r R + g G + b B

R

G

B

Page 11: slides part 1

11

HSV-model

More user oriented: based on intuitive perception• Hue: tint (0-360°)• Saturation: shade (0-1)• Value: brightness (0-1)

Color is point in cone

Page 12: slides part 1

12

Color models

Limitation of color models, such as HSV and RGB:• No linear relation with perception.

At some places in RGB cube a small step results in a visual change, while at other places it does not.

• Color models describe the colors a monitor can display. That is only a subset of what a human can see.

Page 13: slides part 1

13

Computer graphics

Vector graphics• Image is represented by continuous geometric

objects: lines, curves, etc• Exact, scalable• Diagrams, schemes, ...• Examples: PowerPoint, CorelDraw, ...

Raster graphics• Image is represented as an rectangular grid of

(coloured) squares• Examples: Paint, PhotoShop, ...

Page 14: slides part 1

14

Raster graphics

Currently “standard” for computer graphics Screen is subdivided in grid of “squares”: picture

elements or pixels Per pixel: n bits information Resolution: size of grid and number of bits per pixel

Page 15: slides part 1

15

Raster graphics hardware

system bus

system memory

CPUdisplay processor

video controller

0 0 0 0 0 0 0 0

0 0 1 0 0 0 1 0

0 1 1 1 0 1 0 1

0 1 1 1 0 0 1 0

0 1 1 1 0 0 1 0

0 0 0 0 0 0 1 0

frame buffermonitor

Page 16: slides part 1

16

Raster display – 1 bit per pixel

0 = black, 1 = white

pixel

0 0 1

640

480

0 1 0

Page 17: slides part 1

17

Raster display – 8 bits / pixel

256 gray values 0 (black) to 255 (white)

0 200 128

64 255 255

Page 18: slides part 1

18

0 – 255: index in color lookup table Color lookup table contains 256 colors chosen from

16 million colors

0 1 2

3 255 255

code red green blue0 0 0 01 255 0 02 255 255 03 128 128 128... ... ... ...255 255 255 255

Raster display – 8 bits / pixel

Page 19: slides part 1

19

Raster display – 24 bits / pixel

Per pixel: red, green, and blue 16 million colors at the same time True color

red

green

blue

128,128,128

Page 20: slides part 1

20

File formats Number of colors Size

(uncompressed)

1-bit 2 black/white 37.5 kb

8-bit 256 gray values 256 color values (CLUT)

307.2 kb GIF, (PNG)

24-bit 256x256x256 colors 921.6 kb BMP, TGA, TIFF, JPEG

32-bit 256x256x256 colors 8 bits alpha plane

1228.8 kb TGA

Vector EPS, PS

Page 21: slides part 1

21

File formats

File format conversion tool: Irfanview

Content image / purpose Format

Many colors; continuous variation in colors (photo’s) Storage

TIFF, TGA, BMP, PPM

Many colors; continuous variation in colors (photo’s) Presentation

JPEG

Limited number of colors GIF, PNG

Line drawings PS, EPS

Page 22: slides part 1

22

Graphics Software

Special-purpose packages• Photoshop, Powerpoint, AutoCAD, 3D Studio,

Maya, ..

Computer-graphics application programming interfaces (CG API)• Set of graphics functions used from programming

language• Access to hardware• OpenGL, Direct3D, VRML, Java3D, ..

Page 23: slides part 1

23

Rendering

How do I generate a realistic image of a scene? Problems:

• World is complex (shape, light, ...)• World is 3 dimensional, screen is 2 dimensional• ...

Page 24: slides part 1

24

Problem subdivision

Geometric modeling• How do we define the shape of an object?

Projection and hidden surface removal• How do we determine what is visible on screen

and what is not? Shading

• How do we model color, texture, and contribution of light?

Rasterization• How do we determine pixel values ?

Page 25: slides part 1

25

Graphics pipeline

Geometric model Viewing

Camera parameters

Light sources,materials

Shading

Visible surface determination

Rasterization

Raster display

Page 26: slides part 1

26

Geometric modeling

World contains all kind of objects• Trees, humans, buildings, clouds, mountains,

waves, fire, plants, …

Describe objects in a way that • (user) input is easy • processing is easy • display is easy

“easy” means: simple things easy,

complex things possible.

Page 27: slides part 1

27

Geometric modeling

Examples• Wireframe• Procedural• Polygons• Constructive solid geometry• Curved surfaces• Ad hoc techniques

Page 28: slides part 1

28

Wireframe

Model is sequence of lines connecting points No information on surface/faces available,

therefore• No visibility information• no shaded images possible

Face information cannot be deduced automatically

Page 29: slides part 1

29

Wireframe

Page 30: slides part 1

30

Procedural

Shape defined by type and parameters Program interprets definition Examples

• Type = sphere, position = [3, 4, 5], radius = 2• Type = oak, age = 10 years

Compact, easy input, tailored to application Often internal conversion to other representation

We will use this in the exercises with PovRay.

Page 31: slides part 1

31

Polygons

Polygon consists of three or more points lying in a plane (often triangle)

Model is collection of polygons Input and change of model is laborious Very well suited for hardware Often used as end representation

Page 32: slides part 1

32

Polygons

Page 33: slides part 1

33

Constructive solid geometry

Model is defined by hierarchy of Boolean operations on standard shapes, such as cube, sphere, cylinder, cone, and torus

Boolean operations• union, difference, intersection

Useful for input, e.g. in mechanical engineering Often, conversion to other representation needed

before model is rendered

Page 34: slides part 1

34

Constructive solid geometry

Page 35: slides part 1

35

Curved surfaces

Smooth curve defined by sequence of control points

p1

p2

p3

p4

p t =1−t 3 p03 1−t 2 t p13 1−t t2 p2t3 p3

Page 36: slides part 1

36

Curved surfaces

Smooth surface defined by grid of control points• Bézier surfaces• NURBS• ..

Page 37: slides part 1

37

The Utah teapot

Page 38: slides part 1

38

Curved surfaces

Very useful for modeling, e.g. in car industry, but also in cartoon animation

Often conversion to other representation (polygons) before model can be rendered

Page 39: slides part 1

39

Ad hoc techniques

Mountain shapes: wrinkled shapes (fractals) Firework: particles Plants: Lindenmayer systems Hair and fur Fabric en clothing Clouds …

Page 40: slides part 1

40

Geometric modeling

Input: Computer Aided Design (CAD) system

Convenient for input:• Curved surfaces, CSG, procedural

representations

Appropriate for computer processing/display:• Polygons, points, lines

Page 41: slides part 1

41

Modeling-transformations

Besides shape, position, orientation, and scale of objects in a scene is important

Often, model consists of several parts that are positioned relatively to each other

Page 42: slides part 1

42

Coordinate systems

wheel

train

world

Page 43: slides part 1

43

Modeling-transformations

Complete model (scene) specified in world coordinates

Objects within model specified in object coordinates Transformation positions object into world

Object may contain sub-objects that are specified in their own local coordinates

Transformation positions sub-object into object

Hierarchical model

Page 44: slides part 1

44

Example

World contains (for instance) human figure Human figure is built from:

• torso + head + arm + arm + leg + leg + .. Arm is built from:

• upper arm + lower arm + hand + .. Etc.

Page 45: slides part 1

45

Graphics pipeline

Geometric model Viewing

Camera parameters

Light sources,materials

Shading

Visible surface determination

Rasterizaton

Raster display