Skip to content

SVG filters #756

Closed
Closed

Description

@thebabydino

Description

SVG filters should allow us to a achieve a lot of effects that otherwise involve content duplication or using external images or JS (canvas, whether 2D or WebGL). That is, if they worked properly. This is an area of the web that has been long neglected. There are lots of bugs, some of them over a decade and a half old. A lot of things don't work properly in one browser or another or they're slow or they don't work at all.

(screenshots below link to live demos)

Bringing up two other stroked versions of a link's text on :hover/ :focus. Without going the SVG filter route, this would involve creating multiple copies of the text inside pseudos. With the SVG filter, I use a displacement map created and animated from the CSS - this fails in Firefox (bug 🪲 1883933).

stroked navigation links, the hovered one having two extra slightly offset copies

This is a problem whenever I want to modify the displacement map via CSS (which allows for a lot of cool effects) because I need to extract it from the SourceGraphic.

These fashion poster effects where the text is filled/ outlined based on whether it intersects a contrasting garment or not all fail in Safari due to weird tiling issues (bug 🪲 266295). These are all made with a single .jpg image and don't require text duplication. It's just that the garments in question contrast strongly with the rest of the image (that is, their RGB channels do), so that lets me extract them as a sort of alpha mask via feColorMatrix.

fashion poster where the word "bangs" in all caps has a crimson fill outside its intersection with a crimson blouse and a red stroke within the intersction area fashion poster where the words "inner peace" in all caps have an orange fill outside the intersection with a dark blue dress and a white stroke within this intersection area

Sometimes the Safari tiling issues are more subtle like in the case of this demo (or this one), but they're still there.

Another text :hover effect fails in both Firefox and Safari due to the previously mentioned bugs.

Same happens with this (no text duplication) letters opening on :hover effect - it's broken in Safari due to tiling issues and in Firefox due to the fact that displacement maps extracted from the SourceGraphic (so I can create and modify them via CSS) don't work.

image

A very simple marquee fails in Safari because tiling is just broken (see also bug 🪲 270567) and sometimes in Firefox as well (bug 🪲 1917481).

marquee

Basically, anything that involves feTile is broken in Safari.

"never give up" in all caps, letters offset up and down based on parity; it also has outline shadows tiled up and down

This bubble text effect on scroll is broken in Safari due to tiling and in Firefox due to the displacement issue.

bubble

Same goes for this tiled and distorted text demo.

image

Creating a textured 3D heading using the techniques from this decade old Smashing Magazine article fails in Safari due to the same tiling issues and due to the fact that it apparently discards the whole filter if it exceeds a certain number of primitives.

textured 3D heading

Textured text in general seems to be hitting that primitive limit quite often.

textured text
textured text

Chrome also does this strange thing on wide gamut displays where it finds something nonzero on the red or blue channel in rgb(0%, 100%, 0%). Filed bug 🪲 373410239 for this.

This means a lot of what uses feColorMatrix doesn't look quite right in Chrome on wide gamut displays. For example, we see this:

grey section background issue

instead of the correct result:

correct result, no muddy grey background area

Or we see this:

grey section background issue

instead of this:

correct result, no muddy grey backgrounds under text slices

There are already cool things we can do with SVG (that would otherwise involve content duplication/ extra elements/ using external images/ canvas or that don't have reliable solutions without weird hacks otherwise) working cross-browser (or at least what doesn't work properly cross-browser isn't related to SVG).

gradient text with same gradient shadow/ glow
realistic image-reflecting grainy shadows
blobby navigation highlight moving from previously selected item to currently selected one, changing text color on intersection
animated single img gradient glow borders with CSS + SVG filter enhancement
rounding corners of background behind unknown wrapping text
one hovered letter is flickering
selective desaturation

Specification

Filter Effects Module Level 1

Additional Signals

No response

Activity

  1. rol4nd909 commented on Oct 3, 2024

    @rol4nd909

    Yes please Interop give SVG some deserved love

  2. ydaniv commented on Oct 15, 2024

    @ydaniv
  3. wpt-interop commented on Feb 13, 2025

    @wpt-interop
    Collaborator

    Thank you for proposing SVG filters for inclusion in Interop 2025.

    We wanted to let you know that this proposal was not selected to be part of Interop this year.

    On behalf of the entire Interop team, thank you for submitting this proposal for consideration. We got many more proposals than we could include in this year's project, necessitating some difficult choices. Please note this should not be taken as a comment on the technology as a whole, or our willingness to consider it for Interop in the future. We appreciate the work you put into your proposal, and would welcome your participation in future rounds of Interop.

    For an overview of our process, see proposal selection. Thank you again for contributing to Interop 2025.

    Posted on behalf of the Interop team.

  4. BearCooder commented on Sep 22, 2025

    @BearCooder

    Hey @thebabydino do you want to resubmit this proposal for this years interop? Submissions are open for two days still

  5. thebabydino commented on Sep 24, 2025

    @thebabydino
    Author

    I did/ still do, but I've had a lot to do and now when I tried to at the last moment, I just couldn't figure out how to, so I guess I'm not. Pretty sure filters aren't a priority anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    focus-area-proposal

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions