All Topics  
Shading

 
Shading

   Email Print
   Bookmark   Link






 

Shading



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

Darkness is the absence of light. Scientifically it is only possible to have a reduced amount of light. The emotional response to an absence of light has inspired metaphor in literature, symbolism in art, and emphasis....
.
hading 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.






Discussion
Ask a question about 'Shading'
Start a new discussion about 'Shading'
Answer questions from other users
Full Discussion Forum



Encyclopedia


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

Darkness is the absence of light. Scientifically it is only possible to have a reduced amount of light. The emotional response to an absence of light has inspired metaphor in literature, symbolism in art, and emphasis....
.

Drawing

Shading1
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
Hatching

Hatching is an artistic technique used to create tonal or shading effects by drawing closely spaced parallel lines. When lines are placed at an angle to one another, it is called 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. The term has been recently generalized to mean that shader
Shader

A shader in the field of computer graphics is a set of software instructions, which is used primarily to calculate Rendering effects on graphics hardware with a high degree of flexibility....
s are applied.

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

Computer graphics

In computer graphics, Shading refers to the process of altering a color based on its angle to lights and its distance from lights to create a photorealistic effect. Shading is performed during the rendering
Rendering (computer graphics)

Rendering is the process of generating an image from a 3D model, by means of computer programs. The model is a description of three-dimensional objects in a strictly defined language or data structure....
 process.

Angle to light source

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

The very 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.
Shading1
Shading2
Shading3


Light sources

Floodlight
There are many types of lights:

  • Ambient Light - An ambient light lights all objects within a scene equally, brightening them without adding shading.
  • Directional Light - A directional light illuminates all objects equally from a given direction. It's like an area light of infinite size and infinite distance from the scene. There is shading, but cannot be any distance falloff.
  • Point Light - A point light originates from a single point, and spreads outward in all directions.
  • Spotlight - A spotlight originates from a single point, and spreads outward in a coned direction.
  • Area Light - An area light originates from a single plane
    Plane (mathematics)

    In mathematics, a plane is a curvature surface. Planes can arise as subspaces of some higher dimensional space, as with the walls of a room, or they may enjoy an independent existence in their own right, as in the setting of Euclidean geometry....
     and illuminates all objects in a given direction beginning from that plane.
  • Volume Light - A volume light is 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
3D rendering

3D rendering is the 3D computer graphics process of automatically converting 3D wire frame models into 2D images with 3D photorealism on a computer....
 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
Parallel (geometry)

Parallelism is a term in geometry and in everyday life that refers to a property in Euclidean space of two or more line s or plane , or a combination of these....
, 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.
2squares 1
2squares 2


Distance falloff can be calculated in a number of ways:
  • None
  • Linear - For every x units a given point is from the light source, the amount of light received is x units less bright.
  • Quadratic - This is approximately how light works in real life. A point that is twice as far from the light source as another will receive four times less light.
  • Factor of n - A point that is x units from a light source will receive 1/xn as much light.
  • Any number of other mathematical functions
    Function (mathematics)

    The mathematical concept of a function expresses dependence between two quantities, one of which is known and the other which is produced. A function associates a single output to each input element drawn from a fixed Set , such as the real numbers , although different inputs may have the same output....
     may also be used.
Phong Shading Sample

Flat vs smooth shading

Flat shading is a lighting technique used in 3D computer graphics
3D computer graphics

3D computer graphics are graphics that use a Cartesian coordinate system#Three-dimensional coordinate system representation of geometric data that is stored in the computer for the purposes of performing calculations and rendering 2D images....
. It shades each polygon
Polygon

In geometry a polygon is traditionally a plane Shape that is bounded by a closed curve path or circuit, composed of a finite sequence of straight line segments ....
 of an object based on the angle between the polygon's surface normal
Surface normal

A surface normal, or simply normal, to a Flatness is a vector which is perpendicular to that surface. A normal to a non-flat surface at a Point P on the surface is a vector perpendicular to the Tangent space to that surface at P....
 and the direction of the light source, their respective colors and the intensity of the light source. It was used for high speed render
Render

To Render or To be rendering may refer to:*In the visual arts,** Artistic rendering, the process by which a work of art is created* In computer science,...
ing where more advanced shading techniques were too computationally expensive. But by the end of the 20th century affordable graphics cards were offering smooth shading that were also very fast, making flat shading for speed reasons unnecessary.

The disadvantage of flat shading is that it gives low-polygon models a faceted look. Sometimes this look can be advantageous though, such as in modeling
3D modeling

In 3D computer graphics, 3D modeling is the process of developing a Mathematics, wire frame model representation of any Three-dimensional space object via 3d computer graphics software....
 boxy objects. Artists sometimes use flat shading to look at the polygons of a solid model they are creating. More advanced and realistic lighting and shading techniques include Gouraud shading
Gouraud shading

Gouraud shading,named after Henri Gouraud , is a method used in computer graphics to simulate the differing effects of light and colour across the surface of an object....
 and Phong shading
Phong shading

Phong shading refers to a set of techniques in 3D computer graphics. Phong shading includes a model for the reflection of light from surfaces and a compatible method of estimating pixel colors by interpolation surface normals across rasterized polygons....
.

See also

  • 3D computer graphics
    3D computer graphics

    3D computer graphics are graphics that use a Cartesian coordinate system#Three-dimensional coordinate system representation of geometric data that is stored in the computer for the purposes of performing calculations and rendering 2D images....
  • Shading model
    Shading model

    Shading model may refer to:*Flat shading*Gouraud shading*Phong shading...