Visualisatie BMT Rendering Arjan Kok a.j.f.kok@tue.nl 1 Lecture - - PowerPoint PPT Presentation

visualisatie
SMART_READER_LITE
LIVE PREVIEW

Visualisatie BMT Rendering Arjan Kok a.j.f.kok@tue.nl 1 Lecture - - PowerPoint PPT Presentation

Visualisatie BMT Rendering Arjan Kok a.j.f.kok@tue.nl 1 Lecture overview Color Rendering Illumination 2 Visualization pipeline Raw Data Data Enrichment/Enhancement Derived Data Visualization Mapping Abstract Visualization


slide-1
SLIDE 1

1

Visualisatie

BMT

Rendering Arjan Kok a.j.f.kok@tue.nl

slide-2
SLIDE 2

2

Lecture overview

  • Color
  • Rendering
  • Illumination
slide-3
SLIDE 3

3

Visualization pipeline

Raw Data Derived Data Abstract Visualization Object Displayable Image Data Enrichment/Enhancement Visualization Mapping Rendering

slide-4
SLIDE 4

4

Color

  • The electromagnetic spectrum

visible to humans contains wavelengths ranging from about 400 to 700 nm

  • Light we see consists of

different intensities of these wavelengths

slide-5
SLIDE 5

5

Color

  • The human eye contains three

receptors (cones): for red, green and blue

  • Color we see is a combination
  • f these

Response curves

slide-6
SLIDE 6

6

Color systems

  • Color system
  • A way to represent color on a computer
  • Most used:
  • RGB
  • HSV
slide-7
SLIDE 7

7

RGB-model

  • 3 primary colors: Red, Green and Blue
  • Color cube:
  • Color = point in cube
  • Additive:
  • C = rR + gG + bB

R G B

slide-8
SLIDE 8

8

HSV-model

  • More user oriented: based on

intuitive perception

  • Hue (0-1 or 0-360°)
  • Saturation (0-1)
  • Value (0-1)
  • Color is point in cone
slide-9
SLIDE 9

9

Rendering

  • How do I generate an image of a scene?
  • Problems:
  • World is complex (shape, light)
  • World is 3 dimensional, screen is 2 dimensional
slide-10
SLIDE 10

10

Subdivide problem

  • Geometric modeling
  • How do we define shape of objects?
  • 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
  • Determine pixel values for visible objects
slide-11
SLIDE 11

11

Graphics pipeline

Geometric model Viewing Camera parameters Light sources, materials Shading Visible surface determination Rasterize Raster display

slide-12
SLIDE 12

12

Raster graphics

  • Currently “standard” for computer graphics
  • Screen is subdivided in grid of “squares”: picture elements
  • r pixels
  • Per pixel: n bits information
  • Resolution: size of grid and number of bits per pixel
slide-13
SLIDE 13

13

Raster graphics hardware

system bus system memory CPU display processor video controller

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

frame buffer monitor

slide-14
SLIDE 14

14

Visualization pipeline

Raw Data Derived Data Abstract Visualization Object Displayable Image Data Enrichment/Enhancement Visualization Mapping Rendering

slide-15
SLIDE 15

15

Graphics pipeline

Geometric model Viewing Camera parameters Light sources, materials Shading Visible surface determination Rasterize Raster display

slide-16
SLIDE 16

16

Viewing

  • Given a 3D model, how do we project this model on screen?
  • Camera model
  • Eye/view point:
  • From which point do we look to the scene?
  • Target point or viewing direction:
  • Where do we look at?
  • Viewing angles:
  • What lens do we use?
slide-17
SLIDE 17

17

The camera

slide-18
SLIDE 18

18

Graphics pipeline

Geometric model Viewing Camera parameters Light sources, materials Shading Visible surface determination Rasterize Raster display

slide-19
SLIDE 19

19

Why illumination

slide-20
SLIDE 20

20

Illumination

  • Illumination model
  • Illumination (and therefore color) of point on surface is

determined by simulation of light in scene

  • Illumination model is approximation of real light

transport

  • Shading method
  • determines for which points illumination is computed
  • determines how illumination for other points is

computed

slide-21
SLIDE 21

21

Illumination models

  • Model(s) needed for
  • Emission of light
  • Scattering light at surfaces
  • Reception on camera
  • Desired model requirement
  • Accurate
  • Efficient to compute
slide-22
SLIDE 22

22

Point light source

  • Emits light equally in all directions
  • Parameters
  • Intensity IL
  • Position P (px,py,pz)
  • Approximation for small light sources

P

slide-23
SLIDE 23

23

Direction light source

  • Emits light in one direction
  • Can be regarded as point light source at infinity
  • E.g. sun
  • Parameters
  • Intensity IL
  • Direction D (dx,dy,dz)

D

slide-24
SLIDE 24

24

Surface illumination

  • When light arrives at surface, it can be
  • Absorbed
  • Reflected
  • Transmitted

reflection transmission absorption

slide-25
SLIDE 25

25

Reflection model

  • Total intensity on point reflected in certain direction is

determined by:

  • Diffusely reflected light
  • Specularly reflected light
  • Reflection of ambient light
slide-26
SLIDE 26

26

Diffuse reflection

  • Incoming light is reflected equally in all directions
  • Amount of reflected light depends only on angle of incident

light viewer surface

slide-27
SLIDE 27

27

Diffuse reflection

  • Lambert’ law: Reflected energy from a surface is

proportional to the cosine of the angle of direction of incoming light and normal of surface

  • Id = kdILcos(θ) = kdIL (N•L)
  • kd is diffuse reflection coefficient

θ viewer surface

N L V

slide-28
SLIDE 28

28

Specular reflection

  • Models reflections of shiny surfaces

