Sets the emissive color of shapes’ surface material.
The emissiveMaterial()
color sets a color shapes display at full strength, regardless of lighting. This can give the appearance that a shape is glowing. However, emissive materials don’t actually emit light that can affect surrounding objects.
emissiveMaterial()
can be called three ways with different parameters to set the material’s color.
The first way to call emissiveMaterial()
has one parameter, gray
. Grayscale values between 0 and 255, as in emissiveMaterial(50)
, can be passed to set the material’s color. Higher grayscale values make shapes appear brighter.
The second way to call emissiveMaterial()
has one parameter, color
. A p5.Color object, an array of color values, or a CSS color string, as in emissiveMaterial('magenta')
, can be passed to set the material’s color.
The third way to call emissiveMaterial()
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 emissiveMaterial(255, 0, 0)
or emissiveMaterial(255, 0, 0, 30)
. Color values will be interpreted using the current colorMode().
Note: emissiveMaterial()
can only be used in WebGL mode.
Examples
Syntax
emissiveMaterial(v1, v2, v3, [alpha])
emissiveMaterial(gray)
emissiveMaterial(color)
Parameters
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().
alpha value in the current colorMode().
grayscale value between 0 (black) and 255 (white).
color as a p5.Color object, an array of color values, or a CSS string.
Related References
copyToContext
Copies the shader from one drawing context to another.
inspectHooks
Logs the hooks available in this shader, and their current implementation.
modify
Returns a new shader, based on the original, but with custom snippets of shader code replacing default behaviour.
setUniform
Sets the shader’s uniform (global) variables.