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
null to clear it.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.