is an option for graphics primitives which specifies the normal directions to assign to 3D vertices.
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 all close allBasic Examples (1)
A triangle with all normals pointing in the direction
:
{p1, p2, p3} = {{1, 0, 0}, {1, 1, 1}, {0, 0, 1}};
n = {1, -1, 1};
Graphics3D[{Yellow, Polygon[{p1, p2, p3}, VertexNormals -> {n, n, n}]}]Using a different normal for one of the triangle's vertices changes the effects of lighting:
n2 = {-1, 0, 1};
Graphics3D[{Yellow, Polygon[{p1, p2, p3}, VertexNormals -> {n2, n, n}]}]Specify vertex normals for 3D lines:
Graphics3D[{Thickness[.04], Yellow, Line[{p1, p2, p3, p1}, VertexNormals -> {n2, n, n, n2}]}]Specify vertex normals for 3D points:
Graphics3D[{PointSize[.1], Yellow, Point[{p1, p2, p3}, VertexNormals -> {n2, n, n}]}, PlotRangePadding -> 0.1]Scope (2)
Define vertices and face indices of a cylindrical model:
vl = Join[Table[{Cos[2π i / 20], Sin[2π i / 20], 0}, {i, 20}], Table[{Cos[2π i / 20], Sin[2π i / 20], 2}, {i, 20}]];il = Table[{i, Mod[i + 1, 20, 1], Mod[i + 21, 20, 21], i + 20}, {i, 1, 20}];Without surface normals, the shading is constant or flat for each polygon face:
Graphics3D[{Yellow, EdgeForm[], GraphicsComplex[vl, Polygon[il]]}]With surface normals, the shading is interpolated or smooth across each polygon face:
Graphics3D[{Yellow, EdgeForm[], GraphicsComplex[vl, Polygon[il], VertexNormals -> vl]}]Plot functions automatically generate surface normals:
Plot3D[Exp[-(x ^ 2 + y ^ 2)], {x, -2, 2}, {y, -2, 2}, NormalsFunction -> Automatic, Mesh -> None]Without surface normals, you get flat or faceted shading:
Plot3D[Exp[-(x ^ 2 + y ^ 2)], {x, -2, 2}, {y, -2, 2}, NormalsFunction -> None, Mesh -> None]Applications (3)
A function that visualizes the surface normals using lines:
normalsShow[g_Graphics3D] :=
Module[{pl, vl, n},
{pl, vl} = First@Cases[g, GraphicsComplex[pl_, prims_, VertexNormals -> vl_, opts___ ? OptionQ] :> {pl, vl}, Infinity];
n = Length[pl];
Show[g, Graphics3D[GraphicsComplex@@{Join[pl, pl + vl / 3], {Black, Line[Table[{i, i + n}, {i, n}]]}}]]
];Visualize the normals for some surfaces:
Plot3D[Exp[-(x ^ 2 + y ^ 2)], {x, -2, 2}, {y, -2, 2}, Mesh -> None]//normalsShowParametricPlot3D[{Cos[ϕ]Sin[θ], Sin[ϕ]Sin[θ], Cos[θ]}, {θ, 0, Pi}, {ϕ, 0, 2Pi}, Mesh -> None, PlotRange -> 1.3]//normalsShowVary the effective normals used on the surface:
Plot3D[Sin[x + y ^ 2], {x, -3, 3}, {y, -2, 2}, Mesh -> None, NormalsFunction -> Function[{x, y, z}, RandomReal[{0, 1}, {3}]]]A shaded mesh line object with data from ExampleData:
ExampleData[{"Geometry3D", "Beethoven"}] /. Polygon[pts_] :> Line[pts, VertexNormals -> Automatic]Possible Issues (1)
Normals in opposite directions may cause unwanted banding effects in some 3D renderers:
{p1, p2, p3} = {{1, 0, 0}, {1, 1, 1}, {0, 0, 1}};
n = Cross[p2 - p1, p3 - p1];
Style[Graphics3D[{Yellow, Polygon[{p1, p2, p3}, VertexNormals -> {-n, n, n}]}], RenderingOptions -> {"3DRenderingEngine" -> "Metal"}]See Also
Related Guides
-
▪
- 3D Graphics Options ▪
- Colors ▪
- Polygons ▪
- Polyhedra
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_2026_vertexnormals, author="Wolfram Research", title="{VertexNormals}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/VertexNormals.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_vertexnormals, organization={Wolfram Research}, title={VertexNormals}, year={2008}, url={https://reference.wolfram.com/language/ref/VertexNormals.html}, note=[Accessed: 13-June-2026]}