Docsity

Understanding Lighting Models & Techniques in Computer Graphics, Slides of Computer Graphics

Partial preview of the text

Download Understanding Lighting Models & Techniques in Computer Graphics and more Slides Computer Graphics in PDF only on Docsity!

Computer Graphics Illumination and Shading

Illumination and Shading

n Problem: Model light/surface points interaction to

determine final color and brightness

n Apply the lighting model at a set of points across the

entire surface

Shading

lighting

Basic Light Sources

Point light Directional light

Spot light Area light

Light intensity can be independent or dependent of the distance between object and the light source

Local Illumination

n Local illumination: only consider the light, the observer

position, and the object material properties

n OpenGL does this

θ

Simple Local Illumination

n The model used by OpenGL

n Consider three types of light contribution to compute the

final illumination of an object

n Ambient n Diffuse n Specular

n Final illumination of a point (vertex) =

ambient + diffuse + specular

n Materials reflect each component differently

n Use different material reflection coefficients, Ka, Kd, Ks

Ambient Light Contribution

n Ambient light = background light

n Light that is scattered by the environment

n Frequently assumed to be constant

n Very simple approximation of global illumination

n No direction: independent of light position, object

orientation, observer’s position or orientation

object 1

object 3 object 2

object 4

Ambient = I x Ka

constant

Diffuse Light Contribution

n Diffuse light: The illumination that a surface receives from

a light source and reflects equally in all direction

It does not matter where the eye is

Diffuse Lighting Example

Diffuse Light Calculation

n Lambert’s law: the radiant energy D that a small surface

patch receives from a light source is:

D = I x cos (θ)

I: light intensity

θ: angle between the light vector and the surface normal

N : surface normal

light vector (vector from object to light) θ

Specular light contribution

n The bright spot on the object

n The result of total reflection of

the incident light in a concentrate

region

See no specular

See lots specular

Specular light calculation

n How much reflection you can see depends on where you

are

Only position the eye can see specular from P if object has an ideal reflection surface

But for non-perfect surface you will still see specular highlight when you move a little bit away from the ideal reflection direction Φ is deviation of view angle from mirror direction

When φ is small, you see more specular

highlight

θ

p

φ

specular = Ks x I x cos(φ)

n

Specular light calculation

n Phong lighting model

n The effect of ‘n’ in the phong model

n = 10

n = 30

n = 90

n = 270

specular = Ks x I x cos(φ)

n

Adding Color

n Sometimes light or surfaces are colored

n Treat R,G and B components separately

n i.e. can specify different RGB values for either light or material

n Illumination equation goes from:

Illum = ambient + diffuse + specular

= Ka x I + Kd x I x (cos θ ) + Ks x I x cos (φ)

To:

Illum_r = Kar x Ir + Kdr x Ir x (cos θ ) + Ksr x Ir x cos (φ)

Illum_g = Kag x Ig + Kdg x Ig x (cos θ ) + Ksg x Ig x cos (φ)

Illum_b = Kab x Ib + Kdb x Ib x (cos θ ) + Ksb x Ib x cos (φ)

n

n n n

Adding Color

**0.773911 89.

0.**

**0.

0.**

**0.

0.**

Polished

Silver

**0.992157 27.

0.**

**0.

0.**

**0.

0.**

Brass

**0.5 32

0.**

**0.

0.**

**0.

0.**

Black plastic

Specular Exponent, n Ksr, Ksg,ksb

Diffuse Kdr, Kdg,kdb

Ambient Kar, Kag,kab

Material

Figure 8.17, Hill, courtesy of McReynolds and Blythe