Py5Shape.set_ambient()
Contents
Py5Shape.set_ambient()¶
Sets a Py5Shape
object’s ambient reflectance.
Examples¶

1 2 3 4 5 6 7 8 9 10 11 12 | def setup():
py5.size(100, 100, py5.P3D)
py5.background(0)
py5.directional_light(153, 153, 153, .5, 0, -1)
py5.ambient_light(50, 50, 50)
py5.no_stroke()
s = py5.create_shape(py5.SPHERE, 20)
s.set_ambient("#FF0000")
py5.shape(s, 50, 25)
s.set_ambient("#FFFF00")
py5.shape(s, 50, 75)
|
Description¶
Sets a Py5Shape
object’s ambient reflectance. This is combined with the ambient light component of the environment. The color components set through the parameters define the reflectance. For example in the default color mode, calling set_ambient(255, 127, 0)
, would cause all the red light to reflect and half of the green light to reflect. Use in combination with Py5Shape.set_emissive(), Py5Shape.set_specular(), and Py5Shape.set_shininess() to set the material properties of a Py5Shape
object.
The ambient
parameter can be applied to the entire Py5Shape
object or to a single vertex.
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.setAmbient
Syntax¶
set_ambient(ambient: int, /) -> None
set_ambient(index: int, ambient: int, /) -> None
Parameters¶
ambient: int - any color value
index: int - vertex index
Updated on November 12, 2021 11:30:58am UTC