Beruflich Dokumente
Kultur Dokumente
CHENNAI
CS6504-COMPUTER GRAPHICS
PART – B
1. Explain in detail the basic illumination models.
Light Sources
Point
Infinitely Distant
Problems: Point Source with 1/d2 attenuation does not always produce realistic
results.
Produces too much intensity variation for near objects and not enough for
distant.
Diffuse Reflection
Specular Reflection
Ambient
1. Directly from existing light sources such as the sun or a lit candle
2. Light that passes and refracts through transparent objects such as water or a glass vase
3. Light reflected, bounced, or diffused from other exisiting surfaces in the environment
Local Illumination
Material Models
Diffuse illumination
2. L, a vector from the surface position that points towards the light source.
3. Il, an intensity for a point light source.
Equation gives the brightness of a surface point in terms of the brightness of a light source
and its orientation relative to the surface normal vector, n,
I is converted into frame buffer intensity values by multiplying by the number of shades available.
With 28 = 256 possible shades, we have 1 * 255, the brightest frame buffer
intensity.
Ambient illumination
Most objects are not perfect mirrors. some angular scattering of light.
If the viewer increases the angle ( ) between himself, the line of sight vector (S), and the
reflectance vector (R), the bright spot gradually disappears.Smooth surfaces scatter light less then
rough surfaces.
Dithering - A technique used in quantization processes such as graphics and audio to reduce or
remove the correlation between noise and signal.
Dithering is used in computer graphics to create additional colors and shades from an existing
palette by interspersing pixels of different colors. On a monochrome display, areas of Grey are
created by varying the proportion of black and white pixels. In color displays and printers, colors
and textures are created by varying the proportions of existing colors. The different colors can
either be distributed randomly or regularly.
The higher the resolution of the display, the smoother the dithered color will appear to the eye.
Dithering doesn't reduce resolution. There are three types: regular dithering which uses a very
regular predefined pattern; random dither where the pattern is a random noise; and pseudo random
dither which uses a very large, very regular, predefined pattern.
Dithering is used to create patterns for use as backgrounds, fills and shading, as well as for
creating halftones for printing. When used for printing is it very sensitive to paper properties.
Dithering can be combined with rasterising. It is not related to anti-aliasing.
Dithering technique:
Dither algorithm performs an optimal adding of a sequence of images as far as resolution is
concerned. The principle is that, at sub-pixel level, shifts between individual input images are
nearly randomly distributed. For example, a star in the first image may be centered perfectly in the
middle of a pixel, whereas it will be across two pixels in the second one, and so on. Since it is easy
to know the exact shift between the images, it is possible to create an output image with a finer
sampling, in which resolution may be increased with respected to each input image. In fact, energy
from each input pixel is dropped in the output image.
Dither should be added to any low-amplitude or highly-periodic signal before any quantization or
re-quantization process, in order to De-correlate the quantization noise with the input signal and to
prevent non-linear behavior (distortion); the lesser the bit depth, the greater the dither must be. The
results of the process still yield distortion, but the distortion is of a random nature so its result is
effectively noise. Any bit-reduction process should add dither to the waveform before the reduction
is performed.
Half toning
3. Explain in detail the various standards primaries and chromaticity diagram used XYZ color
space in color models.
A color model is an abstract mathematical model describing the way colors can be represented
as tuples of numbers, typically as three or four values or color components. When this model is
associated with a precise description of how the components are to be interpreted (viewing
conditions, etc.), the resulting set of colors is called color space. This section describes ways in
which human color vision can be modeled.
The tristimulus theory of colour perception seems to imply that any colour can be obtained
from a mix of the three primaries, red, green and blue, but although nearly all visible colours
can be matched in this way, some cannot. However, if one of the primaries is added to one of
these unmatchable colours, it can be matched by a mixture of the other two, and so the colour
may be considered to have a negative weighting of that particular primary.
In 1931, the Commission Internationale de l'Éclairage (CIE) defined three standard primaries,
called X, Y and Z, that can be added to form all visible colours. The primary Y was chosen so
that its colour matching function exactly matches the luminous-efficiency function for the
human eye, given by the sum of the three curves in figure 2.
Figure 3: The CIE Chromaticity Diagram showing all visible colours. x and y are the normalised
amounts of the X and Y primaries present, and hence z = 1 - x - y gives the amount of the Z
primary required.
The CIE Chromaticity Diagram (see figure 3) shows all visible colours. The x and y axis give the
normalised amounts of the X and Y primaries for a particular colour, and hence z = 1 - x - y gives
the amount of the Z primary required. Chromaticity depends on dominant wavelength and
saturation, and is independent of luminous energy. Colours with the same chromaticity, but
different luminance all map to the same point within this region.
The pure colours of the spectrum lie on the curved part of the boundary, and a standard white light
has colour defined to be near (but not at) the point of equal energy x = y = z = 1/3. Complementary
colours, i.e. colours that add to give white, lie on the endpoints of a line through this point. As
illustrated in figure 4, all the colours along any line in the chromaticity diagram may be obtained
by mixing the colours on the end points of the line. Furthermore, all colours within a triangle may
be formed by mixing the colours at the vertices. This property illustrates graphically the fact that
all visible colours cannot be obtained by a mix of R, G and B (or any other three visible) primaries
alone, since the diagram is not triangular!
Figure 4: Mixing colours on the chromaticity diagram. All colours on the line IJ can be
obtained by mixing colours I and J, and all colours in the triangle IJK can be obtained by
mixing colours I, J and K.
4. Explain in detail on RGB color model.
The RGB color model is an additive color model in which red, green and blue light are added
together in various ways to reproduce a broad array of colors. The name of the model comes from
the initials of the three additive primary colors, red, green and blue.
The main purpose of the RGB color model is for the sensing, representation and display of images
in electronic systems, such as televisions and computers, though it has also been used in
conventional photography. Before the electronic age, the RGB color model already had a solid
theory behind it, based in human perception of colors.
RGB is a device-dependent color model: different devices detect or reproduce a given RGB value
differently, since the color elements (such as phosphors or dyes) and their response to the
individual R, G and B levels vary from manufacturer to manufacturer, or even in the same device
over time. Thus a RGB value does not define the same color across devices without some kind of
color management.
Typical RGB input devices are color TV and video cameras, image scanners, and digital cameras.
Typical RGB output devices are TV sets of various technologies (CRT, LCD, plasma, OLED,
Quantum-Dots etc.), computer and mobile phone displays, video projectors, multicolor LED
displays and large screens such as JumboTron. Color printers, on the other hand are not RGB
devices, but subtractive color devices (typically CMYK color model).
The Y component represents the luma information, and is the only component used by black-and-
white television receivers. I and Q represent the chrominance information. In YUV, the U and V
components can be thought of as X and Y coordinates within the color space. I and Q can be
thought of as a second pair of axes on the same graph, rotated 33°; therefore IQ and UV represent
different coordinate systems on the same plane.
The YIQ system is intended to take advantage of human color-response characteristics. The eye is
more sensitive to changes in the orange-blue (I) range than in the purple-green range (Q) —
therefore less bandwidth is required for Q than for I. Broadcast NTSC limits I to 1.3 MHz and Q to
0.4 MHz. I and Q are frequency interleaved into the 4 MHz Y signal, which keeps the bandwidth
of the overall signal down to 4.2 MHz. In YUV systems, since U and V both contain information in
the orange-blue range, both components must be given the same amount of bandwidth as I to
achieve similar color fidelity.
Very few television sets perform true I and Q decoding, due to the high costs of such an
implementation. Compared to the cheaper R-Y and B-Y decoding which requires only one filter, I
and Q each requires a different filter to satisfy the bandwidth differences between I and Q. These
bandwidth differences also requires that the 'I' filter include a time delay to match the longer delay
of the 'Q' filter. The Rockwell Modular Digital Radio (MDR) was one I and Q decoding set, which
in 1997 could operate in frame-at-a-time mode with a PC or in realtime with the Fast IQ Processor
(FIQP). Some RCA "Colortrak" home TV receivers made circa 1985 not only used I/Q decoding,
but also advertised its benefits along with its comb filtering benefits as full "100 percent
processing" to deliver more of the original color picture content. Earlier, more than one brand of
color TV (RCA, Arvin) used I/Q decoding in the 1954 or 1955 model year on models utilizing
screens about 13 inches (measured diagonally). The original Advent projection television used I/Q
decoding. Around 1990, at least one manufacturer (Ikegami) of professional studio picture
monitors advertised I/Q decoding.
This stands for cyan-magenta-yellow and is used for hardcopy devices. In contrast to color on the
monitor, the color in printing acts subtractive and not additive. A printed color that looks red
absorbs the other two components and and reflects . Thus its (internal) color is
G+B=CYAN. Similarly R+B=MAGENTA and R+G=YELLOW. Thus the C-M-Y coordinates are
just the complements of the R-G-B coordinates:
If we want to print a red looking color (i.e. with R-G-B coordinates (1,0,0)) we have to use C-M-Y
values of (0,1,1). Note that absorbs , similarly absorbs and hence absorbs all
but .
and .
HSL and HSV are the two most common cylindrical-coordinate representations of points in an
RGB color model. The two representations rearrange the geometry of RGB in an attempt to be
more intuitive and perceptually relevant than the cartesian (cube) representation. Developed in the
1970s for computer graphics applications, HSL and HSV are used today in color pickers, in image
editing software, and less commonly in image analysis and computer vision.
HSL stands for hue, saturation, and lightness (or luminosity), and is also often called HLS. HSV
stands for hue, saturation, and value, and is also often called HSB (B for brightness). A third
model, common in computer vision applications, is HSI (I for intensity). However, while typically
consistent, these definitions are not standardized, and any of these abbreviations might be used for
any of these three or several other related cylindrical models. (For technical definitions of these
terms, see below.)
In each cylinder, the angle around the central vertical axis corresponds to "hue", the distance from
the axis corresponds to "saturation", and the distance along the axis corresponds to "lightness",
"value" or "brightness". Note that while "hue" in HSL and HSV refers to the same attribute, their
definitions of "saturation" differ dramatically.
Because HSL and HSV are simple transformations of device-dependent RGB models, the physical
colors they define depend on the colors of the red, green, and blue primaries of the device or of the
particular RGB space, and on the gamma correction used to represent the amounts of those
primaries. As a result, each unique RGB device has unique HSL and HSV absolute color spaces to
accompany it (just as it has unique RGB absolute color space to accompany it), and the same
numerical HSL or HSV values (just as numerical RGB values) may be displayed differently by
different devices.
Both of these representations are used widely in computer graphics, and one or the other of them is
often more convenient than RGB, but both are also criticized for not adequately separating color-
making attributes, or for their lack of perceptual uniformity. Other more computationally intensive
models, such as CIELAB or CIECAM02, are said to better achieve these goals.
8. Compare and contrast the RGB and CMY.
RGB is based on projecting. Red light plus Green light plus Blue light all projected together
create white. Black is encoded as the absence of any color.
CMYK is based on ink. Superimpose Cyan ink plus Magenta ink plus Yellow ink, and you
get black, although this format also encodes Black (K) directly. White is encoded by the
absence of any color.
Prism uses RGB internally. Exporting in RGB will give you results very close to what you
see on screen.
Even though it uses one more number to encode a color, the CMYK scheme encodes a
smaller "color space" than does RGB.
When a color is converted from RGB to CMYK, the appearance may change. Most
noticeably, bright colors in RGB will look duller and darker in CMYK as shown below
(from here).
9. Explain in detail the conversion between HSV and RGB color models.
In the RGB model, hues are represented by specifying one color as full intensity (255), a
second color with a variable intensity, and the third color with no intensity (0).
The following provides some examples using red as the full-intensity and green as the partial-
intensity colors; blue is always zero:
Shades are created by multiplying the intensity of each primary color by 1 minus the shade factor,
in the range 0 to 1. A shade factor of 0 does nothing to the hue, a shade factor of 1 produces black:
The HSV, or HSB, model describes colors in terms of hue, saturation, and value (brightness). Note
that the range of values for each attribute is arbitrarily defined by various tools or standards. Be
sure to determine the value ranges before attempting to interpret a value.
Hue corresponds directly to the concept of hue in the Color Basics section. The advantages of
using hue are
The angular relationship between tones around the color circle is easily identified
Shades, tints, and tones can be generated easily without affecting the hue
Saturation corresponds directly to the concept of tint in the Color Basics section, except that full
saturation produces no tint, while zero saturation produces white, a shade of gray, or black.
Value corresponds directly to the concept of intensity in the Color Basics section.
Pure colors are produced by specifying a hue with full saturation and value
Shades are produced by specifying a hue with full saturation and less than full value
Tints are produced by specifying a hue with less than full saturation and full value
Tones are produced by specifying a hue and both less than full saturation and value
White is produced by specifying zero saturation and full value, regardless of hue
Black is produced by specifying zero value, regardless of hue or saturation
Shades of gray are produced by specifying zero saturation and between zero and full value
The HSL model describes colors in terms of hue, saturation, and lightness (also called luminance).
The model has two prominent properties:
The transition from black to a hue to white is symmetric and is controlled solely by
increasing lightness
Decreasing saturation transitions to a shade of gray dependent on the lightness, thus
keeping the overall intensity relatively constant
The properties mentioned above have led to the wide use of HSL, in particular, in the CSS3 color
model.
As in HSV, hue corresponds directly to the concept of hue in the Color Basics section. The
advantages of using hue are
The angular relationship between tones around the color circle is easily identified
Shades, tints, and tones can be generated easily without affecting the hue
Lightness combines the concepts of shading and tinting from the Color Basics section. Assuming
full saturation, lightness is neutral at the midpoint value, for example 50%, and the hue displays
unaltered. As lightness decreases below the midpoint, it has the effect of shading. Zero lightness
produces black. As the value increases above 50%, it has the effect of tinting, and full lightness
produces white.
At zero saturation, lightness controls the resulting shade of gray. A value of zero still produces
black, and full lightness still produces white. The midpoint value results in the "middle" shade of
gray, with an RGB value of (128,128,128).
Saturation, or the lack of it, produces tones of the reference hue that converge on the zero-
saturation shade of gray, which is determined by the lightness. The following examples uses the
hues red, orange, and yellow at midpoint lightness with decreasing saturation. The resulting RGB
value and the total intensity is shown.
Shading is used in drawing for depicting levels of darkness on paper by applying media more
densely or with a darker shade for darker areas, and less densely or with a lighter shade for lighter
areas. There are various techniques of shading including cross hatching where perpendicular lines
of varying closeness are drawn in a grid pattern to shade an area. The closer the lines are together,
the darker the area appears. Likewise, the farther apart the lines are, the lighter the area appears.
Light patterns, such as objects having light and shaded areas, help when creating the illusion of
depth on paper.
Powder shading is a sketching shading method. In this style, the stumping powder and paper
stumps are used to draw a picture. This can be in color. The stumping powder is smooth and
doesn't have any shiny particles. The paper to be used should have small grains on it so that the
powder remains on the paper.
The geometry step, which is responsible for the majority of the operations with polygons and their
vertices, can be divided into the following five tasks. It depends on the particular implementation
of how these tasks are organized as actual parallel pipeline steps.
12. Explain the gouraud shading and phong shading interms of flat shading and smooth shading.
Flat shading
Here, a color is calculated for one point on each polygon (usually for the first vertex in the
polygon, but sometimes for the centroid for triangle meshes), based on the polygon's surface
normal and on the assumption that all polygons are flat. The color everywhere else is then
interpolated by coloring all points on a polygon the same as the point for which the color was
calculated, giving each polygon a uniform color (similar to in nearest-neighbor interpolation). It is
usually used for high speed rendering where more advanced shading techniques are too
computationally expensive. As a result of flat shading all of the polygon's vertices are colored with
one color, allowing differentiation between adjacent polygons. Specular highlights are rendered
poorly with flat shading: If there happens to be a large specular component at the representative
vertex, that brightness is drawn uniformly over the entire face. If a specular highlight doesn’t fall
on the representative point, it is missed entirely. Consequently, the specular reflection component
is usually not included in flat shading computation.
Smooth shading
In contrast to flat shading where the colors change discontinuously at polygon borders, with
smooth shading the color changes from pixel to pixel, resulting in a smooth color transition
between two adjacent polygons. Usually, values are first calculated in the vertices and bilinear
interpolation is then used to calculate the values of pixels between the vertices of the polygons.
Gouraud shading
Phong shading
Gouraud shading
Data structures
Sometimes vertex normals can be computed directly (e.g. height field with uniform mesh)
More generally, need data structure for mesh
Key: which polygons meet at each vertex.
Advantages
Polygons, more complex than triangles, can also have different colors specified for each
vertex. In these instances, the underlying logic for shading can become more intricate.
Problems
Even the smoothness introduced by Gouraud shading may not prevent the appearance of the
shading differences between adjacent polygons.
Gouraud shading is more CPU intensive and can become a problem when rendering real
time environments with many polygons.
T-Junctions with adjoining polygons can sometimes result in visual anomalies. In general,
T-Junctions should be avoided.
Phong shading
Phong shading is similar to Gouraud shading, except that instead of interpolating the light
intensities, the normals are interpolated between the vertices. Thus, the specular highlights are
computed much more precisely than in the Gouraud shading model:
Other Approaches
Both Gouraud shading and Phong shading can be implemented using bilinear interpolation. Bishop
and Weimer proposed to use a Taylor series expansion of the resulting expression from applying
an illumination model and bilinear interpolation of the normals. Hence, second degree polynomial
interpolation was used. This type of biquadratic interpolation was further elaborated by Barrera et
al., where one second order polynomial was used to interpolate the diffuse light of the Phong
reflection model and another second order polynomial was used for the specular light.
Spherical Linear Interpolation (Slerp) was used by Kuij and Blake for computing both the normal
over the polygon as well as the vector in the direction to the light source. A similar approach was
proposed by Hast,which uses Quaternion interpolation of the normals with the advantage that the
normal will always have unit length and the computationally heavy normalization is avoided.
Flat Smooth
Same color for any point of the face Each point of the face has its own color