Skip to content

Premultiplied RGBA incorrect rendering in SRGB blending mode #469

@SoprachevAK

Description

@SoprachevAK

Operating System Info

Other

Other OS

macOS 15, Windows 10

OBS Studio Version

Other

OBS Studio Version (Other)

31.0.0, 30.2.3

OBS Studio Log URL

https://obsproject.com/logs/ZJw0Cy9mkJNEyV3i

OBS Studio Crash Log URL

No response

Expected Behavior

The OBS Browser Source should correctly render half transparent colors without darkening colors or introducing artifacts around edges.

image

Current Behavior

Half transparent pixels render darkened than actual should, and black artifacts are present around text (due anti aliasing, which produce half transparency)
image

Steps to Reproduce

  1. Add white color background
  2. Add this html page like Browser source with default CSS preset (transparent body background)
<html lang="en">
<body>
  <div style="
    margin: 0;
    font-size: 2em;
    font-weight: 900;
    font-family: monospace;
  ">
    <p style="color: #ffffff">#ffffff / 100%</p>
    <p style="color: rgb(255 255 255 / 75%)">#ffffff / 75%</p>
    <p style="color: rgb(255 255 255 / 25%)">#ffffff / 25%</p>
    <p style="color: #1e6ce080">#1e6ce0 / 50%</p>
  </div>
</body>
</html>
  1. Switching Blending Method between Default and SRBG Off and see differences

Anything else we should know?

This artifacts looks like premultiplied RGBA rendering like non premultiplied

I am check rendering mechanism, and it correctly set blending mode for premultiplied renderer

gs_blend_function(GS_BLEND_ONE, GS_BLEND_INVSRCALPHA);

I try to play with srgb texture binding, and if set gs_enable_framebuffer_srgb(false); and gs_effect_set_texture(image, draw_texture) here:

gs_effect_set_texture_srgb(image, draw_texture);

All works correctly, but i think, that this code and linear_sample needed for something

I am interested in fixing this bug and can create a PR, but I need advice on which direction to take next.

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