Home page A B C D E F G H I K L M N O P Q R S T U V W X Y Z

Light sources

Udocheals.orgLight source in computer graphics
6.14.2017 | Logan Miers
Light source in computer graphics
Light sources

Light is spreading steadily and with equal intensity in all directions. A point source is definiy determined by its intensity and position. The most commonly used in computer graphics.

$$$APPLET Applet Point light source and parallel light source.

$$$APPLET Applet Gouraud shading.

$$$APPLET Applet Flat shading.

The resulting normal vector N is calculated through the interpolation of the x coordinate:

Calculation of the color of all points on the screen, however, is a time-consuming operation, and therefore, methods allowing fast calculation have been designed. These methods are called shading. By shading is understood the drawing of objects using color shades, naturally established through curved surfaces, giving a better image of them. From the previous text we know how to assess the color of points on the surface of a lighted area, providing we know the direction of a projecting ray, the normal of the surface at a given point and other factors affecting the resulting color of the point. It is achieved so as a precise calculation is made only at several points, and others are derived using these points.

This shading is suitable for fast previewing of bodies approximated by patches. It is not appropriate for the quality displaying of general bodies because it emphasizes the fact that a round surface is approximated by patches.

It is defined as an oriented polygon characterized by its own radiance. This was rather difficult in the case of using the previous light sources. This source is the most realistic. It requires a lot of time for calculation, but the results are relatively good, shading in particular looks realistic.

$$$APPLET Applet Phong shading.

On the basis of the number of lines between two corners of the edge we can determine the vector differential dNa, dNb on the edges a, b. At the corners of this square, we assign the normal vectors: N1, N2, N3, N4. Example: scanning of algorithm y crossing the given square in two limit points of edges a, b. Then, calculation of normal vectors in the switch from one line to another is simplified into adding the differentials:.

Na = Na + dNa, br \> Nb = Nb + dNb, br \>

Where a normal is not given, we calculate it from the relevant plane surface. For each surface we usually just have one given normal. Flat shading is the simplest and also the fastest method. It is used in displaying plane surfaces that are approximated by flat patches. On the basis of this normal, we assign the relevant color hue, which after rastering of this surface, is assigned to all its points.

Let's have a polygon (in our case a triangle) which has given intensities at its corners.

We can use an algorithm of line scanning of normal vectors for this. Therefore, we assess normal vectors at the corners of polygons. However, here we interpolate normal vectors. Similarly as in the case of Gouraud shading, Phong shading is also based on interpolation.

$$$APPLET Applet Reflektor. The light intensity of the reflector is maximal in the direction in which it radiates, and it drops exponentially perpendicular to this direction. We can imagine it as a cone where at the top there is a point light source. The internal cone represents a beam of clear light. A reflector is direction dependent light source, determined by its surface and orientation. The external one determines the frontier at which the light moves. A more realistic representation is achieved using a couple of parallel-axes cones with a common top. The intensity of the light declines with the distance from the axis where it is maximal, down to the frontiers of the external cone, where it is zero.

Light sources emit light radiation. Because it is not possible to totally describe all light sources, several standard light sources are introduced in computer graphics. For instance, a bulb can be light source. A light source is an object that manifests itself only through light radiation.

$$$APPLET Applet Surface light source.

Example : Interpolation of intensity for a triangle.

(x-x a ) / (x b -x a ). (x b -x) / (x b -x a ) + Nb. N = Na.

It is advantageous for shading bodies the surface of which comprises a set of polygons. Gouraud shading is based on the interpolation of light intensity on edges of a surface and its interpolation using scanline. This method is also known as bilinear interpolation. These can be determined on the basis of the normal using a lighting model, for example the Phong model (10.2.3). Then, we can calculate the color hue for the internal points of the polygon. This method is an approximation method, but very fast, and used in applications requiring a real-time response. In shading, we need information on the colors of every corner of a given polygon.

Light rays from such a source are radiated parallelly. Normally, it is set as a surface at a finite distance, and then, its rays are radiated perpendicularly to this surface. This type can be imagined as a point light source lying in infinity.

In the following step, we assign an intensity of the corner using a lighting method. In the case that we do not have normal vectors at the corners, we must determine them the sum (or average) of the normal of the incident surfaces of this corner. Finally, we interpolate the intensities for the given polygon.

Light source in computer graphics