Top Banner
Rendering ( 彩彩 彩彩 )
29

Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

Dec 19, 2015

Download

Documents

Kelley Stephens
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: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

Rendering ( 彩現 渲染 )

Page 2: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

Content

• Light-Material Interaction• Phong Reflection model• Gouraud vs. Phone Shading

Fall 2013 2

Page 3: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

Fall 2013 3

Rendering

• The computation required to convert 3D scene to 2D display photo-realistically

Page 4: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

Fall 2013 4

Shading

• the gradation (of color) that give the 2D images the appearance of being 3D

Page 5: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

Light-Material Interaction

specular diffuse translucent

Fall 2013 5

Page 6: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

Fall 2013 6

Light

• point, spot, directional lights

• ambient light: to account for uniform level room lighting

• describe a light source through a three-component (RGB) intensity

Page 7: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

• Specular

Phong Reflection Model

• Diffuse ( 漫射 ) • Ambient

Fall 2013 7

Page 8: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

8

Those Were the Days…

“In trying to improve the quality of the synthetic images, we do not expect to be able to display the object exactly as it would appear in reality, with texture, overcast shadows, etc. We hope only to display an image that approximates the real object closely enough to provide a certain degree of realism.”

– Bui Tuong Phong, 1975

Fall 2013

Page 9: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

9

Lambert’s Cosine Law• The reflected luminous intensity in any

direction from a perfectly diffusing surface varies as the cosine of the angle between the direction of incident light and the normal vector of the surface.

• Intuitively: cross-sectional area of the “beam” intersecting an elementof surface area is smaller for greater angles with the normal.

Fall 2013

Page 10: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

10

Lambert’s Cosine Law

• Ideally diffuse surfaces obey cosine law.– Often called Lambertian surfaces.

• Id = kd Iincident cos = kd Iincident (N·L).

– kd is the diffuse reflectanceof the material.

L

N

Fall 2013

Page 11: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

11

Phong Lighting Model

• Phong adds specular highlights.• His original formula for the specular term:– W(i)[cos s ]n

• s is the angle between the view and specular reflection directions.• “W(i) is a function which gives the ratio of the specular reflected

light and the incident light as a function of the the incident angle i.”– Ranges from 10 to 80 percent.

• “n is a power which models the specular reflected light for each material.”– Ranges from 1 to 10.

Fall 2013

Page 12: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

12

Phong Lighting Model

• More recent formulations are slightly different.– Replace W(i) with a constant ks independent of

the incident direction.• What do we lose when we do this?

– Is= ks Iincident cosn= ks Iincident (V·R)n

R = 2(N·L)N – L

Fall 2013

Page 13: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

Fall 2013 13

Ambient Reflection

• Local illumination models account for light scattered from the light source only

• Light may be scattered from all surfaces in the scene. We are missing a lot of light, typically over 50%

• Ambient term = a coarse approximation to this missing flux

• This is a constant everywhere in the scene

Page 14: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

Diffuse Reflection

• Lambertian scatters (wikipedia): the irradiance landing on the area element is proportional to the cosine of the angle between the illuminating surface and the normal.

• When a Lambertian surface is viewed from any angle, it has the same radiance.

Fall 2013 14

Johann Heinrich Lambert (1728 – 1777) was a Swiss mathematician, physicist and astronomer.

Page 15: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

Specular Reflection

Fall 2013 15

Effect of Shininess Coefficient .

v

Page 16: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

Fall 2013 16

Phong Reflection Model

• L: light source property (RGB) • R: material property (RGB)• ambient reflection

• diffuse reflection

• specular reflection

• final result

: shininess coefficient

To consider distance attenuation

Page 17: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

Phong Model (cont)

• For multiple light sources:

Fall 2013 17

Page 18: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

18

Blinn-Phong Model

• Popular variation of Phong model.• Uses the halfway vector, H.• Is = ks Iincident (N·H)n.– H = (L+V) / | L+V |

• What are the advantages?

LN

H

V

Fall 2013

Page 19: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

19

Blinn-Phong Model

• Popular variation of Phong model.• Uses the half vector, H.• Is = ks Iincident (N·H)n.– H = (L+V) / | L+V |

• Faster to compute than reflection vector.• Still view-dependent since H depends on V.

LN

H

V

Jim Blinn (1949 - now)

Fall 2013

Page 20: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

20Fall 2013 20

Blinn-Phong Model

Time-Consuming!

lnln

nlnlnlnr

2

nln

nlnl

n

l r

vrLkI sss

An alternate formulation employs the half vector H

hnLkI

h

hhlvh

sss

ˆ,

Page 21: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

21

Blinn-Phong Highlights

• Does using N.H vs. R.V affect highlights?– Yes, the highlights “spread” (Wikipedia)– Why?

• Is this bad?

Fall 2013

Page 22: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

22

Blinn-Phong Highlights

• Does using N.H vs. R.V affect highlights?– Yes, the highlights “spread”.– Why?

• Is this bad?– Not really, for two reasons.• Can always adjust the exponent.• Phong and Blinn-Phong are not physically based, so it

doesn’t really matter!

Fall 2013

Page 23: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

Target of Shading: Polygon, Vertex or Fragments

Recall the rendering (OpenGL) pipeline

Fall 2013 23

Page 24: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

Fall 2013 24

Shading Modes

• Flat vs. Smooth– Flat: single color per

face– Gouraud (intensity

interpolation)– Phong (normal

interpolation)

• Local vs. Global

Page 25: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

Fall 2013 25

Gouraud vs. Phong

• Most h/w implement Gouraud shading• Phong shading can better imitate specular effects (∵normals are interpolated)

• Most h/w implement Gouraud shading• Phong shading can better imitate specular effects (∵normals are interpolated)

Page 26: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

Fall 2013 26

Page 27: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

Fall 2013 27

Compare: Flat, Gouraud, Phong

Page 28: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

Rendering Pipeline Tutorial

No longer on line [local copy]

Page 29: Rendering ( 彩現 渲染 ). Content Light-Material Interaction Phong Reflection model Gouraud vs. Phone Shading Fall 20132.

Fall 2013 29

Rendering Pipeline (Foley and van Dam)