<feDiffuseLighting>

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨July 2015⁩.

The <feDiffuseLighting> SVG filter primitive lights an image using the alpha channel as a bump map. The resulting image, which is an RGBA opaque image, depends on the light color, light position and surface geometry of the input bump map.

The light map produced by this filter primitive can be combined with a texture image using the multiply term of the arithmetic operator of the <feComposite> filter primitive. Multiple light sources can be simulated by adding several of these light maps together before applying it to the texture image.

Like other filter primitives, it handles color components in the linearRGB color space by default. You can use color-interpolation-filters to use sRGB instead.

Usage context

CategoriesFilter primitive element
Permitted contentAny number of descriptive elements and exactly one light source element, in any order.

Attributes

DOM Interface

This element implements the SVGFEDiffuseLightingElement interface.

Example

The following example show the effect of the <feDiffuseLighting> element on a circle with each light source available. Each time, the light comes from the upper left corner.

Expected rendering:

Expected rendering for the example

Live rendering:

Specifications

Specification
Filter Effects Module Level 1
# feDiffuseLightingElement

Browser compatibility

See also