Misplaced Pages

Shading

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

This is an old revision of this page, as edited by Ronhjones (talk | contribs) at 01:04, 9 August 2013 (Undid revision 567659526 by Salix alba (talk) - Dup Dec usually fails with PDFs - "Smooth shading of a polygon displays the points in a polygon with smoothly-changing colors" is in both). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Revision as of 01:04, 9 August 2013 by Ronhjones (talk | contribs) (Undid revision 567659526 by Salix alba (talk) - Dup Dec usually fails with PDFs - "Smooth shading of a polygon displays the points in a polygon with smoothly-changing colors" is in both)(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)


An editor has launched a copyright investigation involving this section. The text under investigation is currently hidden from public view, but is accessible in the page history. Please do not remove this notice or restore blanked content until the issue is resolved by an administrator, copyright clerk, or volunteer response agent.

The purported copyright violation copies text from http://www.cs.csustan.edu/~rsc/CS3600F00/Shading.Models.pdf (Copyvios report); as such, this page has been listed on the copyright problems page.

Unless the copyright status of the text of this page or section is clarified and determined to be compatible with Misplaced Pages's content license, the problematic text and revisions or the entire page may be deleted one week after the time of its listing (i.e. after 23:24, 13 August 2013 (UTC)).

What can I do to resolve the issue?
  • If you hold the copyright to this text, you can license it in a manner that allows its use on Misplaced Pages.
    1. You must permit the use of your material under the terms of the Creative Commons Attribution-Sharealike 4.0 International License (CC BY-SA 4.0) and the GNU Free Documentation License (GFDL) (unversioned, with no invariant sections, front-cover texts, or back-cover texts).
    2. Explain your intent to license the content on this article's discussion page.
    3. To confirm your permission, you can either display a notice to this effect at the site of original publication or send an e-mail from an address associated with the original publication to permissions-en@wikimedia.org or a postal letter to the Wikimedia Foundation. These messages must explicitly permit use under CC BY-SA and the GFDL. See Misplaced Pages:Donating copyrighted materials.
    4. Note that articles on Misplaced Pages must be written from a neutral point of view and must be verifiable in published third-party sources; consider whether, copyright issues aside, your text is appropriate for inclusion in Misplaced Pages.
  • You can demonstrate that this text is in the public domain or is already under a license suitable for Misplaced Pages. Explain this on this article's discussion page, with reference to evidence. Misplaced Pages:Public domain and Misplaced Pages:Compatibly licensed may assist in determining the status.
  • Otherwise, you may rewrite this page without copyright-infringing material. Your rewrite should be placed on this page, where it will be available for an administrator or clerk to review it at the end of the listing period. Follow this link to create the temporary subpage. Please mention the rewrite upon completion on this article's discussion page.
    • Simply modifying copyrighted text is not sufficient to avoid copyright infringement—if the original copyright violation cannot be cleanly removed or the article reverted to a prior version, it is best to write the article from scratch. (See Misplaced Pages:Close paraphrasing.)
    • For license compliance, any content used from the original article must be properly attributed; if you use content from the original, please leave a note at the top of your rewrite saying as much. You may duplicate non-infringing text that you had contributed yourself.
    • It is always a good idea, if rewriting, to identify the point where the copyrighted content was imported to Misplaced Pages and to check to make sure that the contributor did not add content imported from other sources. When closing investigations, clerks and administrators may find other copyright problems than the one identified. If this material is in the proposed rewrite and cannot be easily removed, the rewrite may not be usable.

