0% found this document useful (0 votes)
13 views2 pages

Shading Techniques in Computer Graphics

Uploaded by

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

Shading Techniques in Computer Graphics

Uploaded by

diedbro89
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

<!

DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Shading in Computer Graphics</
title> <style> body { font-family: Arial, sans-serif; line-height: 1.6; } h1, h2, h3 { color: #2c3e50; } .diagram
{ border: 1px solid #333; padding: 10px; margin: 10px 0; width: fit-content; } table { border-collapse:
collapse; margin-top: 10px; } th, td { padding: 8px; } </style> </head> <body>

<h1>Shading in Computer Graphics</h1>

<h2>What is Shading?</h2> <p> Shading is a technique used in computer graphics to show how light falls
on an object. It helps to make 2D and 3D objects look more realistic and three-dimensional. Shading adds
light, shadow, and smoothness to the surface of objects. </p>

<p> Without shading, objects look flat. With shading, objects look real and natural. </p>

<h2>Importance of Shading</h2> <ul> <li>Makes objects look realistic</li> <li>Shows depth and shape of
objects</li> <li>Improves visual quality of images</li> <li>Used in games, animation, movies, and design</
li> </ul>

<h2>Types of Shading</h2>

<h3>1. Gouraud Shading</h3> <p> Gouraud shading is a shading technique where light is calculated only at
the vertices (corner points) of a polygon. The colors between the vertices are smoothly blended. </p>

<h4>Steps in Gouraud Shading</h4> <ul> <li>Calculate lighting at each vertex</li> <li>Assign color to each
vertex</li> <li>Interpolate (blend) colors across the surface</li> </ul>

<h4>Advantages</h4> <ul> <li>Faster than Phong shading</li> <li>Smoother than flat shading</li>
<li>Good for real-time graphics</li> </ul>

<h4>Disadvantages</h4> <ul> <li>Highlights may be missing</li> <li>Less realistic lighting</li> </ul>

<h4>Diagram (Gouraud Shading)</h4> <div class="diagram"> <pre> V1 (Light) * /


/
----- V2 V3 (Dark) (Medium) </pre> </div>

<h3>2. Phong Shading</h3> <p> Phong shading is an advanced shading technique where lighting is
calculated at every pixel on the surface. This gives very smooth and realistic images. </p>

<h4>Steps in Phong Shading</h4> <ul> <li>Interpolate normal vectors across the surface</li> <li>Calculate
lighting at each pixel</li> <li>Display smooth shading with highlights</li> </ul>

<h4>Advantages</h4> <ul> <li>Very realistic appearance</li> <li>Accurate highlights</li> <li>Smooth


surface rendering</li> </ul>

<h4>Disadvantages</h4> <ul> <li>Slower than Gouraud shading</li> <li>Needs more computation</li> </
ul>

1
<h4>Diagram (Phong Shading)</h4> <div class="diagram"> <pre> Smooth Light

•*
• Gradual *
• Change *

</pre> </div>

<h2>Comparison of Gouraud and Phong Shading</h2>

<table border="1"> <tr> <th>Feature</th> <th>Gouraud Shading</th> <th>Phong Shading</th> </tr> <tr>
<td>Lighting Calculation</td> <td>At vertices</td> <td>At every pixel</td> </tr> <tr> <td>Image Quality</
td> <td>Medium</td> <td>High</td> </tr> <tr> <td>Speed</td> <td>Fast</td> <td>Slower</td> </tr> <tr>
<td>Highlights</td> <td>Less accurate</td> <td>Very accurate</td> </tr> </table>

<h2>Conclusion</h2> <p> Shading is an important concept in computer graphics that adds realism to
objects. Gouraud shading is faster and suitable for real-time applications. Phong shading provides better
quality and is used where realism is required. Both techniques are widely used depending on performance
and quality needs. </p>

</body> </html>

You might also like