θ θ

slide-29
SLIDE 29

29

Specular reflection

  • Shininess depends on roughness surface
  • Incident light is reflected unequally in all directions
  • Reflection strongest near mirror angle

very shiny less shiny

slide-30
SLIDE 30

30

Specular reflection / Phong

  • Light intensity observed by viewer depends on angle of

incident light and angle to viewer

  • Phong model: Is = ksILcosn(α) = ksIL (V•R)n
  • ks is specular reflection coefficient
  • n is specular reflection exponent

θ θ

α L R N V

slide-31
SLIDE 31

31

Specular reflection / Phong

increasing n increasing ks

slide-32
SLIDE 32

32

Ambient light

  • Even though parts of scene are not directly lit by light

sources, they can still be visible

  • Because of indirect illumination
slide-33
SLIDE 33

33

Ambient light

  • “Ambient” light IA is an approach to this indirect

illumination

  • Ambient light is independent of light sources and viewer

position

  • Contribution of ambient light I = kaIa
  • ka is ambient reflection coefficient
  • Ia is ambient light intensity (constant over scene)
slide-34
SLIDE 34

34

Total illumination model

  • Total intensity Itotal at point P seen by viewer is

( )

α + θ + =

i i n s i d i a a total

) ( cos k ) cos( k I I k I

α0 θ0 θ1 α1

( )

⋅ + ⋅ + =

i n i s i d i a a total

) R V ( k ) L N ( k I I k I

slide-35
SLIDE 35

35

Total illumination model

  • In previous formula ka, kd dependent on wavelength

(different values for R, G and B)

  • Often division into color and reflection coefficient of

surface where:

  • 0 ≤ ka, ks, ks ≤ 1 (relative amounts)
  • Ca is ambient reflected color of surface
  • Cd is diffuse reflected color of surface
  • Cs is specular reflected color of surface

( ) ( )

( ) ∑ α + θ + + =

i i n s s i d d i a a a e totaal

cos C k cos C k I I C k I I

slide-36
SLIDE 36

36

Only emission and ambient

slide-37
SLIDE 37

37

Including diffuse reflection

slide-38
SLIDE 38

38

Including specular reflection

slide-39
SLIDE 39

39

Illumination model

  • Given model:
  • Simple
  • Effective
  • Not real world
  • More advanced models possible
slide-40
SLIDE 40

40

Shading

  • Illumination model computes illumination for a point on

surface

  • But how do we compute the illumination for all points on all

(visible) surfaces?

  • Shading methods:
  • Flat shading
  • Gouraud shading
  • Phong shading
slide-41
SLIDE 41

41

Normal vectors

  • For illumination model we need normal vectors for
  • the cell center
  • the cell nodes
  • every pixel in the image
slide-42
SLIDE 42

42

Normal vectors

  • Cell normals
  • Use the cross product
  • f two cell edges
  • Node normals
  • Compute cell normals

for neighbor cells

  • Average cell normals
  • 2

v 1 v 2 v 1 v n × × = 4 4 n 3 n 2 n 1 n n + + + =

slide-43
SLIDE 43

43

Flat shading

  • Determine illumination for one point on cell (e.g. center)
  • Use this illumination for all points on cell
  • Disadvantages:
  • Does not account for changing direction to light source
  • ver polygon
  • Does not account for changing direction to eye over

polygon

  • Discontinuity at polygon boundaries (when curved

surface approximated by polygon mesh

slide-44
SLIDE 44

44

Flat shading

slide-45
SLIDE 45

45

Gouraud shading

  • Based on interpolation of illumination values
  • Compute illumination for nodes of cell
  • Algorithm
  • for all nodes of cell
  • get node normal
  • compute node illumination using this normal
  • for all pixels in projection of polygon
  • compute pixel illumination by interpolation of node

illuminations

slide-46
SLIDE 46

46

Gouraud shading

I1 I2 I3 ys IA IB

( )

2 1 A

I I 1 I α + α − =

( )

2 1 B

I I 1 I β + β − =

2 1 s 1

y y y y − − = α

3 1 s 1

y y y y − − = β IP

B A P

I I ) 1 ( I γ + γ − =

B A P A

x x x x − − = γ

slide-47
SLIDE 47

47

Gouraud shading

slide-48
SLIDE 48

48

Gouraud shading

  • Advantages
  • Interpolation is simple, hardware implementation
  • Continuous shading
  • Better results for curved surfaces
  • Disadvantages
  • Subtle illumination effects (e.g. highlights) require high

subdivision of surface in very small polygons

  • Mach banding
slide-49
SLIDE 49

49

Phong shading

  • Based on normal interpolation
  • Compute illumination for each visible point of cell
  • Algorithm
  • for each node of cell
  • get node normal
  • for each pixel in projection of cell
  • compute point normal by interpolation of node

normals

  • compute pixel illumination using interpolated normal
slide-50
SLIDE 50

50

Phong shading

slide-51
SLIDE 51

51

Phong shading

  • Advantages
  • Much better results for curved surfaces
  • Nice highlights
  • No Mach banding
  • Disadvantages
  • Computational expensive
  • Normal interpolation and application of illumination

model for each pixel

slide-52
SLIDE 52

52

Shading summarized

slide-53
SLIDE 53

53

Shading

  • Flat shading
  • 1x application of illumination model per cell
  • 1 color per polygon
  • Gouraud shading
  • 1x application of illumination model per node
  • Interpolated colors
  • Phong shading
  • 1x application of illumination model per pixel
  • Nice highlights

Increase computation time Increase quality

slide-54
SLIDE 54

54

Graphics pipeline

Geometric model Viewing Camera parameters Light sources, materials Shading Visible surface determination Rasterize Raster display