Steps to list an article at Misplaced Pages:Copyright problems:
  1. Add the following to the bottom of Misplaced Pages:Copyright problems/2013 August 6: * {{subst:article-cv|Shading}} from http://www.cs.csustan.edu/~rsc/CS3600F00/Shading.Models.pdf. ~~~~
  2. Add the following template to the talk page of the contributor of the material: {{subst:Nothanks-web|pg=Shading|url=http://www.cs.csustan.edu/~rsc/CS3600F00/Shading.Models.pdf}} ~~~~
  3. Place {{copyvio/bottom}} at the end of the portion you want to blank. If nominating the entire page, please place this template at the top of the page, set the "fullpage" parameter to "yes", and place {{copyvio/bottom}} at the very end of the article.

Template:Other uses2

This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.
Find sources: "Shading" – news · newspapers · books · scholar · JSTOR (May 2007) (Learn how and when to remove this message)
Gouraud shading, invented by Henri Gouraud in 1971, was one of the first shading techniques developed in computer graphics.

Shading refers to depicting depth perception in 3D models or illustrations by varying levels of darkness.

Drawing

Example of shading.
See also: Powder shading

Shading is a process used in drawing for depicting levels of darkness on paper by applying media more densely or with a darker shade for darker areas, and less densely or with a lighter shade for lighter areas. There are various techniques of shading including cross hatching where perpendicular lines of varying closeness are drawn in a grid pattern to shade an area. The closer the lines are together, the darker the area appears. Likewise, the farther apart the lines are, the lighter the area appears.

Light patterns, such as objects having light and shaded areas, help when creating the illusion of depth on paper.

Computer graphics

In computer graphics, shading refers to the process of altering the color of an object/surface/polygon in the 3D scene, based on its angle to lights and its distance from lights to create a photorealistic effect. Shading is performed during the rendering process by a program called a shader.

Angle to light source

Shading alters the colors of faces in a 3D model based on the angle of the surface to a light source or light sources.

The first image below has the faces of the box rendered, but all in the same color. Edge lines have been rendered here as well which makes the image easier to see.

The second image is the same model rendered without edge lines. It is difficult to tell where one face of the box ends and the next begins.

The third image has shading enabled, which makes the image more realistic and makes it easier to see which face is which.

Rendered image of a box. This image has no shading on its faces, but uses edge lines to separate the faces.
This is the same image with the edge lines removed.
This is the same image rendered with shading of the faces to alter the colors of the 3 faces based on their angle to the light sources.

Lighting

Shading effects from floodlight.

Usually, upon rendering a scene a number of different lighting techniques will be used to make the rendering look more realistic. For this matter, a number of different types of light sources exist to provide customization for the shading of objects.

Ambient lighting

Shading is also dependant on lighting. An ambient light source represents a fixed-intensity and fixed-color light source that affects all objects in the scene equally. Upon rendering, all objects in the scene are brightened with the specified intensity and color. This type of light source is mainly used to provide the scene with a basic view of the different objects in it.

Directional lighting

A directional light source illuminates all objects equally from a given direction, like an area light of infinite size and infinite distance from the scene; there is shading, but cannot be any distance falloff

Point lighting

Light originates from a single point, and spreads outward in all directions

Spotlight lighting

Spotlight, originates from a single point, and spreads outward in a coned direction

Area lighting

Area, originates from a single plane and illuminates all objects in a given direction beginning from that plane

Volumetric lighting

Volume, an enclosed space lighting objects within that space
Shading is interpolated based on how the angle of these light sources reach the objects within a scene. Of course, these light sources can be and often are combined in a scene. The renderer then interpolates how these lights must be combined, and produces a 2d image to be displayed on the screen accordingly.

Distance falloff

Theoretically, two surfaces which are parallel, are illuminated the same amount from a distant light source, such as the sun. Even though one surface is further away, your eye sees more of it in the same space, so the illumination appears the same.

Notice in the first image that the color on the front faces of the two boxes is exactly the same. It appears that there is a slight difference where the two faces meet, but this is an optical illusion because of the vertical edge below where the two faces meet.

Notice in the second image that the surfaces on the boxes are bright on the front box and darker on the back box. Also the floor goes from light to dark as it gets farther away.

This distance falloff effect produces images which appear more realistic without having to add additional lights to achieve the same effect.

Two boxes rendered with an OpenGL renderer. Note that the colors of the two front faces are the same even though one box is further away.
The same model rendered using ARRIS CAD which implements "Distance Falloff" to make surfaces which are closer to the eye appear brighter.

Distance falloff can be calculated in a number of ways:

  • None - The light intensity received is the same regardless of the distance between the point and the light source.
  • Linear - For a given point at a distance x from the light source, the light intensity received is proportional to 1/x.
  • Quadratic - This is how light intensity decreases in reality if the light has a free path (i.e. no fog or any other thing in the air that can absorb or scatter the light). For a given point at a distance x from the light source, the light intensity received is proportional to 1/x.
  • Factor of n - For a given point at a distance x from the light source, the light intensity received is proportional to 1/x.
  • Any number of other mathematical functions may also be used.
Example of flat shading vs. interpolation

Flat shading

Flat shading is a lighting technique used in 3D computer graphics to shade each polygon of an object based on the angle between the polygon's surface normal and the direction of the light source, their respective colors and the intensity of the light source. It is usually used for high speed rendering where more advanced shading techniques are too computationally expensive. As a result of flat shading all of the polygon's vertices are colored with one color, allowing differentiation between adjacent polygons. Specular highlights are rendered poorly with flat shading: If there happens to be a large specular component at the representative vertex, that brightness is drawn uniformly over the entire face. If a specular highlight doesn’t fall on the representative point, it is missed entirely. Consequently, the specular reflection component is usually not included in flat shading computation.

Smooth shading

In contrast to flat shading with smooth shading the color changes from pixel to pixel. It assumes that the surfaces are curved and uses interpolation techniques to calculate the values of pixels between the vertices of the polygons.

Types of smooth shading include:

Gouraud shading

  1. Determine the normal at each polygon vertex
  2. Apply an illumination model to each vertex to calculate the vertex intensity
  3. Linearly interpolate the vertex intensities over the surface polygon

Data structures

  • Sometimes vertex normals can be computed directly (e.g. height field with uniform mesh)
  • More generally, need data structure for mesh
  • Key: which polygons meet at each vertex

Advantages

  • Polygons, more complex than triangles, can also have different colors specified for each vertex. In these instances, the underlying logic for shading can become more intricate.

Problems

  • Even the smoothness introduced by Gouraud shading may not prevent the appearance of the shading differences between adjacent polygons.
  • Gouraud shading is more CPU intensive and can become a problem when rendering real time environments with many polygons.
  • T-Junctions with adjoining polygons can sometimes result in visual anomalies. In general, T-Junctions should be avoided.

Phong shading

Phong shading, is similar to Gouraud shading except that the Normals are interpolated. Thus, the specular highlights are computed much more precisely than in the Gouraud shading model:

  1. Compute a normal N for each vertex of the polygon.
  2. From bi-linear interpolation compute a normal, Ni for each pixel. (This must be renormalized each time)
  3. From Ni compute an intensity Ii for each pixel of the polygon.
  4. Paint pixel to shade corresponding to Ii.

Flat vs. smooth shading

Flat Smooth
Uses the same color for every pixel in a face - usually the color of the first vertex. Smooth shading uses linear interpolation of colors between vertices
Edges appear more pronounced than they would on a real object because of a phenomenon in the eye known as lateral inhibition The edges disappear with this technique
Same color for any point of the face Each point of the face has its own color
Individual faces are visualized Visualize underlying surface
Not suitable for smooth objects Suitable for any objects
Less expensive More expensive

See also

References

  1. "Drawing Techniques". Drawing With Confidence. Retrieved 19 September 2012.
  2. "Shading Tutorial, How to Shade in Drawing". Dueysdrawings.com. 2007-06-21. Retrieved 2012-02-11.
Categories: