Using border radius in a Browser Source leaves behind a light gray artifact

Zaytri

New Member
Whenever I use a browser source with a transparent background with elements that have a border radius, there's a light gray artifact of the curve.

You can see that here:

1698448124023.png


To reproduce this, create an HTML file with this code, and add it to a browser source as local file:
HTML:
<!DOCTYPE html>
<html lang="en">
  <body style="font-size: 24px">
    <div
      style="
        background-color: #fef9e0;
        border-radius: 20px;
        margin: 10px;
        padding: 10px;
      "
    >
      border-radius: 20px;
    </div>
    <div
      style="
        background-color: #fef9e0;
        border-radius: 999px;
        margin: 10px;
        padding: 10px;
      "
    >
      border-radius: 999px;
    </div>
    <div
      style="
        background-color: #fef9e0;
        border-radius: 5px;
        margin: 10px;
        padding: 10px;
      "
    >
      border-radius: 5px;
    </div>
  </body>
</html>

And then add an image source of a white box underneath that browser source.

This only happens if the browser source background is transparent. If the brower source's custom CSS is changed to make the background color white:
CSS:
body { background-color: white; margin: 0px auto; overflow: hidden; }
Then it renders find without issue.

The problem is I do want it to be transparent so it can be overlaid on top of other sources, such as if the browser source was a custom chat box overlay and I had a separate source for the chat box background, like this:

1698448766271.png


Is there anything I can do to prevent the light gray artifact from appearing, or is it a bug in the OBS Browser Source itself?
 

Zaytri

New Member
Ok, so it wasn't just limited to browser source border radius, it was any source that had transparency where the edges were curved or just straight in general.

Anyway, I found a fix for this!! So for anyone else who found this, right click the source > Blending Method > SRGB Off

That's it, I can't believe it was that simple but also how was anyone supposed to know what SRGB does anyway
 

Suslik V

Active Member
Blending methods in OBS:
  • Default - performs blending in linear space.
  • SRGB Off - performs blending in non-linear space with premultiplied alpha.

Dark edges of transparent objects in most cases indicate an incorrectly selected blending method.
Tech details about the feature itself (available since 2022-08-03 OBS v28.0.0-beta1, sad you found the solution so late...): https://github.com/obsproject/obs-studio/pull/6257

More about OBS can be found in the Guides and in the Help:
 

Zaytri

New Member
Blending methods in OBS:
  • Default - performs blending in linear space.
  • SRGB Off - performs blending in non-linear space with premultiplied alpha.

Dark edges of transparent objects in most cases indicate an incorrectly selected blending method.
Tech details about the feature itself (available since 2022-08-03 OBS v28.0.0-beta1, sad you found the solution so late...): https://github.com/obsproject/obs-studio/pull/6257

More about OBS can be found in the Guides and in the Help:
how is someone with zero knowledge of color space supposed to know what is and isn't the correct blending method to use, especially when the one marked as "Default" was the wrong one

like should SRGB Off be used whenever transparent pixels are involved? is there a reason I should ever use Default? even just a semi-transparent white browser source, is entirely gray on Default but acts normally with SRGB Off
 

Suslik V

Active Member
...should SRGB Off be used whenever transparent pixels are involved? is there a reason I should ever use Default?
It's not that simple. Developer's opinion:

In short, if the drawing is not OK - try to change something. If nothing helps - you've most likely discovered a bug.
Example of the thread where bug was reported, confirmed and fixed: https://obsproject.com/forum/threads/image-mask-blend-broken-as-of-v27.145973/

You may be surprised that still many program fails when you test them with the scaling and premultiplied alpha (transparency) tests. Examples of such tests:
 
Top