Beruflich Dokumente
Kultur Dokumente
If we look at a point on an object we perceive a colour Looking at a point on an object we see the reflection
and a shading intensity that depends on the various of the light that falls on it. This reflection is governed
characteristics of the object and the light sources that by:
illuminate it.
1. The position of the object relative to the light sources
For the time being we will consider only the 2. The surface normal vector
brightness at each point. We will extend the treatment 3. The albedo of the surface (ability to adsorb light energy)
to colour in the next lecture. 4. The reflectivity of the surface
The important properties of the light source are Surfaces can have reflective characteristics ranging
from:
1. Intensity of the emitted light
2. The distance to the point on the surface 1. Dull, (matt) surfaces
2. Shiny (specular) surfaces
(When considering colour the first is an intensity 3. Reflective (mirror) surfaces.
distribution as we shall see later)
We will consider matt surfaces first.
1
Matt surfaces Lambert’s Cosine Law
Ireflected = Ii kd Cos(θ)
Incident where
Light Ii is the intensity of the incident light
Kd is a constant (surface albedo)
and θ is the angle between the surface normal and the
Perfectly Matt surface direction of the light source
The reflected intensity is the same in all directions
Light Source Strictly speaking the surface properties will vary with
the wavelength of the light (λ) so we should write:
If we specify our graphics scene in 3D space it is Pure diffuse shading is impossible to achieve in a
convenient to use vectors for the light source direction scene of several objects, since light that is reflected is
and the surface normal. itself a light source.
since n.s = |n||s|Cos(θ) Thus in addition to the direct light from the light
we can write Cos(θ) = n.s / |n||s| sources there is also a background ‘ambient’ light.
2
Radiosity Reflectance equation with ambient light
There is usually more energy emitted in the reflected Slightly specular (shiny) surface
Perfectly Matt surface
direction than any other. The reflected intensity is the same in all directions Slightly higher intensity in the reflected direction
3
Bui-Tuong Phong formula Simplifications and Complications
This empirical formula has gained universal Usually f(θ) is taken to be a constant giving a
acceptance. complete reflectance equation as:
where Ii is the incident light intensity, Some systems specify separate intensities for each
f(θ) is a function that depends on the angle between component from each light source.
the incident light ray and the surface normal
t is the shininess Ireflected = Ia ka + Ii kd Cos(θ) + Ii Ks cost(α)
Ireflected = ka + Ii kd n.s / |n||s| + Ii Ks (r.v / |r||v|)t It is well known that light falls off according to an
inverse square law. Thus, if we have light sources
In practice we can make life easier by normalising all close to our polygons we should model this effect.
the vectors so that they are specified as unit vectors.
I = Ii/d2
n=n/|n| s=s/|s| r=r/|r| v=v/|v|
where
I is the incident light intensity at a point on an object
Ireflected = ka + Ii kd n.s + Ii Ks (r.v)t Ii is the light intensity at the source and
d is the distance from the light source to the object
Although physically correct the inverse square law One might be tempted to think that light intensity falls
does not produce the best results. off with the distance to the viewpoint, but it doesn’t!
I = Ii/(d + k)
4
Using Shading Flat Shading
There are three levels at which shading can be applied Each polygon is shaded uniformly over its surface.
in polygon based systems:
The shade is computed by taking a point in the centre
Flat Shading and the surface normal vector. (Equivalent to a light
Gouraud Shading source at infinity)
Phong Shading
Usually only diffuse and ambient components are
They provide increasing realism at higher used.
computational cost
Local Light Source Flat Shading A more accurate way to render a shaded polygon is to
compute an independent shade value at each point.
5
Interpolating over polygons: Gouraud Shading Computing an average normal vector at a vertex
n2 Gouraud Shading
n3 (Object Space)
The averaged normal is used to compute a shade One limitation of Gouraud shading is that we cannot
value for the vertex. determine specular components accurately, since we
do not have the normal vector at each point on a
This is then interpolated as before. polygon.
The boundaries of the polygons are thus smoothed A solution is to interpolate the normal vector, not the
out. shade value.
We may express any point for this facet in parametric The interpolation calculations may be done in either
form: 2D or 3D
P = V1 + µ1(V2 - V1) + µ2(V3-V1)
The average normal vector at the same point may be For specular reflections the calculation of the
calculated as the vector a: reflected vector and viewpoint vector must be done in
a = n1 + µ1(n2 - n1) + µ2(n3-n1) 3D.
and then
naverage = a / | a |
6
Bump Mapping Bump Mapping
Bump Mapping