of 5

• date post

29-Jul-2018
• Category

## Documents

• view

221

0

Embed Size (px)

### Transcript of Computer Graphics Shading - Arizona Computer .Computer Graphics Copyright Gotsman, Elber, ... Area

Page 1

Computer Graphics

Copyright Gotsman, Elber, Barequet, Karni, Sheffer

Computer Science, Technion

The Physics

2

3

Local vs. Global Illumination Models

Local model direct and local interaction of each object with the light.

Global model: interactions and exchange of light energy between different objects.

Example

Ambient Diffuse

Specular Final Image

5

Light Sources Point source (A): All light originates at a point

" Rays hit planar surface at different incidence angles Parallel source (B): All light rays are parallel

" Rays hit a planar surface at identical incidence angles " May be modeled as point source at infinity " Also called directional source

Area source (C): Light originates at finite area in space. " Inbetween the point and parallel sources " Also called distributed source A B

C

6

Assume non-directional light in the environment Object illuminated with same light everywhere

" Looks like silhouette

The Illumination equation I = Iaka

Ambient Light

" Ia - ambient light intensity

" ka - fraction of ambient light reflected from surface.

Also defines object color

Page 2

Computer Graphics

Copyright Gotsman, Elber, Barequet, Karni, Sheffer

Computer Science, Technion

Diffuse Light Dull surfaces such as solid matte plastic reflects incoming light

uniformly in all directions. Called diffuse or Lambertian reflection Understand intensity as the number of photons per inch2. If a flow

of m photos passing each second through an inch2 window orthogonal to the flow, is hitting the red surface, how many photons hit an inch2 of the surface ?

Let is the angle between the direction of incoming light and normal to surface, and let L, N be corresponding unit vectors.

L N

Diffused Ball

10

Diffuse Reflection

11

Assume object is a perfect mirror.

Lights emits the object in direction V only if V=R

Reflection from a perfect mirror N L R

V

=0

12

Shiny objects (e.g. metallic) reflect light in preferred direction R determined by surface normal N.

Most objects are not ideal mirrors also reflect in the immediate vicinity of R

Phong Model approximate attenuation by the form of cosn (no real physical basis)

Specular Reflection

N L R V

Page 3

Computer Graphics

Copyright Gotsman, Elber, Barequet, Karni, Sheffer

Computer Science, Technion

13

Specular Reflection (Phong Model) Illumination equation:

ks - Specular reflection coefficient n - Specularity exponent

14

Specular Reflection (contd) Exponent n of cosine controls decay factor of attenuation function:

No physical basis but looks good:

Retroreflector " sends light back where it came from regardless of the angle

of insidence

18

For multiple light sources:

" Ip of all light sources are added together " Precautions should be taken from overflows

More on Illumination Equation shadingmodel

Page 4

Computer Graphics

Copyright Gotsman, Elber, Barequet, Karni, Sheffer

Computer Science, Technion

19

For distance/atmospheric attenuation sources:

dp - distance between surface and light source and/or distance between surface and viewer (heuristic atmospheric attenuation)

Even More on Illumination Equation

20

Applied to piecewise linear polygonal models

Simple surface lighting approximated over polygons

Illumination value depends only on polygon normal each polygon is colored with a uniform intensity

Looks non-smooth (worsened by Mach band effect)

Normal per Vertex

21 22

Compute illumination intensity at vertices using those normals

Interpolate intensity over polygon interior

23

24

Phong Shading Interpolate (at the vertices in image space) normal vectors

instead of illumination intensities Apply the illumination equation for each interior pixel with

its own (interpolated) normal

Page 5

Computer Graphics

Copyright Gotsman, Elber, Barequet, Karni, Sheffer

Computer Science, Technion

25

Comments on Shading Phong shading is more expensive (why?) but well

worth the effort

Can achieve good looking specular highlight effects

Both the Gouraud and Phong shading schemes are performed in the image plane and fit well into a polygonal scan-conversion fill scheme

Both the Gouraud and Phong are view dependent

Can cause artifacts during animation as they are transformation dependent

26

Comparison