Sets the specular color of shapes’ surface material.
The specularMaterial() color sets the components of light color that glossy coats on shapes will reflect. For example, calling specularMaterial(255, 255, 0) would cause a shape to reflect red and green light, but not blue light.
Unlike ambientMaterial(), specularMaterial() will reflect the full color of light sources including directionalLight(), pointLight(), and spotLight(). This is what gives it shapes their "shiny" appearance. The material’s shininess can be controlled by the shininess() function.
specularMaterial() can be called three ways with different parameters to set the material’s color.
The first way to call specularMaterial() has one parameter, gray. Grayscale values between 0 and 255, as in specularMaterial(50), can be passed to set the material’s color. Higher grayscale values make shapes appear brighter.
The second way to call specularMaterial() has one parameter, color. A p5.Color> object, an array of color values, or a CSS color string, as in specularMaterial('magenta'), can be passed to set the material’s color.
The third way to call specularMaterial() has four parameters, v1, v2, v3, and alpha. alpha is optional. RGBA, HSBA, or HSLA values can be passed to set the material’s colors, as in specularMaterial(255, 0, 0) or specularMaterial(255, 0, 0, 30). Color values will be interpreted using the current colorMode().
Ejemplos
Sintaxis
specularMaterial(gray, [alpha])
specularMaterial(v1, v2, v3, [alpha])
specularMaterial(color)
Parámetros
grayscale value between 0 (black) and 255 (white).
alpha value in the current current colorMode().
red or hue value in the current colorMode().
green or saturation value in the current colorMode().
blue, brightness, or lightness value in the current colorMode().
color as a p5.Color object, an array of color values, or a CSS string.
Referencias Relacionadas
ambientMaterial
Establece el color ambiental del material de la superficie de las formas.
createFilterShader
Crea un objeto p5.Shader para ser utilizado con la función filter().
createShader
Crea un nuevo objeto p5.Shader.
emissiveMaterial
Establece el color de emisión del material de la superficie de las formas.