Reference specularTexture()

specularTexture()

Sets an image that controls where a shape looks glossy.

A specular map lets one shape mix polished and worn surfaces. It works like texture(), but instead of setting the base color, the map's color at each point scales the highlight set by specularMaterial(). Bright parts of the map stay shiny and dark parts look matte.

The parameter, tex, is the image to use as the specular map. Passing null clears it, as in specularTexture(null). The map can also be scoped between push() and pop().

A light source is needed to see the effect. Models loaded with loadModel() apply their own specular map from the .mtl file's map_Ks.

Note: specularTexture() can only be used in WebGL mode.

Examples

Syntax

specularTexture(tex)

Parameters

tex
p5.Image|p5.MediaElement|p5.Graphics|p5.Texture|p5.Framebuffer|p5.FramebufferTexture: image to use as the specular map, or null to clear it.

Related References