Top Banner
1 Illumination Models and Shading
42

Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

Mar 18, 2018

Download

Documents

trinhdiep
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

1

Illumination Models and

Shading

Page 2: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

2

Azrieli

Page 3: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

3

Shading

Page 4: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

4

Azrieli

Page 5: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

5

Shading

Page 6: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

6

Motivation2: In order to produce realistic images, we must simulate the appearance of surfaces under various lighting conditions.

Page 7: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

7

Motivation1: Perceive geometry

Page 8: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

8

Illumination Model Parameters

• Lighting effects are described with models that consider the interaction of light sources with object surfaces.

• The factors determining the lighting effects are:

The light source parameters: Positions. Electromagnetic Spectrum. Shape.

The surface parameters Position. Reflectance properties. Position of near by surfaces.

The eye (camera) parameters Position. Sensor spectrum sensitivities.

Page 9: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

9

• Illumination models is used to calculate the intensity of light that is reflected at a given point on a surface.

• Rendering methods use the intensity calculations from the illumination model to determine the light intensity at all pixels in the image, by possibly, considering light propagation between surfaces in the scene.

Lighthouse image from http://www.midwinter.com/~piaw/gallery/pigeonpointlighthouse.htm

Page 10: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

10

Light Source Models

• Point Source (A): All light rays originate at a point and radially diverging. – A reasonable approximation for sources

whose dimensions are small compared to the object size.

• Parallel source (B): Light rays are all parallel. May be modeled as a point source at infinity (the sun).

• Distributed source (C): All light rays originate at a finite area in space. – A nearby sources such as fluorescent light.

A B

C

Page 11: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

11

• The reflected light which is perceived is a combination of multiple light sources

• The surface properties also have a significant effect on the object color

• OpenGL simulates the lighting conditions with equasions that:

• Approximate reality • Are easy to implement • Software renderers can calculate more realistic

calculations

Image from http://radsite.lbl.gov/radiance/gallery/image/63b7.jpg

Page 12: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

12

Phong Shading Model

1. ambient 2. diffuse 3. specular • The three components are computed

independently and (weighted) summed

Page 13: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

13

Phong Shading Model

• Simplified and fast methods for calculating surfaces intensities.

• Calculations are based on optical properties of surfaces and the lighting conditions (no reflected sources nor shadows).

• Light sources are considered to be point sources.

• A reasonably good approximation for most scenes.

Page 14: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

14

Diffuse Reflection

• Diffuse (Lambertian) surfaces are rough or grainy (like clay, soil, fabric).

• The surface appears equally bright from all viewing directions.

• The brightness at each point is proportional to cos(θ):

θ N

L

Page 15: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

15

• This is because a surface (A) perpendicular to the light direction is more illuminated than a surface (B) at an oblique angle.

• The reflected intensity Idiff of any point on the surface is: Ip - the point light intensity. Kd ∈ [0,1] - the surface diffuse

reflectivity. N - the surface normal. L - the light direction.

A B

Idiff=Kd Ipcos(θ)=Kd Ip(N⋅L)

Page 16: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

16

Ambient surface

Diffuse surface

Page 17: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

17

Ambient surface

Diffuse surface

Page 18: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

18

Diffuse reflections from different light directions

Page 19: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

19

• Commonly, there are two types of light sources: – A background ambient light. – A point light source.

• The updated illumination equation is this case is:

• Note this is the model for one color and it should be duplicated for each channel: IR, IG, IB .

I=Idiff+Iamb=Kd Ip N⋅L + Ka Ia

Page 20: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

20

0 0.3 0.6

0.3

0.5

0.7

Ka

Kd

Page 21: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

21

Page 22: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

22

Specular light

• Specular light is also directional, but scatters in a preferred direction

• "Shiny materials" have a high specularity • Matte materials have low specularity

Page 23: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

23

Specular Reflection • Shiny and glossy surfaces (like metal,

plastic) with highlights. • Reflectance intensity changes with

reflected angle. • For an ideal specular surface (mirror)

the light is reflected in only one direction - R.

• However, most objects are not ideal mirrors (glossy objects) and they reflect in the immediate vicinity of R.

θ θ

N L R

θ θ

N L R

φ V

Ideal specular surface non-ideal specular surface

Page 24: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

24

• The Phong Model: Reflected specular intensity falls off as

some power of cos (φ): Ks - the surface specular reflectivity. n - specular-reflection parameter,

determining the deviation from ideal specular surface (for mirror n=∞).

N N L L R R

Ispec=Ks Ipcosn(φ)=Ks Ip(R⋅V)n

V V φ φ

Shiny surface Large n

Dull surface Small n

Page 25: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

25

-2 -1.5 -1 -0.5 0 0.5 1 1.5 20

0.2

0.4

0.6

0.8

1

n=1 n=8

n=64

Plots of cosn(φ) for several specular parameter n.

Page 26: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

26

0.2 0.5 0.8

0

0.3

0.7

Kd

Ks

Page 27: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

27

n=50

n=10

n=3

Several reflections with different specular parameters

Page 28: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

28

Page 29: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

29

Ambient Light

Ambient illumination is light that's been scattered so much by the environment that its direction is impossible to determine: it seems to come from all directions

Page 30: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

30

Ambient Light • Assume there is some non-directional

light in the environment (background light).

• The amount of ambient light incident on each object is a constant for all surfaces and over all directions.

• The reflected intensity Iamb of any point on the surface is:

Ia - the ambient light intensity. Ka ∈ [0,1] - the surface ambient

reflectivity. • In principle Ia and Ka are functions of

color, so we have IRamb, IG

amb, IBamb

Iamb=Ka Ia

Page 31: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

31

Examples: Ambient light reflections

Page 32: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

32

• The updated illumination equation combined with diffuse reflection is:

• If several light sources are placed in the scene:

I= Iamb+Idiff+Ispec= Ka Ia+ Ip (Kd N⋅L+Ks (R⋅V)n)

I= Iamb+Σk (Ikdiff+Ik

spec)

Commonly, there are two types of light sources:

A background ambient light. A point light source.

Page 33: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

33

Diffuse surface

Ambient surface

Diffuse +

Specular

Page 34: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

Composition of Light Sources

Page 35: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

Composition of Light Sources

Page 36: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

36

Summary

• Diffuse light comes from a single direction – Brighter if it strikes a surface directly – Scatters equally

• Specular light is also directional, but

scatters in a preferred direction – "Shiny materials" have a high

specularity – Matte materials have low specularity

• Ambient light compensate for not

considering reflection from other surfaces

Page 37: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

37

First, let see how to compute the vector R, given L and N.

N L R

R = (2L*N)N - L

The Highlight Vector

R is relatively expensive, and we can do better:

Page 38: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

38

N L R

(2L*N)N

2L -L

R = (2L*N)N - L

The Highlight Vector

Page 39: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

39

The Highlight Vector

Page 40: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

40

The Highlight Vector

N L R

V

H

H = L+V

H*N ~~ V*R

Assuming L and V are constant per surface, H is constant per surface for the given view. Thus, we avoid computing R. The actual size of the angle can be compensated by the glossiness factor n.

Page 41: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

Ambient Term • Represents reflection of all indirect

illumination

This is a total hack (avoids complexity of global illumination)!

Page 42: Illumination Models and Shading - Tel Aviv Universitydcor/Graphics/pdf.slides/shading13.pdf · • Rendering methods use the intensity calculations from the illumination model to

Global Illumination

"Balanza" © Jaime Vives Piqueres (2002)