Note: There are no new demos added at this point and this site is in maintenance mode
start svg demo download
ff3.5 o9.6+

Chiseled

author: Vincent Hardy posted: October 04, 2009 at 03:00 PM categories: filters view comments

This example shows how SVG filter primitives can be applied to produce a sophisticated rendering effect. In this image, a filter effect is applied to <text> elements. One with the "SVG" text and several with the "W", "O", "W", "!" characters. The characters are grouped into a <g> element which has a 'glow' filter. The "SVG" text has a 'chiseled' filter applied to it.

The 'glow' filter

This is a simple filter and it does the following:

  1. Turn the input (i.e., the "WOW!" text) into white, using the <feFlood> and <feComposite> filters. feFlood creates a white surface which is composited with the text's alpha (i.e., a chanel providing the translucency information about the text's rendering) using the 'in' operator.
  2. The white rendering of the text input is blurred using the <feGaussianBlur> filter
  3. The blured white is combined with the original text rendering using the <feMerge> filter

The 'cliseled' filter

This filter is more elaborate and contains 22 filter primitives to achieve the chiseled gold effect.

There a multiple parts to the filter. The background texture is created using an image texture, loaded with an <feImage>. The texture is then used as a bump map (created with an <feColorMatrix> which allows us to convert the texture's luminance to an alpha channel, required as an input for the lighting filter's bump map) to give it more texture with an <feDiffuseLighting> filter.

The golden text is done very much similarly, except that the bump map is created by blurring the text's alpha channel and the color compolents are adjusted with <feComponentTransfer>.

There is also a drop shadow effect done with a combination of <feGaussianBlur>, <feMorphology>, <feOffset> and <feComposite>.

Multiple instances of the feMerge> and <feComposite> filters are used to overlay or mask different intermediate filter primitive results.

blog comments powered by Disqus