Reference ambientTexture()

ambientTexture()

Sets an image that controls the color a shape reflects from ambient light.

An ambient map varies the color set by ambientMaterial() across a surface, so different parts of one shape can pick up ambient light differently. It works like texture(), but the map's color is applied to the ambient term rather than the base color.

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

An ambientLight() is needed to see the effect. Models loaded with loadModel() apply their own ambient map from the .mtl file's map_Ka.

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

Examples

Syntax

ambientTexture(tex)

Parameters

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

Related References