illumination models. introduction 1 illumination model: given a point on a surface, what is the...

45
Illumination Models

Upload: maryann-caldwell

Post on 20-Jan-2018

221 views

Category:

Documents


0 download

DESCRIPTION

Introduction 2 Example: Illumination model gives color vertices, Surface is displayed via interpolation of these colors.

TRANSCRIPT

Page 1: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Illumination Models

Page 2: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Introduction 1

Illumination model: Given a point on a surface, what is the perceived

color and intensity? Known as Lighting Model, or Shading Model

Surface rendering:Apply the Illumination model to color all pixels

of the surface.

Page 3: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Introduction 2

Example:• Illumination model gives color

vertices, • Surface is displayed via

interpolation of these colors.

Page 4: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Introduction 3

Illumination:• Physics:

– Material properties, light sources, relative positions, properties medium

• Psychology:– Perception, what do we see– Color!

• Often approximating models

Page 5: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Light sources 1

Light source: object that radiates energy.

Sun, lamp, globe, sky…

Intensity I = (Ired , Igreen , Iblue)

If Ired = Igreen = Iblue : white light

Page 6: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Light sources 2

Simple model: point light source- position P and intensity I- Light rays along straight lines- Good approximation for small

light sources

Page 7: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Light sources 3

Simpler yet: point light source at infinity- Direction V and intensity I- Sunlight

V

Page 8: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Light sources 4

Damping: intensity of light decreases with distanceEnergy is distributed over area sphere, hence Il = I / d2,

with d distance to light source.In practice often too ‘agressive’, hence Il = I / (a0 +a1d+a2d2)

If light source at infinity: No damping with distance

d

Page 9: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Light sources 5Directed light source, spotlight:Light is primarily send in direction of Vlight .

PQ

d.illuminate is then cos||

If

:Or d.illuminate is then coscos If

llight

l

QVPQPQ

Q

l

light cone

Vlight

Page 10: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…
Page 11: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Light sources 6More subtle: Let I decrease with increasing angle

PQ

decreases.light hestronger t the,larger The . cos:usedOften

nII n

l

l

light cone

Vlight

Page 12: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…
Page 13: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Surface illumination 1

• When light hits a surface, three things can happen:

reflection

transmission

absorption

Page 14: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Surface illumination 2

• Suppose, a light source radiates white light, consisting of red, green and blue light.

reflection

transmission

absorption

If only red light is reflected, then we see a red surface.

Page 15: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Surface illumination 3

• Diffuse reflection: Light is uniformly reflected in all directions

• Specular reflection: Light is stronger reflected in one direction.

specular reflection

diffuse reflection

Page 16: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Surface illumination 4

• Ambient light: light from the environment. Undirected light, models reflected light of other objects.

Page 17: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Basic illumination model 1Basic illumination model:

• Ambient light;• Point light sources;

• Ambient reflection;• Diffuse reflection;• Specular reflection.

VP of ,l

a

II

ss

d

a

nkkk

