CG Unit 4 CG
CG Unit 4 CG
CG Unit 4 - CG
UNIT-4
LIGHT, COLOUR, SHADING AND HIDDEN SURFACES
Color Model
4.1 Properties of Light
The light travels in straight line.
Light travels faster than sound.
The light reflects into our eyes hence we can see it.
Shadows are formed when light is blocked by an object.
When light is incident upon an object some are absorbed and some are reflected.
The dominant frequency decides the color of an object.
A light source is produced by a sun or electric bulb etc.
4.3 RGB
It is color space which is commonly used.
RGB stands for Red Green Blue.
The RGB model states that the image having more colors and that colors are made
up of three different images i.e red image, black image and blue image.
The grayscale image is shown by only one matrix but color image is shown by
three different matrices.
One color image matrix contains: red matrix + green matrix + blue matrix
Application of RGB
• Liquid crystal display(LCD)
• Plasma display or LED display such as TV
• Cathode ray tube (CRT)
• Compute monitor or large scale screen
4.4 HSV
It is also known as HSB (Hue Saturation Brightness)
HSV stands for Hue Saturation Value.
In HSV there are three main components are: Hue, saturation and the value.
It defines the shades and the brightness of the color.
It may be depicted as cone or cylinder.
There are secondary colors In HSV are red,
yellow, green, cyan,blue and magenta.
It also having the mixture of adjacent pairs of them.
It is an alternative representation of RGB model.
The colors of each hue are arrange in radial slice.
The slices are placed around the central axis of neutral colors.
This neutral colors are ranges from the black at the bottom to white at the top.
The saturation dimension resembling various tints of brightly colored paint that
colors are mix together to represent the HSV color model.
The value dimension resembling the mixture of paint is vary with the amount of
black and white color.
The geometric cylinder of HSV starts with red primary at 00 passing through
green primary at 120o and blue at 240o, then back to red 360o.
The geometry of central vertical axis comprises neutral, achromatic or gray
colors ranging from top to bottom.
The range starts from the white at lightness 1 to black at lightness 0.
Following is the figure of HSV.
4.5 CMY
The CMY color model is a subtractive color model.
The CMY color model named from three colors as Cyan Magenta Yellow.
It contains the cyan, magenta and yellow color.
Thus main colors are used to reproduce various colors of array.
Thus are the primary color but this is not used to specify as absolute because of
CMY does not meant by cyan, magenta and yellow mixture.
When the cyan, yellow and magenta becomes exact chromaticities of color then it
can be specified as absolute color space.
The mixture of subtracted dyes of wavelength from the spectral power
distribution of the illuminating light.
The illuminating light which scatters back into the viewer’s eyes and perceives as
colors.
Following figure shows the CMY color model.
Idiff = Kd * Ip cos(Ꙫ) = Kd * Ip (N * L)
Where Ip is the point light intensity, Kd is the surface diffuse reflectivity value, N
is the surface normal and L is the light direction.
Following figure shows the diffuse and specular reflection from the glossy
surface.
The evaluation of normal between the scam lines are determined by the
incremental method along with each scan line.
The illumination model is applied on each of the scan line to determine the
surface intensity at that point.
The accurate result is produced by the intensity calculation using approximated
normal vector at each point along the scan line instead of using the direct
interpolation of intensities.
The phone shading requires more calculations than other shading algorithms.
When perspective projection is used then more than 50% of polygons are
removed.
If the objects are nearer the center of projection then number of polygons
are removed.
It is applied on the individual objects.
It does not consider the interaction between various objects.
Many polygons are captured by front face as they are closer to the viewer.
Hence for removing such faces back face removal algorithm is used.
When the projection takes place, there are two surfaces one is visible front
surface and the other is not visible back surface.
Following is the mathematical representation of back face removal algorithm.
N1=(V2 - V1) (V3 - V2)
If N1 * P >= 0 visible and N1 * P < 0
After all polygons have been processed the intensity array will contain the
solution.
This algorithm contains common features to the hidden surface algorithm.
It requires the representation of all opaque surface in scene polygon in the given
figure below.
These polygons may be faces of polyhedral recorded in the model of scene.
The painter algorithm finds the distance from view plane and then polygons with
more distance are painted first.
Painter algorithm:
Start
Sort all polygon with z value keep the largest value first.
Scan converts polygon in this order. Following test is applied:
Does A is behind and non-overlapping B in the dimension of Z.
Does A is behind B in z and no overlapping in x or y.
If A is behind B in Z and totally outside B with respect to view plane.
If A is behind B in Z and B is totally inside A with respect to view plane
The success of any test with single overlapping polygon allows F to be painted.
Following figure shows the test applied on the objects.
Inside Surface: The surface that comes completely inside the boundaries or
surrounding window.
Outside Surface:The surface that comes completely outside the boundaries or
surrounding window.
Overlapping Surface:The surface that completely encloses the polygon surface
or the surface that partially inside or outside the surface area.
Following figure shows the four categories of polygons in Warnock algorithm: