VertexNormals

VertexNormals

is an option for graphics primitives which specifies the normal directions to assign to 3D vertices.

Details

  • VertexNormals can be used with Polygon, Line, Point, and GraphicsComplex.
  • VertexNormals->{n1,n2,} specifies that vertex i should have effective normal ni for purposes of shading by simulated lighting.
  • The ni are vectors of the form {vx,vy,vz}. Only the directions of these vectors ever matter; the vectors are in effect automatically normalized to unit length.
  • VertexNormals->None specifies that no explicit vertex normals are being given, and normal directions should be deduced from the actual coordinates specified for vertices. For point and line-like primitives, no shading based on simulated lighting should be done.
  • VertexNormals->Automatic is equivalent to VertexNormals->None, except that vertex normals given in any enclosing GraphicsComplex will be used.

Examples

open allclose all

Basic Examples  (1)

A triangle with all normals pointing in the direction {1,-1,1}:

Using a different normal for one of the triangle's vertices changes the effects of lighting:

Specify vertex normals for 3D lines:

Specify vertex normals for 3D points:

Scope  (2)

Define vertices and face indices of a cylindrical model:

Without surface normals, the shading is constant or flat for each polygon face:

With surface normals, the shading is interpolated or smooth across each polygon face:

Plot functions automatically generate surface normals:

Without surface normals, you get flat or faceted shading:

Applications  (3)

A function that visualizes the surface normals using lines:

Visualize the normals for some surfaces:

Vary the effective normals used on the surface:

A shaded mesh line object with data from ExampleData:

Possible Issues  (1)

Normals in opposite directions may cause unwanted banding effects in some 3D renderers:

Introduced in 2007
 (6.0)
 |
Updated in 2008
 (7.0)