Unit 6 Illumination models and surface rendering methods

5th Semester

figure is missing..
Light source
Light source means an object that is emitting radian energy. For example, a light bulb, the sun etc. When we view an opaque non-luminous object, we see reflected light from the surface of the object. The total reflected light is the sum of the contribution from the light source and other reflective surfaces as shown in the figure:
 
Fig: Light viewed from an opaque non luminous surface is in general a combination of reflected light from a light source and reflection of light reflection from other surfaces.
Thus a surface that is not directly exposed to light sources may still be visible if nearby objects are eliminated.
Light sources that illuminate on object are of two types:

  • Light emitting sources and
  • Light reflecting sources

 
Point Source
When the surface of the object that we want to illuminate is bigger than the surface of light emitting source then we call the light emitting source as a point source. Point source is the simplest light emitter that emits light in equal intensity in all directions e.g. light bulb, sun etc.
 
Fig: A point source
Distributed light source
When the surface of light emitting source is greater than the surface of object then it is called as a distributed light source. All of the rays from a directional/distributed light source have the same direction, and no point of origin. All light rays are parallel. For example, a Fluorescent tube light.
 





Reflection of light
When light is incident on opaque surface part of it is reflected and part of it is absorbed.
∴ I = A+R
The amount of incident light reflected by a surface depends on the type of material. Shining material reflects more incident light and dull surface absorbs more of the incident light. For transparent surfaces, some of the incident light will be reflected and some will be transmitted through the material.
Rough surface tends to scatter the reflected light in all direction. The scattered light is called diffuse reflection. So surface appears equally bright from all viewing directions.
Fig: Diffuse reflections from a surface.
In addition to diffuse refection, light source creates high lights or bright spots called specular reflection. However, this effect is seen more on shiny surface then dull surfaces. Example: Persons forehead.
Fig: Specular reflection.
Some useful concepts
 
Basic illumination models
A model for the interaction of light with a surface is called an illumination model. 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. Some illumination models are:

  1. Ambient light

Surface that is not exposed directly to a light source still will be visible if nearby objects are illuminated. This light is called ambient light. 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.





If a surface is exposed only to ambient light, then the intensity of the diffuse reflection at any point on the surface is;
I = kaIa.
Where Ia is the intensity of the ambient light, and ka is the ambient reflection coefficient.
         Fig: Object illuminated due to ambient light.
Ambient light does not come from a specific light source and has no direction. It represents the light that is more or less everywhere in the scene, originating from multiple reflections of light at various surfaces. In a room with a lamp on a table, it will not be completely dark under the table although the lamp cannot shed its light directly under the table. The light is reflected by the surface of the table, the walls, the ceiling and the floor. Of course, the light under the table will have a lower intensity, but it will still be there with approximately the same intensity everywhere, not coming from a specific direction.
 

  1. Diffuse reflection

Objects illuminated by ambient light are uniformally illuminated across their surfaces then the illumination is called diffuse illumination. It is the background light reflected from walls, floor and ceilings. We assume that the reflection is constant over each surface of the object and are independent of the viewing direction. This type of reflection on dull surfaces is called diffuse reflection.
 
 
 
 
 

Fig: Diffuse reflection

 
 
 
This effect of light reflection for purely dull surfaces can be computed according to Lambert’s cosine law by the illumination equation:
I= IL. Kd . cosθ…………………………..(1)
Where IL is the intensity of the light hitting the surface, 0 ≤ kd1 is the reflection coefficient of the surface or the material, and θ is the angle between the normal vector n to the surface in the considered point and the vector I pointing in the direction where the light comes from.
The illumination equation (1) for diffuse reflection is only valid for angles θ between 0° and 90°. Otherwise, the light ray hits the surface from the backside so that no reflection occurs. In the case of directional light coming from a light source in infinite distance, the variable IL in (1) has the same value everywhere. In the case of a point light source, IL is the intensity of the light source multiplied by the attenuation factor, which depends on the distance of the point on the surface to the light source.
 

  1. Specular reflection

When we look at an illuminated shiny surface, such as polished metal, a person’s forehead, we see a highlight or bright spot, at certain viewing direction. Such phenomenon is called specular reflection. This phenomenon occurs as a result of total internal reflection of the incident light in a concentrated region around the specular reflection angle. Due to this phenomenon, the surface appears to be not in its original color but of white color.
Diffuse reflection on dull surfaces reflects the light into all directions. Specular reflection occurs on shiny surfaces. Such shiny surfaces reflect at least a portion of the light in a similar way as a mirror. In contrast to diffuse reflection, ideal specular reflection takes place only in one direction. The difference between diffuse and specular reflection is illustrated in fig below.



 
 
 
 
 
 
Fig: Difference between diffuse and specular reflections

 
 
 
 
 
Fig: Specular reflection
 
