Py5Shape.get_ambient()#

Get the ambient reflectance setting for one of a Py5Shape object’s vertices.

Examples#

example picture for get_ambient()
 1def setup():
 2    py5.size(100, 100, py5.P3D)
 3    py5.background(0)
 4    py5.directional_light(153, 153, 153, .5, 0, -1)
 5    py5.ambient(255, 255, 0)
 6    py5.ambient_light(50, 50, 50)
 7    py5.no_stroke()
 8    s = py5.create_shape(py5.SPHERE, 30)
 9
10    py5.shape(s, 50, 50)
11    ambient = s.get_ambient(0)
12    py5.println(py5.red(ambient), py5.green(ambient), py5.blue(ambient))

Description#

Get the ambient reflectance setting for one of a Py5Shape object’s vertices. This setting is combined with the ambient light component of the environment. Use Py5Shape.set_ambient() to change the setting.

This method can only be used for a complete Py5Shape object, and never within a Py5Shape.begin_shape() and Py5Shape.end_shape() pair.

Underlying Processing method: PShape.getAmbient

Syntax#

get_ambient(index: int, /) -> int

Parameters#

  • index: int - vertex index

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