normal()#

Sets the current normal vector.

Examples#

example picture for normal()
 1def setup():
 2    py5.size(100, 100, py5.P3D)
 3    py5.no_stroke()
 4    py5.background(0)
 5    py5.point_light(150, 250, 150, 10, 30, 50)
 6    py5.begin_shape()
 7    py5.normal(0, 0, 1)
 8    py5.vertex(20, 20, -10)
 9    py5.vertex(80, 20, 10)
10    py5.vertex(80, 80, -10)
11    py5.vertex(20, 80, 10)
12    py5.end_shape(py5.CLOSE)

Description#

Sets the current normal vector. Used for drawing three dimensional shapes and surfaces, normal() specifies a vector perpendicular to a shape’s surface which, in turn, determines how lighting affects it. Py5 attempts to automatically assign normals to shapes, but since that’s imperfect, this is a better option when you want more control. This function is identical to gl_normal3f() in OpenGL.

Underlying Processing method: normal

Syntax#

normal(nx: float, ny: float, nz: float, /) -> None

Parameters#

  • nx: float - x direction

  • ny: float - y direction

  • nz: float - z direction

Updated on November 12, 2021 11:30:58am UTC