0% found this document useful (0 votes)
262 views19 pages

C.G Unit4

Sppu computer graphics unit 4 notes

Uploaded by

pidokiw563
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
262 views19 pages

C.G Unit4

Sppu computer graphics unit 4 notes

Uploaded by

pidokiw563
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 19
Computer Graphics (SPU 26 Quick Read US eum eC Mtl: oel omelet ed PUT ur lll] Chapter 8 : Segments eS O41 Whatis.a segment? ERE Ans. : Segment * The display fle ts divided into number of subparts. These individual subparts {s called as segments, These individual segments when combined together form a scene. The attributes ofthe segment Is visibility and image transformation ’ * . The visibility attribute as the name suggests, is used to indicate whether a particular segment s visible or not. * The visibility attribute is set to ON or OFF state. Ifthe visibility attrbute Is set to ON that means that particular Segment is visible and (tis set to OFF state then it means that particular segments not visible * Another attribute is the image transformation. The diferent types of transformations like translation, scaling rotation reflection can be applied on individual objects (segments) inthe scene. * The different operations can be performed on the segments namely creating a segment, opening/ closing of a segment, deletion and renaming ofa segment. Advantages * The individual objects in the Display fle is represented as segments, ‘¢ Different transfarmations ca be applied to objects ina segment ‘© Segment visibility of each object can be controlled * Animation can be applied on different segments and so the flow of animation can Disadvantages To maintain the segment table extra overhead is required. * The segment table works in association with display file interpreter. © Asufficient number of segments needs to be created for efficiency. © The contents of the display file is not displayed by default 2 Explain the Segment Table with an example, STE ‘Ans. : Segment Table * Weave already discussed the attributes like visibility and transformations that are set for every segment. * Another attribute segment name {s used to decide which segment would be visible and which would not be visible, * Segment name can be used co uniquely klentifya particular segment. When We need to change the visibility of a particular segment, the segment name attribute is used, * The segment name is an integer number from 1 onwards, Modifications of the segment attributes become easier when numbers are used for segment name, Example : visibility(2 * Hkmeans we are seting the visibility of segment 2to OFF state 2] isthe name ofthe segment The name ofthe segment acts as an index in the segment table. * While considering a particular segment of display fle, we must know the location of the segment. We can determine the start it start attribute, SO lick Read hics (SPPU} Zz ‘The number of instructions required to draw a particular object Is nothing but the size of that particular ‘segment. This is the segment size attribute. ‘* Allthis information related to the segment is maintained in a table referred to as segment table. ‘© Arrays can be used to hold the attributes o.a segment. «Segment table and display file need to be work in correspondence. Structure of the segment table is shown in Table 8.1. ‘able 8.1: Structure of the segment table FE Tr Segment Name | Segment Start | Segment Size | Visibility si Fal pre sere = 1 : - on | - | - '|- 2 ~ - ‘OFF = - [- ‘When the image is displayed on the screen, the instructions required for drawing that object is stored in the display file. Then these instructions are read by the display file interpreter and corresponding object is drawn on the screen. The display file interpreter interprets the instructions from the display file in consultation with the segment table © Ifthe visibility attribute in the segment of a particular segment {s set to ON state then only that object will be visible on the screen else if the visibility attribute is set to OFF state the object is not displayed on the screen, though the instructions for itis present in the display file © The start position of the object can be determined from segment start and size of the segment from the segment size attribute. '¢ Theprocess is depicted in Fig. 8.1 Dispiay io Display bie —+] Display device interpre Segmant able | Fig. 8.1 : Correspondence between display file and segment table @.3 Describe various operations carried out on the segment. ‘Ans. : Operations on Segment ‘The different operations that can be performed on segments are Creation of a segment, opening/closing of a segment, deletion of a segment, renaming of segment. Creation of a Segment For creating a segment, first check if any other segment is open or not. Two segments cannot be opened at the same time, If we try to open two segments simultaneously it will ive an error message. If no other segment is open then check for valid name of the segment. We can proceed only if the segment name is valid and there is no duplicate segment name. + To check ifany other segment is open or not we use a flag or variable. When a segment is created set the flag or variable equal to the name of new segment to be created. ¢ When no other segment is open set the flag value to zero. This is the reason why segment name does not start from zero (0). — GS ECT Mag value to zero (0) which means that currently no segment is ope. i sae | oat "| ‘Segment 1 ; = ri = New segment 14 0 sh ‘stant s 2 SG, a 7 - : Now - i Display bas Segment Table File Fig. 8.2: Segment creation Steps for creation of segment: Algorithm Step: Check if any other segment is open, check the lag value. If ag #0 then display error “other segment i open” and go to step 7. Step 2: If fag= 0 then itmeans no segments open and set the fag value to the name ofthe new segment Step 3: Ifthe name ofthe segments not valid then display error message: “invalid segment” and goto step 7. Step 4: Set the next free space in the display fleas the segment start attribute. Step 5: The segment size of the new segment iszero (as no instructions are present) and set all attributes to its default values, ‘Step 6: Display message new segment is open Step7: Stop. Closing of a Segment © If we have finished writing the drawing instructions for an obj We set the flag to zero (0), It indicates that no segment is open, © Steps to close the segment are stated below. Algorithm Step 1: Check if any other segment fs open, ‘open” and go to step 6. Step 2: Ifflag=0 then it means no segment is open and set the fag value tothe na Step3: Ifthe name ofthe segments not valid then display error message: “invalid segment ar goto step 6. Step 4: Set the flag =0. Step 6: Stop. ‘Segment Deletion + Ifa specific segment from the display file fs not required then we should deter space. fit is required at later instant of time then its visibility attribute shoul ject we close that segment. For closing a segment heck the fag vale. If fag ¥ 0 then dleplay eror “other segment Is ime of the new segment. te that Segment in order to save the ld be set to OFF state. This would be temporary deletion as the Instruction to raw that parccar segment wat ng Present in the display file. W computer Graphics (SPPU) 29 Quick Read ‘© Butwhen we delete a segment other segments should not get affected. ‘To delete a segment we check the valid name of the segment in the segment table I the name is present we ‘check the size of the segment. ‘* The size ofthe segment to be deleted should be non-zero then only its possible to delete the segment. But the ‘size of the segment is zero, it means there is no instruction present in the segment table to draw that particular object and hence no need to delete that segment. There should be no space left between two segments, it has to be contiguous. * To delete a segment after checking for a valid name, check if any other segment is open or not. If it is open it ‘means some action is being performed on it and segment is still n use. We cannot delete a segment which is already in use. So close this segment and open that is to be deleted. Example : Now, suppose we want to delete segment 3 from the segment table shown below, then we have to shift segment 4 and segment 5 upwards. By doing this the gap created by deleting the segment 3 can be overlapped by segment 4 and segment 5 will be in place of segment 4, Segment 1 Segment 1 Segment 2 Segment 2 [Segment 3 Segment 4 [Segment 4 eae [Segment 5 Segment $ Eee Free Space Free Space ‘Table 8.2 : Segment table before deletion of segment 3 Segment_name | Segment start | Segm Visibility | Transformations wm a 1 6 oN 2 7 4 oN 3 pty s | 4 16 3 oN 5 19 6 oN Table 8.3 : Segment table after deletion of segment 3 ‘Segment_name | Segment start Segment size | Visibility | Transformations 1 1 6 ON 2 7 4 ON 3 uw 0 ON/OFF 4 16-5914, 3 ON 5 19-5=14 6 ON ‘= After deleting segment 3 we have to modify the starting address of the segment 4 and segment S. For segment 3 ‘we have to make the segment size attribute as zero (0) as it does not contain any instructions. The visibility tribute of segment 3 can be either ON/OFF as the segment size is zero (0) nothing will be displayed. Graphics (SP! 30 lick Read ‘* At the starting point of the segment to be deleted the immediate next segment should start. That means the __ Segment 4 should start at the starting position of segment 3 ,¢ 11 and segment 5 at starting position of segment ‘4 Le 14. We do this by subtracting the segment start attribute of segment 4 by segment size of segment 3. '* _Itisalso possible to delete all the segments at atime. For this we have to make the size of the segment. and set the starting position to one. are + Steps to delete the segment are described below : Algorithm Step1: Check the valid name of the segment to be deleted. Step2: Ifthename isnot valid then display an error message: “Invalid Segment name” and go to step 7. ‘Step3: Check if the any other segment is open, then disy en . play an error message: “Cannot delete alread segment” and go to step 7 5 ie Step4: Ifthe size of the segment is less than 0, no processing is needed, go to step 7. ‘Step: Make the size of the segment to be deleted as zero (0). All the segments following the segment to be deleted are shifted up by the size ofthe segment to be deleted {In our example by 5). Step6: After performing above steps close the segment by setting the flag = 0. Step7: stop. 4 Write an algorithm to rename a segment Ans. : To Rename a Segment + When we have to animate an object, we display that object, then delete that object, change its position and again display that particular object. It shows that the object has moved from one position to another. * _ Ifwe consider the example that we took earlier of the boat image, we create a boat segment, display i, delete It, ‘change the position of the boat slightly (to make it appear moving) and again create a new segment for boat and display it In this process there is an elapse of time between the deletion of first segment and creation of new ‘segment. Due to which only partially image of the newly created segment may get displayed. © To avoid this segment should not be deleted until a replacement for it is complete. It means that both the ‘segments must be present in the display file. A new segment with visibility set to OFF is created with temporary ‘name containing the instructions of the segment which we want to show moving, When this segment is created then we can delete the original segment. The process of maintaining two images is called as double buflering, Example : Suppose we want to show the boat moving. and the name of the segment boat is segment 2and there are total 5 segments. We want to rename the segment 2, We create segment 6 as the temporary segment with the visibility attribute set to OFF state, So it will not get displayed. Copy the instructions of segment 2 to segment 6 and delete segment 2. Make size of segment 2 as zero. Table 8.4: Status of Display file Segment 1 | Segment 1 Segment | Segment 2_| Segment 2 Segment 6 |e ‘Segment 3 | Segment 3 Segment3 | New renamed segment Segment 4 | Segment 4 Segment 4 Segment | Segment 5 Segment 5 Free Space | Segment 6 |*¥_ Free Space New created segment Free Space dhics (SPPU) 31 Table 8.5: Segment table betore renaming of segment 2 1 6 2 1 4 ON 3 un 5 ON 4 16 3 oN 5 19 6 ON 6 : : OFF Table 8.7 : Segment table after renaming segment 2 by segment 6 Segment.name | Segment.start | Segment.size | Visibility | Transformations -.. 1 1 6 ON 2 2 o ON/OFF 3 1 5 oN 4 16 3 ON 5 19 6 ON 6 2 4 ON Algorithm for segment renaming is described below Algorithm ‘Step 1: Check the valid name of the segment (before and after renaming), else display an error message: “Invalid Segment name” and go to step 6. fany of the two segments are open, then display an error message : “others Segment is still open” and go to Step step 6. If the new name exists in the segment table, then display an error message : “Segment name already exists” Step and go to step 6. ‘Step 4: The old segment table entry is copied to a new position. Step 5: Delete the previous old segment. ‘Step 6: Stop ES wv iter Graphics 2 m Chapter 9 : Illumination Models and Shading Algorith ee —— 1 Explain ambient light. ‘Ans. : Ambient Light / Diffuse light ‘© — Ambient light refers toa general level of illumination that does not come directly of light that has been reflected and re-reflected so many times that it's no longer direction. ‘+ Assurface that is not exposed directly toa light source still wll be visible ifm basic illumination model, we can set a general level of brightness for a scene. ‘combination of light reflections from various surfaces to produce a uniform or background light. * Ambient light has no spatial or directional Characteristics. The amount of ambient light inci ‘@ constant for all surfaces and over all directions. * — Ambient light is constant for all the surfaces and it scatters equally in all direction. ‘* Amount of ambient light in the scene is fixed by setting intensity parameterl,. Though reflected Ii forall the surfaces, the intensity of reflected light depends on the optical properties of the surface. from alight source. It consists coming from any particular earby objects are illuminated. In our This is a simple way to model the mination called the ambient light, ident on each objectis ight is constant BR —O— Fig. 91 : Ambient lighting © If we assume that the ambient light reflected from all surfaces are the same in all directions, then the {llumination model equation would be, Tel,-K, Where, Ka is the ambient reflection coefficient, and it ranges from 0 to 1. And I, is the intensity of ambient light @.2 Describe cittuse ilurination 'SPPU Dec. 15, May 16, Dec. 1 ‘Ans. : Diffuse Reflection © When a surface is lit by the light, it absorbs some amount of light while the remaining is reflected, When the incident ight is not reflected in one direction but i reflected in all direction. Reflection of light largely depends on the surface material ¢ The smooth surface reflects more light as compared to the rough surface, The shininess ofthe surface depends ‘on the amount and direction of reflected light. Such a surface has equal shi diffuse reflection, The ratio ofthe light reflected from the surface tothe total incoming light i called the coefficient of reflection oF reflectivity ¢ White surface reflects all the incident light, s0 its coefficient of reflection is close to 1 Black surface absorbs most of the incident light, hence Its reflectivity is near to 0, Gray surface has reflectivity somewhere in between O and 1 yay = Ka lp C08 O* Ky (N-L) E1easy-solutions CE ess all over. This is known as ‘Where, [p: the point light intensity Kg: the surface diffuse reflectively, value of ky Varles from 0 to 1 N:the surface normal Lethe light direction 1.3 Describe point source ilumination. SEE ‘Ans. ; Point Source Illumination ‘© Though Lambartian surface reflects the same amount of light in all directions, the brightness of reflected light depends on the viewing direction. © Surface oriented perpendicular to viewitig direction looks brighter than the surfaces oriented at some angle. ‘As can be seen from Fig, 9.2, as the angle between the surface normal and the incident light increases, less light falls on the surface. —— — — — —__—_—- Fig. 9.2: Surface perpendicular to incident light (left), oblique angle (right) Let @ be the angle between the incident light and the reflected light, called the angle of incidence. © The area of the perpendicular surface to incident light is cos#. Thus, the brightness of point depends on the orientation of the surface to the incident light. As s Incident ight Dy 4 Acos0) jon between the incident and reftecting light Fig. 9. “eit the surface is perpendicular to incident light than the angle between the incident and reflected light would be 0 and the point will be fully illuminated. © Asthis angle increases, the brightness drops off. light source. The diffuse reflection atthe point is modelled as, © Let, denotes the intensity ofthe po! Vain = arlprcos0 Points only illuminated ifthe angle is between 0° to 90°, When cost is negative, the light source is behind the surface. Let Land N denotes the unit normal vectors in the direction of point light source and the reflected light respectively, then the cos0 = N.L. So, : Ngiy = Karty (NE) now combining the ambient and point light source intensity to compute the total difuse reflection. Equation of total difuse reflection is given by lag'*ka"ky* (NL) The values of kaand karanges between 0 and 1 and is dependent on the property of material. * Warm model describes a method for simulating studio lighting effets by controling the intensity of light in diferent directions. The light sources are considered as points on the reflecting surface using the Phong mode for the surface points * Then the intensity of ight in different directions is controlled hy selecting the values for the Phong exponent. * Multiple sources may be used to get combined effect. * Flaps control the amount of light emitted from the light source. For each direction x.y and (0 flaps are used * Spotlights are used to control the amount of light emitted within a cone with apex atthe position of point ight source + Inaddition to that tight controls like “barn doors" and “spotlighting” are simulated using warn model © Warn model is jplemented within PHIGS¢ standard. 5 Explain Properties of Light. ‘Ans. : Properties of Light + Anarrow frequency band within the electromagmetic spectrum is a light. Every value of frequency within the Visible spectrum band corresponds toa single color. As Light is an electromagnetic wave ‘+ Weuse the term of frequency (f) or wavelength (,) to discuss different colors. The distance between the crests of the wave is Wavelength(3) Fig. 94 ‘© As per the properties of light C = (,),f where c is the constant speed of light. The properties of a surface that determine how it interacts light are referred to as the material of the surface. A surface can have several different material properties. When light strikes a surface, some of it will be reflected while some would be absorbed. ‘* Exactly how it reflects depends in a complicated way on the nature of the surface, Lethe material properties of the surface Light having a wavelength between 400 nm to 750 nm are visible to the human eye. Color of the object depends con the wavelength of the rays being reflected from the surface of the object. Light plays a significant rote in rendering realistic images. By varying proportion of different colors, we can produce a range of colors. Color gamut isthe set of all the visible colors to the human eye, Since the display device can display certain colors only, the color gamut of the display device is specified by the color models, Basic colors used to ereate color gamut are called primary colorfor that color model. 08 Explain the CIE chromaticity diagram. A ‘Ans. : CIE Chromaticity Diagram ‘© X¥Zcolor space was derived from a series of experiments done by William David and John Guild. Results of their ‘experiments were combined into CIE RGB color space, from which the CIE XYZ color space was derived. The CIE system characterizes colors hy a luminance parameter Y and two color coordinates x and y which specify the point on the chromaticity diagram, + Based on the fact that the human eye has three different types of color sensitive cones, the response of the eye is best described in terms of three “tristimulus values * However, once this {s accomplished, It is found that any color can be expressed in terms of the two color coordinates x and y. * The colors which can be matched by combining a given set of three primary colors (such as the red, blue and ‘green, of a color television screen) are represented on the chromaticity diagram by a triangle joining the coordinates for the three colors. 109) os 06 oa | Uae a iar aes e-531106 cer pout It on ie ecm emo pecs ig he rons pst tn ogc pn ge Bete Gaba vor aa pe ee esa i cures hte: eciogt deeper a ees rsh 7s estan il 2 os te reporae tenascin epee BE eeeiteis ere mals conagner coos Leh canes tay cor om ba dos rege ae ol C= XK+YV 42% Where X, ¥ and Z represents a vector in three-dimensional color space, and X, ¥, Z represents the amount of standard primary colors of the model. ‘Sometimes XYZ colors are represented by the luminance ¥, and chromaticity coordinates x and y, defined by; sie y z * = eZ You **Ks Ved Where,x+y+2 = 1 ‘The x and y parameters are called chromaticity as they depend only on hue and saturation. Generally, color is described with three parameters, x, y and Y. Given x, y and Y, we can derive values of other CIE components as betow. Aacaeek x= Fvandz=5y © Ifwe plot x and y for all visible colors, we get CIE chromaticity diagram as shown in PYoasy-solutions . 0203 a4 as Fig. 9.6: Chromaticty diagram Points on the boundary of the tongue-shaped diagram represent pure colors. White color is at the center. The line joining two ends red and violet is known as the purple line, which is not part of color spectrum. CIE diagrams help in many ways. © Wecan find the hue and saturation of any color by matching the color with CIE primaries. © It's simple to find complementary color. © Easy todefine color gamut. When we add the proper amount of two colors, they produce a white color. Such colors are called the ‘complementary color of each other. Color gamuts are represented by a straight line or closed polygon on the chromaticity diagram. When we join two colors by a straightline, we getall possible color that can be produced with varying amount of both the colors. Color gamut for three colors is defined by the triangle as shown in Fig. 9.7. ‘Triangle covers ail the possible colors that can be produced with a mixture ofall three colors. Colors outsides the triangle cannot be produced using the same three colors ‘The gamut of colors must be convex in shape. All colors that can be formed by mixing three colors are found inside the triangle formed by the color points on the chromaticity diagram, Chromaticity diagram represents all the possible color that the human eye can perceive. But it can be seen that fiven any three colors they cannot cover the gamut of human vision. You cannot define the gamut using three points which form a triangle that includes the entire tongue shape. We can even find a dominant wavelength of a given color. By extending the line from white color and passing Intersects tongue shape at some point Is boundary color. That color isthe pure hue of the ‘through given colori given color. We cannot find the dominant wavelength of the color between white color and purple line, because the purple line is not part of the chromaticity diagram. Color Gamut Ingeneral the color gamut is the full range of colors visible to the human eye. Color gamut is defined as the range of colors which a particular device can produce or record. Itis generally presented by an enclosed area of the primary colors ofthe device on the chromaticity diagram. For example, the primary colors of display devices are red, green, and blue. Hence, the color gamut of a monitor {s shown in a triangular area enclosed by the color coordinates of the monitor's red, green, ard blue colors, ‘The most commonly known color gamut might be "NTSC" (established in 1953 by the US FCC), however, itis not a standard color gamut. "sRGB" Is the standard color gamut established by the IEC in 1999, The reason for standardizing a color gamut was to promote an easier way for color reproduction. Color gamut is described using 3 dimmensions, either in the form of RGB or hue, saturation, and brightness ColorGamut | | 1931 x-coordinate | 1931 y-coordinate Ntsc | R 067 0.33 G o2t on B oat 0.08 sRGB [R 0.64 0.33 G 030 0.60 B ous 0.06 —_WdTay as Sn A color model is a process for creating more colors using a few primary colors, There are two types of color ‘models are used, the additive color model and the subtractive colar model {Inthe additive color model, light is used to display colors. While inthe subtractive color model, printing inks are used to produce calor. 4 ‘The most common additive color model used is an ROB color model and a CMYKcolor model is used for printing. RGB color model is an additive color model in which red, green and blue colors are mixed together in various Proportions to form a different array of colors ‘The name was given with the first letters of three primary colors red, green ard blue, In this model, colors are Prepared by adding components, with white having all colors in it and black without the presence of any color. inthis process of the RGB color model the three colors are superimposed with the least intensity then the Mack color is formed and ifit is added with the maximum intensity of light, then the white color is formed, Tomake a different array of colors these primary colors should be superimposed in different intensities, According to some studies, the intensity of each primary colors can vary from 0 to 255 and which results inthe creation of almost 16,777,216 colors. RGB color models used in various digital displays lke TV and video displays, Computer. displays, digital cameras and other types of light-based display devices, ‘© Thevertices on the coordinate axis represents primary colors and ather vertices represents the complementary colors. ‘+ The baste principle behind the working of the RGB color model is additive color mixing. It ls the process of mixing 3 primary colors red, green and blue together in different proportions to make more different colors. ‘+ For every primary color, itis possible to take 256 different shades of that color. So by adding 256 shades of 3 primary colors, over 16 million different colors can be obtained. ‘¢ _ RGBIs an additive color model and any color C can be obtained by addition of R,G and B. C = RR+GG+BB Fig. 9.10: CIE RGB Color model ‘© ASCMY colormodel is complementary of RGB color model, soit is easy to trans color of other space. ‘© The transformation from RGB to CMY color space can be written in matrix form as follows. . [Hl EEE] 1) No transformations are required to display information on the screen, soit is considered as the base color space for different applications. 2) Used in video display because of its additive property. form colar of one color space to Disadvantages 1) Notuseful for objects specification and recognition of colors. 2). Difficult to determine specific color in RGB model. 3) RGB reflects the use of CRTs, since itis hardware dependent system, {2a xian CMYK color models. ‘Ans. : CMY Color Model « CMYis an abbreviation of Cyan, Magenta and Yellow. These are the secondary colors of light and the primary ‘colors of pigments, It means, if white light is put on a surface coated with cyan pigment, then the red light does hot get reflected from it. Cyan subtracts red light from white light. CMY is subtractive, meaning higher values are associated with darker colors rather than lighter ones. @s Onin yellow. Colors perceived in subtractive models are the result of reflected light. Such 2 model {s called subtractive ‘because inks “subtract” the colors red, green and blue from white light. ‘White light minus red leaves cyan, white light minus green leaves magenta, andwhite light minus blue leaves To produce pure black color, which is quite commonly used while printing, a fourth color — black is added, to the pigment mixture. This is called four-color printing. The adadtion of black inthis mode! results in fe being referred to as the CMYK color model In CMY model, point (1.1.1) represents black because all components of the incident light are subtracted. The origin represents white light. ‘Equal amounts of each of the primary colors produce grays along the main diagonal of the cube. (HE 2.9 Compare RGB and HSV color model ‘The transformation from CMY to RGB color space can be written in matrix form as shown above. Ans. : Sr. | Parameters for RGB Color Model CMY Color Modet No. | comparison 1. | Basic RGBis an additive color model CMYK is a subtractive color model 2. | Application RGB Is used to create images in screens | CMYKis used in printing to paper or other and display media 3._| Makes use of Light Ink 4, | Mechanismused | Transmission of light Reflection of ight 5 | Colorcomponents | Red + Green + Blue = White Cyan + Magenta + Yellow = Black 6 | filesize Smaller Larger 7. | Application Used in various digital displays like TV and video displays, Computer displays, digital cameras and other types of light: based display devices Used for printing purposes. etn ——— - --- W computer Graphics {SPPU “1 Read {@.10. Expain Gaurad Snacng algo. Ans. : Gouraud Shading |, © Itisthe interpolation technique. ‘© Intensity levels are calculated at each vertex and eerptated across the surface. Intensity values for each polygon are matched with the values of adjacent polygons along the common edges: ‘¢ This eliminates the intensity discontinuities that can occur in flat shading, To render a polygon, Gouraud surface rendering proceeds as follows: ‘+ Determine the average unit normal vector at each vertex ofthe polygor: + Applyanlumination model at each polygon vertex to obtain the light intensity at that postion 4 Linearly interpolate the vertex intensities over the projected area ofthe polygon + Theaverage unit normal vector at Vi given as: Ny 4 Ne +N 9s TN, #N2# Ng Nal Fig. 9.12 : Average normal vector computation ‘¢ Itcanbe generalized to 50 SN Bim Ny © Illumination values are linearly interpolated across each scarv‘line as shown in fig. 9.13, Fig. 9.13, os EIT 2s lick Read ‘* The intensities at point 4 can be interpolated from intensities 1 and 2. ‘+ Similarly the intensities at point § can be interpolated from intensties 2 and 3. + Therefore the intensities of interaction points 4 and 5 are calculated from scan line. m Advantages: 1. Ieremoves the intensity discontinuity which exists in constant shading model, fl Itcan be combined with hidden surface algorithm to fill in the visible polygons alon Disadvantages: 4. Gouraud shading has a problem with specular reflections. fi, Gouraud shading can introduce anomalies known as Mach bands. 2:11 Write a note on Phong Retlection Model. SEA Ans. * Amore accurate method for rendering a polygon surface is to interpolate the normal vector and then apply the {Mlumination model to each surface point. This method developed by Phong Bui Tuong is called Phong Shading or ‘normal vector Interpolation Shading. [t displays more realistic highlights on a surface and greatly reduces the Mach-band effect Basically the Phong ‘Surface rendering model is also called as normal-vector interpolation rendering, It interpolates hormal vectors {Instead of intensity values. To render a polygon, Phong surface rendering proceeds as follows: Determine the average unit normal vector at each vertex ofthe polygon. * _Linearly interpolate the vertex normal over the projected area of the polygon. * Apply an illumination model at positions along scan lines to calculate pixel intensities using the interpolated ormal vectors as shown in Fig, 9.14. N, v4 ‘Sean moos »,| Fig, 9.14: Normal vector interpolation peice, oar: NY” Va Ve To calculate the normal veetors at point p, N1 and N2s interpolated Advantages : LIedisplays more realistic highlights on a surface. ii, It greatly reduces the Mach band effect, fil, Iegives more accurate results, Disadvantages : * _Itrequires more calculations and greatly increases the cost of shading steeply ah rE | M 8 + 4 Pet Sadng 1. Govrad Sracing 1 Prong Shading Fig. 9.15 : Comparison of different interpolation model {Q.12_ Write short notes on Hatttone, ‘Ans. : Halftone Shading * The process by which(continuous tone) photographs are reproduced during printing (for example in hewspapers magazines, etc) by reducing them to.a grid of tiny dots. The resulting image is known as a halftone. Each individual dot is printed using a single coloured ink of fixed intensity, and the intensity of colour the reader erceives is controlled by varying the size and density of the dots to reveal more or less of the underlying white paper. * The superficial similarity between this use of dots in printing and the pixels that constitute computer images is misleading, since pixels actually vary in colour and intensity rather than size. When computer generated images are used for printing, each pixel gets broken up into a sub-grid of halftone dots that simulate its tonal value spatially, The pixel and halftone grids may interfere with each other and cause the problem called screen clash. + Ituses a 2D rectangular grid of pixels to determine intensity at a given location. Size of the rectangular grid varies according to the screen resolution. In computer graphics, halftone reproductions are approximated using rectangular pixel regions, say 22 pixels or 33 pixels. These regions are called halftone patterns or pixel patterns. © Halftone appears as if it is composed of black circles of varying radius. The dark region is produced using large circles. Light regions are produced using smaller circles. Good quality books and magazines are printed using approximately 60-80 circles of varying radius per centimetre. The low-quality newspaper is printed using about 25-30 circles per centimetre. '* Example of halftone images are shown below Fig. 9.16 : Example of halftone images © Using n by n rectangular grid, we can display n? + 1 different intensity levels. Black and white system uses a grid of size 1 by 1. Fig 9.17 shows how circles are added to the grid with increasing intensities. With 2 by 2 and 3 by 2 rid, we can display five and ten intensity levels respectively. | @ O2

You might also like