Gouraud shading
   HOME

TheInfoList



OR:

Gouraud shading, named after Henri Gouraud, is an
interpolation In the mathematical field of numerical analysis, interpolation is a type of estimation, a method of constructing (finding) new data points based on the range of a discrete set of known data points. In engineering and science, one often has ...
method used in
computer graphics Computer graphics deals with generating images with the aid of computers. Today, computer graphics is a core technology in digital photography, film, video games, cell phone and computer displays, and many specialized applications. A great de ...
to produce continuous
shading Shading refers to the depiction of depth perception in 3D models (within the field of 3D computer graphics) or illustrations (in visual art) by varying the level of darkness. Shading tries to approximate local behavior of light on the object ...
of surfaces represented by polygon meshes. In practice, Gouraud shading is most often used to achieve continuous lighting on triangle meshes by computing the lighting at the corners of each triangle and linearly interpolating the resulting colours for each
pixel In digital imaging, a pixel (abbreviated px), pel, or picture element is the smallest addressable element in a raster image, or the smallest point in an all points addressable display device. In most digital display devices, pixels are the ...
covered by the triangle. Gouraud first published the technique in 1971.


Description

Gouraud shading works as follows: An estimate to the
surface normal In geometry, a normal is an object such as a line, ray, or vector that is perpendicular to a given object. For example, the normal line to a plane curve at a given point is the (infinite) line perpendicular to the tangent line to the curve ...
of each
vertex Vertex, vertices or vertexes may refer to: Science and technology Mathematics and computer science *Vertex (geometry), a point where two or more curves, lines, or edges meet *Vertex (computer graphics), a data structure that describes the position ...
in a polygonal 3D model is either specified for each vertex or found by averaging the surface normals of the polygons that meet at each vertex. Using these estimates, lighting computations based on a reflection model, e.g. the Phong reflection model, are then performed to produce colour intensities at the vertices. For each screen pixel that is covered by the polygonal mesh, colour intensities can then be interpolated from the colour values calculated at the vertices.


Comparison with other shading techniques

Gouraud shading is considered superior to flat shading and requires significantly less processing than Phong shading, but usually results in a faceted look. In comparison to Phong shading, Gouraud shading's strength and weakness lies in its interpolation. If a mesh covers more pixels in screen space than it has vertices, interpolating colour values from samples of expensive lighting calculations at vertices is less processor intensive than performing the lighting calculation for each pixel as in Phong shading. However, highly localized lighting effects (such as
specular highlight A specular highlight is the bright spot of light that appears on shiny objects when illuminated (for example, see image on right). Specular highlights are important in 3D computer graphics, as they provide a strong visual cue for the shape of a ...
s, e.g. the glint of reflected light on the surface of an apple) will not be rendered correctly, and if a highlight lies in the middle of a polygon, but does not spread to the polygon's vertex, it will not be apparent in a Gouraud rendering; conversely, if a highlight occurs at the vertex of a polygon, it will be rendered correctly at this vertex (as this is where the lighting model is applied), but will be spread unnaturally across all neighboring polygons via the interpolation method. The problem is easily spotted in a rendering which ought to have a specular highlight moving smoothly across the surface of a model as it rotates. Gouraud shading will instead produce a highlight continuously fading in and out across neighboring portions of the model, peaking in intensity when the intended specular highlight aligns with a vertex of the model. While this problem can be fixed by increasing the density of vertices in the object, at some point the
diminishing returns In economics, diminishing returns are the decrease in marginal (incremental) output of a production process as the amount of a single factor of production is incrementally increased, holding all other factors of production equal ( ceteris pari ...
of this approach will favour switching to a more detailed shading model. Image:Gouraud_low_anim.gif, A Gouraud-shaded sphere-like mesh - note the poor behaviour of the specular highlight. Image:Gouraud_high.gif, Another sphere-like mesh rendered with a very high polygon count.


Linear vs. hyperbolic interpolation

Gouraud's original paper described linear color interpolation. In 1992, Blinn published an efficient algorithm for hyperbolic interpolation{{cite journal , last1=Blinn , first1=James F. , title=Hyperbolic Interpolation , journal=IEEE Computer Graphics and Applications , date=July 1992 , volume=12 , issue=4 , page=89-94 , doi=10.1109/MCG.1992.10028 , ref=blinn that is used in GPUs as a perspective correct alternative to linear interpolation. Both the linear and hyperbolic variants of interpolation of colors from vertices to pixels are commonly called "Gouraud shading".


Mach bands

Any linear interpolation of intensity causes derivative discontinuities which triggers Mach bands, a common visual artifact of Gouraud shading.


See also

*
List of common shading algorithms {{Short description, none This article lists common shading algorithms used in computer graphics. Interpolation techniques These techniques can be combined with any illumination model: * Flat shading * Gouraud shading * Phong shading Illumin ...
* Blinn–Phong reflection model * Phong shading


References

Shading Virtual reality Computer graphics algorithms