59
February 5, 2015 1 [email protected]

advanced computer graphics - Reflection model

Embed Size (px)

Citation preview

Page 1: advanced computer graphics - Reflection model

February 5, 2015 1 [email protected]

Page 2: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 2

Illumination models are used to generate the color of an object’s surface at a

given point on that surface.

Due to the relationship defined in the model between the surface of the objects

and the lights affecting it, illumination models are also called shading models

or lighting models

Page 3: advanced computer graphics - Reflection model

February 5, 2015 3 [email protected]

Most of the lighting effects result from reflection.

Ambient illumination is light that has been scattered to such a degree

that it is no longer possible to determine its direction. the case in the

right-hand sphere in Figure.

Ambient light and matte surfaces produce diffuse reflection.

Point sources and polished surfaces produce specular reflection.

Reflection Model

Page 4: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 4

We can now introduce the illumination equation, using the notion that

I = value

Where I represents the illumination color intensity

and

value represents the expression resulting in that color value.

Constant shading illumination equation can be defined as:

I = ki

…where k represents the basic object intensity.

This simple equation has no reference to light sources, and as such every point

on the object has the same intensity.

This equation need only be calculated once per object.

The process of evaluating the illumination equation at one or more points on an

object’s surface is referred to as lighting the object.

Illumination Equation

Page 5: advanced computer graphics - Reflection model

February 5, 2015 5

Non-directional light source

Simulates light that has been reflected so many times from so many surfaces it

appears to come equally from all directions

intensity is constant over polygon's surface

intensity is not affected by anything else in the world

intensity is not affected by the position or orientation of the polygon in the world

position of viewer is not important

No 3-D information provided.

Generally used as a base lighting in combination with other lights.

I = IaKa

I: intensity

Ia: intensity of Ambient light

Ka: object's ambient reflection coefficient, 0.0 - 1.0, Ka is the ambient reflection

coefficient a material based property that determines how much ambient light is

actually reflected.

[email protected]

Ambient

Page 6: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 6

Ambient Light

Walk around the back of box. No light beams hit it directly. Can you see the back

face? ‰ This type of indirect light is called ambient light.

Page 7: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 7

Like sunlight on a totally clouded day!

Uniform level of light, position‐independent ‰

Tells us how bright an object looks when no light source can directly reach it

Ambient Light

Page 8: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 8

Also called background light, not created by any light source

A constant lighting from all directions

contributed by scattered light in a surrounding

‰When used alone, does not produce very interesting pictures.

Ambient Light

Page 9: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 9

To incorporate background light we simply set a general brightness level Ia

for a scene

Different surfaces may reflect different amount of ambient light, based on their

reflectance properties. We model this by a constant factor for each surface:

Ambient Light

Page 10: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 10

For an RGB color description each intensity specification is a three element vector

‰ Similarly, the reflectance is given as a vector:

‰ Red, green and blue ambient light intensities are

RGB Color Considerations ‰

Page 11: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 11

RGB Color Considerations ‰

Page 12: advanced computer graphics - Reflection model

February 5, 2015 12 [email protected]

A diffuse surface is one that appears similarly bright from all viewing directions.

That is, the emitted light appears independent of the viewing location.

Diffuse Reflection

The intensity of reflection at any point on the surface is expressed by the formula

where I is the intensity of illumination and k is the ambient reflection coefficient,

or reflectivity, of the surface. Notice that this coefficient is a property of the

surface material.

In calculations, k is assigned a constant value in the range 0 to 1. Highly

reflective surfaces have values near 1. With high reflectivity's light has nearly the

same effects as incident light. Surfaces that absorb most of the light have a

reflectivity near 0.

Page 13: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 13

Diffuse reflections consider point lights to generate shading properties, a

change in color intensity across the surface of an object in relation to light

sources.

Lambertian Reflection – light is reflected with equal intensity in all directions

(isotropic).

The distribution is a basic consideration towards surface detail:

Light scattering on the surface and in the medium.

Lambert’s law states that the intensity of illumination on a diffuse surface is

proportional to the cosine of the angle generated between the surface normal

vector and the surface to the light source vector.

Diffuse Reflection

Page 14: advanced computer graphics - Reflection model

February 5, 2015 14

Using a point light:

comes from a specific direction

reflects off of dull surfaces

light reflected with equal intensity in all directions

brightness depends on theta - angle between surface normal (N) and the direction to the

light source (L)

position of viewer is not important I = Ip Kd cos(Ɵ) or I = Ip Kd (N' * L')

I: intensity

Ip: intensity of point light

Kd: object's diffuse reflection coefficient, 0.0 - 1.0 for each of R, G, and B

N': normalized surface normal

L': normalized direction to light source

*: represents the dot product of the two vectors

Using a directional light:

theta is constant , L' is constant

[email protected]

Diffuse Reflection (Lambertian Reflection)

Page 15: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 15

The second element in determining diffuse reflection is the angle of illumination, or angle of

incidence. A surface perpendicular to the direction of incident light reflects more light than a

surface at an angle to the incident light. The calculation of diffuse reflection can be made

