Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Premultiplied RGBA incorrect rendering in SRGB blending mode #469

Open
SoprachevAK opened this issue Dec 22, 2024 · 1 comment
Open

Premultiplied RGBA incorrect rendering in SRGB blending mode #469

SoprachevAK opened this issue Dec 22, 2024 · 1 comment

Comments

@SoprachevAK
Copy link

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.

@SoprachevAK
Copy link
Author

SoprachevAK commented Dec 22, 2024

May be srgb rendering mode overrides blend functions somewhere in rendering pipeline outside CEF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant