Skip to content

Feature Request: Allow BlendMode::None when applying a backdrop-filter blur #4294

Open
@johnoneil

Description

@johnoneil

I've been struggling with an issue related rendering images with alpha channels as opaque while also applying backdrop-filter blurs. We have some images that have alpha channel information but we'd like to render them 100% opaque, and with blurs on top. Can't quite get it to work.
I've done work recreating the issue in wrench and can step through the issue in the debugger, and I'm currently of the opinion that this functionality would have to be added, but thought I would walk through our case and ask if perhaps we're going about this the wrong way.
Since wrench allows sharing of test cases very easily I've written several and they are linked below.
Also forgive me for being a bit pedantic as I don't know webrender very well and am also using this as a learning exercise.

so I'm going to walk through our use case pretty slowly. It's mostly for my benefit as I don't know webrender very well. Any suggestions to achieve what we're looking for is appreciated.

Case 1 (no issue): Images with alpha and premultiplied alpha

I had to make some changes to wrench (which currently converts all input images to premultiplied alpha) but I just wanted to test displaying images with "normal" alpha vs premultiplied alpha. The image on the left uses standard alpha, the image on the right uses premultiplied alpha. Both are correct. Excellent. The yaml file I'm using for this is here.
case1 alpha yaml

Case 2 (no issue): Specifying opacity

The next case takes the images from above and simply specifies they should be opaque (using ImageDescriptorFlags::IS_OPAQUE). I added the ability to specify opacity to wrench as it currently infers opacity from the image content. So, regardless of image content (presence of an alpha channel) I'd like to specify certain images to be opaque. The public API makes this possible, and the results below are correct. The dark bottom of the image on the right is because the alpha was premultiplied into the color channels. The yaml file for this test is here.
case2 opaque yaml

Case 3 (no issue): Specifying a backdrop-filter blur over transparent images

The next case superimposes a blur (specifically a backdrop-filter blur) over case 1 above (images are transparent). As you'd expect, the results are correct. The yaml file for this test is here.
case3 alpha-with-blur yaml

Case 4 (issue): Specifying a 'backdrop-filter` blur over opaque images.

Now the problematic part. This case superimposes a backdrop-filter blur over images which have been tagged via ImageDescriptorFlags::IS_OPAQUE. As can be seen the opacity is not preserved in this case. I'd expect the color bars beneath the blur should look more like Case 2 above rather than Case 1 The yaml script for this test is here.
case4 opaque with blur

case4 opaque with blur

Summary:

Do you think there is another way to achieve the desired effect? I've iterated quite a bit on using different blend modes and stacking contexts (wrench makes this very easy) but the tagged image opacity seems to be lost when batching the complex rendering passes required for the backdrop-filter blur.
I'd also be interested in any suggestions for ways to debug this (for example visualizing the various passes done for backdrop-filter blurs) and perhaps getting more info in how the batches are formed.

Appreciate any help you can provide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions