XML technologies / SVG / Filters, transformations and gradients / Using and combining filters and lighting effectively / Lighting effects / Defining lighting effects

(Excerpt from “Das Einsteigerseminar SVG — Webgrafiken mit XML” by Helma Spona)

Light sources so far have been defined inside the filter element <feDiffuseLighting>, producing diffuse light. Another option is the element <feSpecularLighting>. Both are explained here.

The element <feDiffuseLighting> has, besides the universal attributes, these attributes:

Applied successively to the previous example’s circle, these filters produce:

Results of the feDiffuseLighting filters on the circle

Figure: Results of the feDiffuseLighting filters on the circle.

Note:
Inside the <feDiffuseLighting> element, only one light source is allowed. For several, define multiple lighting effects and combine their results with <feComposite>.

The second lighting option is the tag <feSpecularLighting>. Unlike <feDiffuseLighting>, it produces transparent rather than opaque lighting. Transparency depends on its attributes, listed below:

Although documentation does not say the filter element <feComposite> is required, tests with Adobe SVG Viewer showed no visible effect unless the result was merged with the original through the <feComposite> instruction. Without it, correct display occurs only when applying <feSpecularLighting> to an external graphic included with the <image> tag in the SVG graphic.

Note:

In the filter element <feComposite>, the attribute in is optional. Omitting it automatically uses the preceding filter element’s result, also avoiding the need to specify its attribute result.

Results of the feSpecularLighting filters

Figure: Results of the feSpecularLighting filters.

   

 

 

 

back to top