Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Graphics Note 8

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

Unit 8: Illumination Models and Surface Rendering Techniques (5 Hrs.

Overview of illumination and Surface-Rendering Models:

 Realistic displays of a scene are obtained by perspective projections and applying natural
lighting effects to the visible surfaces of object.
 An illumination model is also called lighting model and sometimes called as a shading model which is
used to calculate the intensity of light that we should see at a given point on the surface of
a object.
 A surface-rendering algorithm uses the intensity calculations from an illumination model.
Light Sources:
Sometimes light sources are referred as light emitting object and light reflectors. Generally light
source is used to mean an object that is emitting radiant energy e.g. Sun.
Point Source: Point source is the simplest light emitter e.g. light bulb.
Distributed light source: Fluorescent light

 When light is incident on an opaque surface part of it is reflected and part of it is absorbed.
 Surface that are rough or grainy, tend to scatter the reflected light in all direction which is called diffuse
reflection.

 When light sources create highlights, or bright spots, called specular reflection

. Basic Illumination models:

Illumination models are used to calculate light intensities that we should see at a given point on the
surface of an object. Lighting calculations are based on the optical properties of surfaces, the background
lighting conditions and the light source specifications. All light sources are considered to be point sources,
specified with a co-ordinate position and an intensity value (color). Some Basic illumination models are:

1. Ambient light:

A surface that is not exposed directly to a light source still will be visible it nearby objects are illuminated.
In our basic illumination model, we can set a general level of brightness for a scene. This is a simple way to
model the combination of light reflections from various surfaces to produce a uniform illumination called the
ambient light, or background light. Ambient light has no spatial or directional characteristics. The amount of
ambient light incident on each object is a constant for all surfaces and over all directions.

Ambient Reflected light has the light component which is non directional and is expressed as the product of
multiple reflection from the surrounding. The ambient reflection coefficient K ar gives the amount of reflected
ambient light from the surface of the object assuming that the intensity I a is constant for all objects. The ambient
illumination equation is written as:

I= Kar Ia
Where, Kar: Ambient reflection coefficient
Ia: Intensity of ambient light
I: The intensity of reflected light
The ambient reflection coefficient ranges from 0 to 1

2. Diffuse Reflection:
Objects illuminated by ambient light are uniformly illuminated across their surfaces even though light are
more or less bright in direct proportion of ambient intensity. Illuminating object by a point light source,
whose rays enumerate uniformly in all directions from a single point. The object’s brightness varies from
one part to another, depending on the direction of and distance to the light source.
 The fractional amount of the incident light that is diffusely reflected can be set for each surface
with parameter dK, the coefficient of diffuse-reflection.
 Value of dK is in interval 0 to 1. If surface is highly reflected, dK is set to near 1. The surface that absorbs
almost incident light, dK is set to nearly 0.
 Diffuse reflection intensity at any point on the surface if exposed only to ambient light is

 Assuming diffuse reflections from the surface are scattered with equal intensity in all directions,
independent of the viewing direction (surface called. "Ideal diffuse reflectors") also called Lambertian
reflectors and governed by Lambert's cosine law.

Where lI is the intensity of the point light source.

It N is unit vector normal to the surface & L is unit vector in the direction to the point slight source then

3. Specular Reflection and Phong Specular Reflection Model:

On viewing the illuminated shiny surfaces from certain directions a bright spot can be seen which the result of
reflection of incident light concentrated in one direction and the phenomenon is known as Specular Reflection.

The angle of Specular Reflection equals the angle of the incident light measured on the two sides of the normal
which is denoted by θ whereas angle ø is the angle of viewing direction.
Fig: Specular-reflection equals the angle of incidence θ

An empirical model for calculating specular-reflection range developed by Phong Bui Tuong called Phong
specular reflection model (or simply Phong model), sets the intensity of specular reflection ,as objects which are
not ideal reflection show specular reflections over a long range of viewing positions. The specular reflection range
is narrow for shiny surfaces whereas dull surfaces have a longer range. The intensity of specular reflection is:

Specular reflection parameter ns is determined by type of surface that we want to display:

 Very shiny surface: large ns (say 100 or more) and


 dull surface , smaller ns (down to 1)
 For perfect reflector ns is infinite.

The intensity of specular reflection depends on the material properties of the surface and the angle of
incidence (θ), as well as other factors such as the polarization and color of the incident light. We can
approximately model monochromatic specular intensity variations using a specular-reflection coefficient,
W(θ) for each surface over a range θ = 0° to θ = 90°. In general, W(θ) tends to increase as the angle of incidence
increases. At θ = 90°, W(θ) = 1 and all of the incident light is reflected.

The variation of specular intensity with angle of incidence is described by Fresnel's laws of Reflection.
Using the spectral-reflection function W(θ), we can write the Phong specular reflection model as:

Where Il is intensity of light source. Ø is viewing angle relative to SR direction R.

Difference between ambient, diffuse, and specular reflection:

Ambient

 Approximates the effect of inter-reflections


 Source less – constant over entire surface
 Does not depend on surface normal
 Does not vary based on viewpoint

Diffuse

 Models rough surfaces (e.g. paper or drywall) – where light scatters equally in all directions
 Has a point or directional source
 Depends on surface normal – brightest where the surface is oriented toward the light, and falls off to
zero at 90°
 Does not vary based on viewpoint

Specular

 Models highlights from smooth, shiny surfaces (e.g. opaque plastic)


 Has a point or directional source
 Depends on surface normal
 Depends on viewpoint

7. Overview of Shading and Polygon-Rendering Models:

Rendering:

Rendering is the process of generating, interpreting or presenting a picture, scene or a model realistically by
means of software programs. The word “Rendering” is also said to be a process of calculating effects in a file of
video editing in order to get the output i.e. the final video. The major field in which the rendering is used are video
special effects, video games, simulators etc.

Rendering can be simply classified as two types:

 Pre-rendering:
This is an intensive process. Computationally and is used specially for movie creation.

 Real time rendering:


This is usually done for three-dimensional video games which depends on the use of Graphic cards.

Reflection changes the saturation on the surface and this changes is known as shading. Shading depends on a
number of factors such as different angles which are formed, which may be between the source of light, viewer
and object surface. Shading can be done in any surface by calculating the surface normal at each visible point
and applying the desired illumination model at that point.

Shading:

Shading is referred to as the implementation of the illumination model at the pixel points or polygon surfaces of
the graphics objects.Shading model is used to compute the intensities and colors to display the surface. The
shading model has two primary ingredients: properties of the surface and properties of the illumination falling on
it. The principal surface property is its reflectance, which determines how much of the incident light is reflected. If
a surface has different reflectance for the light of different wavelengths, it will appear to be colored.

An object illumination is also significant in computing intensity. The scene may have to save illumination that is
uniform from all direction, called diffuse illumination.

Shading models determine the shade of a point on the surface of an object in terms of a number of attributes.
The shading Mode can be decomposed into three parts, a contribution from diffuse illumination, the contribution
for one or more specific light sources and a transparency effect. Each of these effects contributes to shading term
E which is summed to find the total energy coming from a point on an object. This is the energy a display should
generate to present a realistic image of the object. The energy comes not from a point on the surface but a small
area around the point.
where Epd is the energy coming from point P due to diffuse illumination. Id is the diffuse illumination falling on
the entire scene, and Rp is the reflectance coefficient at P which ranges from shading contribution from specific
light sources will cause the shade of a surface to vary as to its orientation concerning the light sources changes
and will also include specular reflection effects. In the above figure, a point P on a surface, with light arriving at
an angle of incidence i, the angle between the surface normal Np and a ray to the light source. If the energy Ips
arriving from the light source is reflected uniformly in all directions, called diffuse reflection, we have

Eps=(Rp cos i)Ips


Commonly used shading methods are:

i. Constant Intensity Shading (Flat Shading):

A fast and straightforward method for rendering an object with polygon surfaces is constant intensity shading,
also called Flat Shading. In this method, a single intensity is calculated for each polygon. All points over the
surface of the polygon are then displayed with the same intensity value. Constant Shading can be useful for
quickly displaying the general appearances of the curved surface as shown in fig:
In general, flat shading of polygon facets provides an accurate rendering for an object if all of the following
assumptions are valid:-

 The object is a polyhedron and is not an approximation of an object with a curved surface.
 All light sources illuminating the objects are sufficiently far from the surface so that N. L and the
attenuation function are constant over the surface (where N is the unit normal to a surface and L is the
unit direction vector to the point light source from a position on the surface).
 The viewing position is sufficiently far from the surface so that V. R is constant over the surface (where
V is the unit vector pointer to the viewer from the surface position and R represent a unit vector in the
direction of ideal specular reflection).

ii. Gouraud Shading:


This Intensity-Interpolation scheme, developed by Gouraud and usually referred to as Gouraud Shading, renders
a polygon surface by linear interpolating intensity value across the surface. Intensity values for each polygon are
coordinate with the value of adjacent polygons along the common edges, thus eliminating the intensity
discontinuities that can occur in flat shading.
Each polygon surface is rendered with Gouraud Shading by performing the following calculations:
1. Determining the average unit normal vector at each polygon vertex.
2. Apply an illumination model to each vertex to determine the vertex intensity.
3. Linear interpolate the vertex intensities over the surface of the polygon.
At each polygon vertex, we obtain a normal vector by averaging the surface normals of all polygons staring that
vertex as shown in fig:
Once we have the vertex normal, we can determine the intensity at the vertices from a lighting model.

Following figures demonstrate the next step: Interpolating intensities along the polygon edges. For each scan
line, the intensities at the intersection of the scan line with a polygon edge are linearly interpolated from the
intensities at the edge endpoints. For example: In fig, the polygon edge with endpoint vertices at position 1 and
2 is intersected by the scan line at point.
4. A fast method for obtaining the intensities at point 4 is to interpolate between intensities I1 and I2
using only the vertical displacement of the scan line.
Similar calculations are made to obtain intensity successive horizontal pixel.

Advantages: Removes intensity discontinuities at the edge as compared to constant shading.

Disadvantages: Highlights on the surface are sometimes displayed with anomalous shape and linear intensity
interpolation can cause bright or dark intensity streak called mach-bands.

Gouraud Shading discards the intensity discontinuities associated with the constant-shading model, but it has
some other deficiencies. Highlights on the surface are sometimes displayed with anomalous shapes, and the
linear intensity interpolation can cause bright or dark intensity streaks, called Match bands, to appear on the
surface. These effects can be decreased by dividing the surface into a higher number of polygon faces or by
using other methods, such as Phong shading, that requires more calculations.

iii. Phong Shading:

A more accurate method for rendering a polygon surface is to interpolate the normal vector and then apply the
illumination model to each surface point. This method developed by Phong Bui Tuong is called Phong Shading or
normal vector Interpolation Shading. It displays more realistic highlights on a surface and greatly reduces the Match-
band effect.A polygon surface is rendered using Phong shading by carrying out the following steps:

1. Determine the average unit normal vector at each polygon vertex.


2. Linearly & interpolate the vertex normals over the surface of the polygon.
3. Apply an illumination model along each scan line to calculate projected pixel intensities for the surface points.

Incremental methods are used to evaluate normals between scan lines and along each scan line.
At each pixel position along a scan line, the illumination model is applied to determine the surface
intensity at that point.

Intensity calculations using an approximated normal vector at each point along the scan line
produce more accurate results than the direct interpolation of intensities, as in Gouraud Shading.
The trade-off, however, is that phong shading requires considerably more calculations.
iv. Fast Phong Shading:

Intensity attenuation and Color consideration, Transparency, Shadows:

Intensity attenuation:
Shadows:

Color consideration:
Color Model:
A color model is an orderly system for creating a whole range of colors from a small set of primary
colors. There are two types of color models, those that are subtractive and those that are additive.
Additive color models use light to display color while subtractive models use printing inks. Colors
perceived in additive models are the result of transmitted light. Colors perceived in subtractive models
are the result of reflected light.
The Two Most Common Color Models:
There are several established color models used in computer graphics, but the two most common are
the RGB model (Red-Green-Blue) for computer display and the CMYK model (Cyan-Magenta-Yellow-
blacK) for printing.

Notice the centers of the two color charts. In the RGB model, the convergence of the three primary
additive colors produces white. In the CMYK model, the convergence of the three primary subtractive
colors produces black.
In the RGB model notice that the overlapping of additive colors (red, green and blue) results in
subtractive colors (cyan, magenta and yellow). In the CMYK model notice that the overlapping of
subtractive colors (cyan, magenta and yellow) results in additive colors (red, green and blue).
Also notice that the colors in the RGB model are much brighter than the colors in the CMYK model. It
is possible to attain a much larger percentage of the visible spectrum with the RGB model. That is
because the RGB model uses transmitted light while the CMYK model uses reflected light. The muted
appearance of the CMYK model demonstrates the limitation of printing inks and the nature of
reflected light.
Additive vs. Subtractive Color Models:
Since additive color models display color as a result of light being transmitted (added) the total
absence of light would be perceived as black. Subtractive color models display color as a result of
light being absorbed (subtracted) by the printing inks. As more ink is added, less and less light is
reflected. Where there is a total absence of ink the resulting light being reflected (from a white
surface) would be perceived as white.

You might also like