Surface Rendering

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 16

Surface Rendering

Topics to be covered

 Phong Shading
 Fast Phong Shading
 Their need
 Advantages
 Disadvantages
 Questions
Phong Shading:
Why do we need it?

 It is a more accurate method for rendering a


polygon surface
 Displays more realistic highlights on a surface
 Reduces the Mach-band Effect

Fig 1: Mach Band


Effect
Phong Shading and Flat Shading-
The difference

Fig 2: The difference between a sphere rendered using Flat


and Phong shading
Phong Shading–
How it works

 Based on the interpolation scheme of


rendering
 We interpolate the normal vectors along the
surface of the polygon to determine the
intensity and colour of the pixel.
Steps for Phong Shading-

I. Determine the average normal vector at each


vertex

Fig 3: a triangle with average normal vectors


at each vertex
2. Linearly interpolate per pixel normal across
the surface
3. Apply illumination model for calculating
intensity of projected pixel
 Use at least an 18-point font
 Use different size fonts for main points and
secondary points

Fig 4: Determination of normal vector along the polygon sides intersecting the scan lines
Fast Phong Shading

 Surface rendering using Phong Shading can


be speeded up by using approximations in the
illumination-model calculations of normal
vectors.
 Reduces the rendering time
 We can express the surface normal N at any
point (x, y) over a triangle as
N = Ax + By+ C
where vectors A, B, and C are determined from the
three vertex equations:
Nk=Axk + Byk + C, k=1,2,3
Where xk and yk denotes a vertex position
-We can write the calculation for light source diffuse
reflection from a surface point (x,y) as-
Where a,b,c and d are used to represent various
dot products such as:

a = L.A/ |L| and so on


Finally, we can express the denominator as a
Taylor-series expansion and retain terms up to
second degree in x and y. This yields –
Idiff(x,y)=T5x^2+T4xy+T3y^2+T2x+T1y+T0
where each T, is a function of parameters a, b, c, and
so forth.
Using forward differences, we can evaluate this equation with only two
additions for each pixel position (x, y) once the initial forward-difference
parameters have been evaluated.
Time Comparison between Fast
Phong, Phong and Gourad Shading

 Fast Phong takes twice as long as Gourad


Shading
 Phong Shading takes about six to seven times
longer than Gourad shading
Conclusion

 Phong and fast Phong Shading are slower to


render images but they overcome many
limitations of Gourad Shading
 There is no mach-band effect in Phong
Shading
 The accuracy of the rendered image is more
Questions

 What is Mach Band effect?


 Which shading algorithm gives us the most
accurate image?
THANK YOU

You might also like