Shiny surfaces very often have a very thin transparent layer, for instance varnish. When light hits the surface, part of the light penetrates the varnish layer and is reflected on the dull surface of the object. This part of the light is subject to diffuse reflection and the color of the reflected light depends strongly on the ground color of the dull surface. Another part of the light is directly reflected on the transparent layer by specular reflection. Therefore, specular reflection does usually not change the color of the light.
The position of the viewer is of no importance for calculating effects coming from diffuse reflection. Whether or where the viewer can see specular reflection depends on his position.
The Phong specular reflection model described by the relation,
I=IL. w(θ). cos()n…………………(1)
Where, IL is the intensity of the light. The value 0 ≤ W(θ) ≤ 1 is the fraction of the light which is directly reflected at the shiny surface. n is the specular reflection exponent of the surface. For a perfect mirror, n=∞ would hold. A smaller n leads to a less focused specular reflection.



 
Transparency
Transparent surfaces reflect a part of the light, but objects behind them can also be seen. A typical transparent object is a colored glass pane. A transparent surface, in general, produces both reflected and transmitted light. The relative contribution of the transmitted light depends on the degree of transparency of the surface and whether any light sources or illuminated surfaces are behind the transparent surface. Transparency means that only a fraction of the light of the objects behind the transparent surface can pass through the transparent surface, but no distortion as with frosted glass happens. Such objects like milk glass are called translucent.
Fig: Light emission from a transparent surface is in general a combination of reflected and transmitted light.
Transparency in Java 3D
Java 3D provides the class TransparencyAttributes to model transparency.
The method setTransparencyMode() defines the chosen type of transparency, i.e., interpolated or screen-door transparency.
The transmission coefficient is specified with the method
setTransparency() as a float-value between zero and one. The instance of the class TransparencyAttributes must then be assigned to an Appearance app by the method setTransparencyAttributes().
TransparencyAttributes ta = new TransparencyAttributes();
ta.setTransparencyMode( TransparencyAttributes.BLENDED);
ta.setTransparency(transpCoeff);
app.setTransparencyAttributes(ta);
The second line chooses interpolated transparency by specifying BLENDED. For screen-door transparency, BLENDED has to be replaced by SCREEN_DOOR. The program TransparencyExample.java demonstrates the use of these two types of transparency.
 
Shadows
Shadow can help to create realism. Without it, a cup, e.g., on a table may look as if the cup is floating in the air above the table. By applying hidden-surface methods with pretending that the position of a light source is the viewing position, we can find which surface sections cannot be “seen” from the light source shadow areas. We usually display shadow areas with ambient-light intensity only.




“Casting a shadow” is not an active matter, but simply the lack of light from a light source that does not reach the object’s surface with the shadow on it.

 
 
 
 
 
 
 
Fig: Shadow on an object
Polygon rendering methods

  • How to compute the intensity across the polygon?
    • Compute the intensity at all points:
      • Unnecessary and impractical.
    • Compute the intensity at the center and use this to represent the whole polygon: Flat shading.
    • Compute intensity at key points and interpolate for the rest: Gouraud and Phong shading.
  • Polygon rendering is the process of calculating intensity and color considerations for a polygon surface.
  • There are two ways of polygon rendering:
    • Render each polygon surface with single intensity, or
    • Calculate intensity at each point of the surface using interpolation scheme.




  • In order to produce a realistic image with various kinds of reflection, there are 3 common shading methods which are mainly applied to polygons:
    • Constant Intensity shading Method.
    • Gouraud Shading method (Intensity Interpolation)
    • Phong Shading Method (Normal Vector Interpolation).

 
Constant intensity shading

  • A simple and the most computationally efficient polygon rendering method is constant intensity shading, also called as Faceted Shading or flat shading.
  • In this method single intensity is calculated for each polygon. Generally, intensity value at the center is calculated. And all points over the surface of the polygon are then displayed with same intensity value.
  • It does not provide realistic displaying.

 
Fig: Flat Shading

  • It provides an accurate rendering for an object if all of the following assumptions are valid:
    • Polygon surface must be one face of a polyhedron and is not a section of a curved-surface.
    • All light sources illuminating the polygon are sufficiently far from surface. (diffuse reflection)
    • The viewing position is sufficiently far away from the surface. (specular reflection)

 
Gouraud Shading

  • This intensity-interpolation scheme developed by Henri Gouraud and generally referred to as Gouraud shading. It renders the polygon surface by linearly interpolating intensity values across the surface.
  • Idea is to calculate intensity values at polygon vertices. Then, linearly interpolate these intensities across polygon surfaces of an object.
  • It provides realistic lighting. But it can cause bright or dark intensity streaks to appear on the surface called Mach banding. That is, it cannot handle specular reflection very well.

                   
Fig: Gouraud Shading
Algorithm:

  • Determine the average unit normal vector at each polygon vertex.
  • Then compute the intensity values at each polygon vertex.
  • Linearly interpolate the vertex intensities over the surface of the polygon.



Once Nv is known, intensity at the vertices can obtain from lighting model.

 
 
 
 
 
 
 
 
 

  • Here in figure, the intensity of vertices 1, 2, 3 are I1, I2, I3 are obtained by averaging normal’s of each surface sharing the vertices and applying a illumination model.
  • For each scan line, intensity at intersection of line with Polygon edge are linearly interpolated from the intensities at the edge end point.

So Intensity at intersection point A, Ia is obtained by linearly interpolating intensities of I1 and I2 as`
Similarly, the intensity at point B is obtained by linearly interpolating intensities at I2 and I3 as
The intensity of a point P in the polygon surface along scan-line is obtained by linearly interpolating intensities at Ia and Ib as,
 
 
 
 
 
 
 
 
Then incremental calculations are used to obtain Successive edge intensity values between scan- lines as:
Then we can obtain the intensity along this edge for next scan line at y -1 position as
 
 




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.

 
Phong Shading

  • Best known shading algorithm, developed by Phong Bui Tuong, is called Phong shading or normal vector interpolation shading.
  • Idea here is to interpolate the normal vectors instead of the light intensity. Then apply the illumination model at each surface point.
  • Provides more accurate calculation of light intensity values and more realistic surface highlights. But it is computationally inefficient.

 
Algorithm

  • Determine the average unit normal vector at each polygon vertex.
  • Linearly interpolate the vertex normal over the surface of the polygon.
  • Apply an illumination model along each scan line to calculate pixel intensities for the surface points. The intensity value is calculated using the interpolated normal vector.

                  Fig: Phong Shading