Page 191 - DCAP504_Computer Graphics
P. 191

Computer Graphics



                          each row of pixels can be displayed by horizontally interpolating the RGB values between left and right
                          edges of that row. This often results in a remarkably smooth-shaded polygon.
                          Gouraud shading calculates the illumination formula  at the vertices of the polygon mesh. We then
                          estimate the obtained color components to get complete shading of the polygon.
                          The figure 12.8 depicts the calculation of the illumination formula at each vertices of the polygon and
                          then the interpolation of the obtained color components to get complete shading of the polygon.

                                                Figure 12.8: Calculation of Illumination Formula using
                                                             Gouraud Shading





























                          When the illumination formula is calculated at the vertices A, B, and C, interpolation can be done as
                          follows:
                          aA=PBC/ABC
                          aB=APC/ABC
                          aC=ABP/ABC
                          aA+aB+aC=1

                          P=aAA+aBB+aCC

                                             Bilinear interpolation can be used to find the color of point E inside a triangle
                                             whose vertices  are  E1,  E2, and E3 as  shown in figure  12.9. The scan line
                                             containing E intersects the two edges at points E' and E". We estimate the color
                                             of E1, and the color of E2 to get the color of P'. We then estimate the color of E2
                                             and the color of E3, to get the color of P". Finally, we estimate the color of E' and
                                             the color of E" to get the color of E.

















                          184                     LOVELY PROFESSIONAL UNIVERSITY
   186   187   188   189   190   191   192   193   194   195   196