according to Lambert's cosine law, which states that, for a point source, the intensity of

reflected light is proportional to the cosine of the angle of incidence. Figure shows this effect.

Diffuse Reflection (Lambertian Reflection)

Page 16: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 16

Diffuse Reflection (Lambertian Reflection)

Page 17: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 17

Diffuse Reflection (Lambertian Reflection)

Page 18: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 18

Diffuse Reflection (Lambertian Reflection)

Page 19: advanced computer graphics - Reflection model

February 5, 2015 19 [email protected]

paper and marble have diffuse

reflecting surfaces

• in general, materials are

characterized by a combination

of diffuse and specular reflection

Diffuse Reflection

Page 20: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 20

Lambert's Cosine Law

computation of diffuse reflection

is governed by Lambert's

cosine law

• radiant intensity reflected from

a "Lambertian" (matte, diffuse)

surface is proportional to the

cosine of the angle between

view direction and surface

normal n

Page 21: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 21

The degree of diffusion depends on the material and the illumination.

In addition, the type of the light source and atmospheric attenuation can influence the degree of

diffusion. The spheres in Figure show various degrees of diffuse illumination.

Diffuse Reflection

Page 22: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 22

The only data used in this equation is the surface normal and a light vector

that uses the light source position(taken as a point light for simplicity).

The intensity is irrespective of the actual viewpoint, hence the illumination is

the same when viewed from any direction.

Diffuse Reflection

Page 23: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 23

‰ The angle between the incoming light direction and a surface normal is

referred to as the angle of incidence, denoted θ. ‰

Diffuse Reflection

L = unit vector to light source

N = unit vector normal to surface

Law of reflection: the angle of incidence equals the angle of reflection, and

L, N and reflection directions are coplanar.

Page 24: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 24

The equation for Lambert’s illumination model is:

I = Ipkd cos( Ɵ )

Where:

Ip is the intensity of the point light source

kd is the material diffuse reflection coefficient the amount of diffuse light

reflected.

By using the dot product between 2 vectors v1 and v2

v1 •v2 = |v1|| v2| cos(Ɵ )

…and if N and L are normalized, we can rewrite the illumination equation:

I = Ipkd (N •L)

Lambert’s Model

Page 25: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 25

Dot product

Page 26: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 26

If surface has brightness Ι

when facing light, it has brightness Ι*cos(θ) when tilted at angle θ.

You will see the brightness written as I(N∙L)

Page 27: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 27

‰ Spheres lit by diffuse (kd) values of 0.0, 0.25, 0.5, 0.75, 1 respectively

Diffuse Reflection

Page 28: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 28

‰ The amount of incident light depends on the orientation of the

surface relative to the light source direction.

Modeling Diffuse Reflection

Page 29: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 29

The amount of incident light on a surface depends on the angle of incidence:

As θ

increases, the brightness of

the surface decreases by

Diffuse Reflection

Page 30: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 30

Ambient Light vs. Diffuse Reflection

Page 31: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 31

Ambient + diffuse reflections produce shaded images that appear

three‐dimensional. ‰ But the surfaces look dull, somewhat like chalk ‰

Diffuse Lighting

Page 32: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 32

I = Ipkd (N •L)

Usually implies:

I = Ipkd (N •L, 0)

Page 33: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 33

So far, we have considered only point lights

A light source at a near-infinite distance away from a surface has near-parallel

rays.

The vector made from the surface to the light source is always the same for

every surface.

This is known as a directional light – light from a known direction- not

position.

We do not specify a position for directional lights, just a vector to indicate ray

direction.

Directional Light

Page 34: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 34

Application of Directional Lights

To implement a directional light into the illumination equation,

we simply use the same light vector in every different surface illumination

equation –

i.e. L does not change, as it is constant for the light source.

I = Ipkd (N •L)

It is rare that we have an object in the real world illuminated only by a single

light. Even on a dark night there is a some ambient light. To make sure all

sides of an object get at least a little light we add some ambient light to the

point or directional light:

Page 35: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 35

Concatenation of Illuminations

Lambert’s lighting model can be combined with the previous ambient light

equation.

Page 36: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 36

Attenuation of Light

The above is an example of lighting with no attenuation and below is an

example with a more realistic attenuation of light.

Real light has an attenuation factor – light intensity becomes weaker over

distance.

In a similar manner, the perception of sound volume decreases the further

away you are from its source.

Page 37: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 37

To include attenuation into our illumination equation, we need to insert an

attenuation factor into the lighting section – in this case labeled fatt

Application of Attenuation

I = Iaka + fattIpkd (N •L)

With this multiplying factor in place, we can control the intensity of light based on

distance.

An fatt of 0 would effectively turn the light off.

An fatt of 1 would result in a maximum intensity of the light. Light fall off obeys

what is commonly known as the inverse square law – its intensity decreases

exponentially in relation to distance.

If we consider the distance from the surface point to the light L as dL…

fatt = 1/ dL2

Page 38: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 38

Light Color

So far the notion of using the illumination equation has had no reference to

