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:

Wolfram Research (2007), VertexNormals, Wolfram Language function, https://reference.wolfram.com/language/ref/VertexNormals.html (updated 2008).

Text

Wolfram Research (2007), VertexNormals, Wolfram Language function, https://reference.wolfram.com/language/ref/VertexNormals.html (updated 2008).

CMS

Wolfram Language. 2007. "VertexNormals." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2008. https://reference.wolfram.com/language/ref/VertexNormals.html.

APA

Wolfram Language. (2007). VertexNormals. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/VertexNormals.html

BibTeX

@misc{reference.wolfram_2024_vertexnormals, author="Wolfram Research", title="{VertexNormals}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/VertexNormals.html}", note=[Accessed: 30-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_vertexnormals, organization={Wolfram Research}, title={VertexNormals}, year={2008}, url={https://reference.wolfram.com/language/ref/VertexNormals.html}, note=[Accessed: 30-December-2024 ]}