obsproject / obs-browser

CEF-based OBS Studio browser plugin
GNU General Public License v2.0
776 stars 220 forks source link

Alpha rendering is broken on macOS for v27+ #299

Closed cienijr closed 2 years ago

cienijr commented 3 years ago

Operating System Info

macOS 10.15

Other OS

No response

OBS Studio Version

27.0.1

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://obsproject.com/logs/Yg1-271zchqI37ur

OBS Studio Crash Log URL

No response

Expected Behavior

Until 26.1.2, our overlay graphics rendered correctly, across Windows and macOS:

Screen Shot 2021-06-21 at 11 57 43

(Program has a white color source behind ("FUNDO BRANCO" in the sources list), in preview (left) this source is disabled)

At 27.0.1 on Windows, our graphics are still rendered correctly (the fonts are different since Helvetica Neue is not available on Windows):

2021-06-21 (1)

(Program has a white color source behind ("Fonte de cor" in the sources list), in preview (left) this source is disabled)

Current Behavior

Starting with 27.0.0 (still happening for 27.0.1), the colors are rendering differently:

Screen Shot 2021-06-21 at 11 57 40

Against the black background (Preview), the red colors are a bit brighter. With the white background (Program), it almost disappeared (IRL there's a camera feed behind the overlay, so the text at the bottom also looks bad since it is also partially transparent).

I only tested with rgba, but my guess is that it would happen with CSS opacity as well.

Steps to Reproduce

  1. Create a HTML file with a semi transparent background
    <html>
    <head>
    <style type="text/css">
    html {background: transparent}
    body {background: rgba(255, 0, 0, 0.5)}
    </style>
    </head>
    <body>
    Hello world!
    </body>
    </html>
  2. Import it as a browser source and remove the custom CSS provided by default

Anything else we should know?

Under "Expected Behavior", I noticed that the colors are a bit different between the screenshots that I sent - I don't know if it's related to the different OSes or if it's related to the different versions (I'm currently unable to test against OBS 26 on Windows).

jpark37 commented 3 years ago

300 fixes a problem, but doesn't return to the old behavior. With the repro steps, OBS 26 is 255/127/127, and OBS 27 Mac is 204/187/187. After the PR, the repro case will be 255/187/187 on all platforms. There is an issue here, but the solution may not be exactly what you want.

The change is because we blend in linear space now for various reasons. In color math, 187 is actually halfway between 0 and 255, not 127. As a result, semi-transparent colors won't behave like they used to, and our expectation is that this will be better long-term even if some people need to adjust their assets to compensate.

In other words, the PR will partially move the color closer to 26 behavior for browser sources, but you may also need to adjust things on your side to achieve your desired look. Unfortunately you won't be able to tune for that until the PR is merged, and another OBS is released, so you may want to stay on 26 until then.

jpark37 commented 3 years ago

Here's some more info about changes to the color setup: https://github.com/obsproject/obs-studio/wiki/Linear-Color-Blending

WizardCM commented 2 years ago

This should be fixed for most cases in OBS 27.1.