actual color – only monochromatic intensity.

What we require to do so, are 3 equations, to represent the Red, Green and

Blue data.

E.g.

Page 39: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 39

Specular reflection is observed in shiny or polished surfaces. Illuminating a polished sphere, such as a

glass ball, with a bright white light, produces a highlight of the same color as the incident light.

Specular reflection is also influenced by the angle of incidence.

Figure shows the angles in specular reflection.

Specular Reflection

Page 40: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 40

In Figure you can notice that in specular reflection the angle of incidence

is the same as the angle of reflection. In a perfect reflector specular

reflection is visible only when the observer is located at the angle of

reflection. Objects that are not perfect reflectors exhibit some degree of

specular reflection over a range of viewing positions located about the

angle of reflection. Polished surfaces have a narrow reflection angle while

dull surfaces have a wider one.

Specular Reflection

Page 41: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 41

Specular Reflection

Intensity depends on where the viewer is!

The white specular

highlight is the reflection of white light from the source in the direction of th

e viewer

Page 42: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 42

The bright spot that we see on a shiny surface is the result of incident light

reflected in a concentrated region around the specular reflection angle ‰

The specular reflection angle equals the angle of the incident light

Specular Reflection ‰

Page 43: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 43

A perfect mirror reflects light only in the specular‐reflection direction ‰

Other objects exhibit specular

reflections over a finite range of viewing positions around vector R

Specular Reflection ‰

Page 44: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 44

Phong Bui-Toung described a model for non-perfect reflectors. The Phong model, which is widely

used in 3D graphics, assumes that specular reflectance is great in the direction of the reflection

angle, and decreases as the viewing angle increases.

The shaded areas in Figure show Phong reflection for a shiny and a dull surface. A polished surface is

associated with a large value for n, while a dull surface has a small n.

Phong's Model

Page 45: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 45

The Phong model enjoys considerable popularity because of its simplicity, and because it

provides sufficient realism for many applications. It also has some important drawbacks:

1. All light sources are assumed to be points.

2. Light sources and viewers are assumed to be at infinity.

3. Regardless of the color of the surface all highlights are rendered white.

Resulting from these limitations, the following observations have been made regarding the

Phong model:

1. The Phong model does not render plastics and other colored solids very well. This results

from the white color or all highlights.

2. The Phong model does not generate shadows. This makes objects in a scene to appear to

float in midair.

Phong's Model

Page 46: advanced computer graphics - Reflection model

February 5, 2015 46 [email protected]

Specular Reflection ‰

Page 47: advanced computer graphics - Reflection model

February 5, 2015 47 [email protected]

Page 48: advanced computer graphics - Reflection model

February 5, 2015 48 [email protected]

Page 49: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 49

Page 50: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 50

Page 51: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 51

Page 52: advanced computer graphics - Reflection model

February 5, 2015 52

reflection off of shiny surfaces - you see a highlight

shiny metal or plastic has high specular component

chalk or carpet has very low specular component

position of the viewer is important in specular reflection

I = Ip cosn(a) W(Ɵ)

I: intensity

Ip: intensity of point light

n: specular-reflection exponent (higher is sharper falloff)

W: gives specular component of non-specular materials

So if we put all the lighting models depending on light together we add up their

various components to get:

I = Ia Ka + Ip Kd(N' * L') + Ip cosn(a) W(Ɵ)

[email protected]

Specular Reflection

Page 53: advanced computer graphics - Reflection model

February 5, 2015 53 [email protected]

Page 54: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 54

Shiny surfaces exhibit specular reflection – the reflection of the light source

towards the viewer.

Specular reflection has 2 main color biases:

1. The color of the specular reflection is determined by the light source color.

or

2. The color of the specular reflection is determined by the color of the surface.

Objects that have waxed, or transparent surfaces (apples, plastic, etc.) tend to

reflect the color of the light source.

Plastic, for example, is composed of color pigments suspended in a

transparent material.

…and Gold has a gold colored highlight.

Specular Reflection

Page 55: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 55

The above diagram describes a perfectly mirrored surface.

The viewer is seen looking at a point on the surface: viewing vector E.

The light source L emanates a ray of light that that hits the surface with an angle

of i relative to the normal.

The angle of reflection of the light ray then leaves with an angle r relative to the

normal. The angle of incidence i is the same as angle r.

In a perfect mirror (above), the viewer may ONLY see the light ray if the viewing

angle E is directly opposite of the reflection vector R.

Specular Reflection

Page 56: advanced computer graphics - Reflection model

February 5, 2015 56 [email protected]

Diffuse vs. Specular

• diffuse

incident light is reflected into many different

directions

matte surfaces

• specular (mirror-like)

incident light is reflected into a dominant

direction (perceived as small intense specular

highlight)

shiny surfaces

• diffuse and specular reflection are material

properties

Page 57: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 57

Diffuse vs. Specular

Page 58: advanced computer graphics - Reflection model

February 5, 2015 [email protected] 58

Diffuse vs. Specular

Page 59: advanced computer graphics - Reflection model

February 5, 2015 59 [email protected]