,), ,(

tscoefficien reflection :,,

bluep,greenp,redp, kkkkkkk

p

sda

Page 18: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Basic illumination model 2

• Ambient light: environment light. Undirected light, models reflected light of other objects.

aaamb IkI

Page 19: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Basic illumination model 3

Perfect diffuse reflector: light is reflected uniformly in all directions.

dA/cos

dA

cos cos/

dAdA

area.projectedenergyIntensity

Page 20: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Basic illumination model 4Perfect diffuse reflector: light is reflected uniformly in all directions..

N

L

dA/cos

dA Lambert’s law:Reflected energy isproportional with cos , where denotes the angle between the normal N and a vector to the lightsource L.

Page 21: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Basic illumination model 5

Perfect diffuse reflector: light is reflected uniformly in all directions.

N

L

Il

||

and 10with 0 if00 if)(

:reflection diffuse model Graphics

surfsource

surfsource

diffl,

PPPPL

LNLNLN

d

ld

k

IkI

Psurf

Psource

Page 22: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Basic illumination model 6

Perfect specular reflector: light is only reflected in onedirection. Angle of incidence is angle of reflection.

N

L R

Page 23: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Basic illumination model 7Imperfect specular reflector: light is distributed in the direction of the angle of reflection, dependent on the roughness of the surface.

N

L R

N

L R

glad ruw

Page 24: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Basic illumination model 8

Phong model: empirical model for specular reflection

N

L

RV

viewerdirection :light ofray reflecteddirection :

, and between angle :, and between angle :

glad),100 ruw,(1 smoothness ,)(with

,cos)(,

VR

VRLN

s

s

nlspecl

nkW

IWI s

Page 25: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Basic illumination model 9

Phong model: empirical model for specular reflection

N

L

RV

0or 0 if0

0 and 0 if

)(

,

LNRV

LNRV

RV snls

specl

Ik

I

Page 26: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Basic illumination model 10

Phong model: calculating the vectors

NL R )2(

hence)2(

LNLNR

NLNLR

L

N.L V

|| surfview

surfview

PPPPV

Page 27: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Basic illumination model 11

N

L

RV

H|VL|

VLH

Phong model: variant with halfway vector H.Use instead of

)(,sn

lsspecl IkI HN

If light source and viewer far away:H constant.

Page 28: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Basic illumination model 12

n

llsldaa

lsldaa

specdifamb

IkIkIkI

IkIkIk

IIII

1

n

n

s

s

)),0(max()),0(max(

:sourceslight Multiple

)),0(max()),0(max(

HNLN

HNLN

All together:

Page 29: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Color (reprise):Light intensity I and reflection coefficients k: (r,g,b) tripletsSo for instance:

Plastic: kd is colored (r,g,b), ks is grey (w,w,w)

Metal: kd and ks same color

Basic model: simple but effective. It can be done much better though…

Basic illumination model 13

)),0(max(,,, LN RlRdRdif IkI

Page 30: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Transparancy 1Transparant object:- reflected and transmitted

light- refraction- scattering

Page 31: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Transparancy 2

Snell’s law of refraction:

N

iL R

T

refraction ofindex : ,sinsin

ir

ir

i

r

LNTr

iri

r

i

coscos

and for solve and,

,cos,1.

law, sSnell' Use:Derivation

LNT

NTTT

r

Page 32: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Transparancy 3Thin surface:- double refraction- shift of light ray

Page 33: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Transparancy 3Very thin surface:- Discard shift

opacity :1ncy transpara:

10)1(

:model Simple

transrefl

t

t

t

tt

kk

kIkIkI

Poor result for silhouette edges…

Page 34: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Atmospheric effects 1Atmospheric effects:- dust, smoke, vapor- colors are dimmed- objects less well visible

Page 35: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…
Page 36: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Atmospheric effects 2

factorn attenuatio :distance:

with ,)(

:atmosphereby n Attenuatio

dedf d

atmo

minmax

min)(:Simplerdd

dddfatmo

atmoatmoobjatmo IdfIdfI )](1[)( :intensity Perceived

= 0.25 + [ 1 0.25 ]

Page 37: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Rendering polygons 1

Basic illumination model:Can be used per point, but that’s

somewhat expensive

More efficient:Illumination model gives color for some

points; Surface is filled in using interpolation of

these colors.

Page 38: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Rendering polygons 2Constant-intensity rendering aka flat surface rendering:• Determine color for center of polygon;• Fill the polygon with a constant color.

Ok if:• Object consists of planar faces, and• Light sources are far away, and• Eye point is far away,or• Polygons are about a pixel in size.

Page 39: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Rendering polygons 2Constant-intensity rendering aka flat surface rendering:• Determine color for center of polygon;• Fill the polygon with a constant color.

Highlights not visible,Facetted appearance, increased by Mach banding effect.

Page 40: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

• Human perception: edges are given emphasis, contrast is increased near edges.

Mach banding

Angel (2000)

Page 41: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Rendering polygons 2Gouraud surface rendering:• Determine average normal on vertices;• Determine color for vertices;• Interpolate the colors per polygon (incrementally).

N1

N2

N3

N4

V

n

1k k

n

1k kV

N

NN

Page 42: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Rendering polygons 3

Gouraud surface rendering:• Much better result for curved surfaces• Errors near highlights• Linear interpolation still gives Mach banding• Silhouettes are still not smooth

Gouraud Flat

Page 43: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Rendering polygons 4Phong surface rendering:• Determine average normal per vertex;• Interpolate normals per polygon (incrementally);• Calculate color per pixel.

Fast Phong surface rendering:Like Phong surface rendering, but use

2nd order approximation of color over polygon:

feydxcybxyaxyxI 22),(

Page 44: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Rendering polygons 5

Phong surface rendering:• Even better result for curved surfaces• No errors at high lights• No Mach banding• Silhouettes remain coarse• More expensive than flat or Gouraud shading

Page 45: Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived…

Rendering polygons 5

Gouraud

Flat

Phong