Skip to content

Fix premultiplied sRGB browser rendering - #533

Open
SoprachevAK wants to merge 2 commits into
obsproject:masterfrom
SoprachevAK:fix/browser-premultiplied-srgb-blending
Open

Fix premultiplied sRGB browser rendering#533
SoprachevAK wants to merge 2 commits into
obsproject:masterfrom
SoprachevAK:fix/browser-premultiplied-srgb-blending

Conversation

@SoprachevAK

@SoprachevAK SoprachevAK commented Aug 17, 2026

Copy link
Copy Markdown

Description

Uses the scene item's linear-sRGB state to select the correct rendering path for premultiplied browser textures:

  • Linear blending uses DrawSrgbDecompressPremultiplied.
  • Nonlinear blending draws the texture without conversion.

Also sets OBS_SOURCE_INITIAL_BLEND_METHOD_SRGB_OFF so new browser scene items initially use nonlinear blending.

Depends on obsproject/obs-studio#13797, this fixes #469.

Motivation and Context

This is the obs-browser companion to obs-studio#13797, which contains the core rendering changes, migration logic, and full motivation.

Chromium composites content in nonlinear sRGB, so browser sources should initially use nonlinear blending while still providing a correct linear rendering path when selected by the user.

How Has This Been Tested?

Manually tested on a MacBook Pro with an Apple M5 Pro running macOS 26.5.2, together with the changes from obs-studio#13797.

Verified both linear and nonlinear blending with opaque and semi-transparent content over transparent, black, and white backgrounds. The test page, comparison screenshots, and detailed results are included in the main PR.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have read the contributing document.
  • My code has been run through clang-format.
  • My code follows the project's style guidelines
  • My code is not on the master branch.
  • My code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.
  • I have used AI tooling in the creation of this PR.
    • AI tooling was used for research and autocomplete assistance. I deliberately reviewed, understood, and verified every submitted line of code, and personally evaluated all architectural decisions and trade-offs.

Andrei Soprachev added 2 commits August 17, 2026 06:39
Use the scene item's linear-sRGB state to select the appropriate draw
path for the premultiplied browser texture.

When linear compositing is active, decompress the texture and enable
framebuffer sRGB. Draw it without conversion for nonlinear compositing.
Chromium composites content in nonlinear sRGB. Set
OBS_SOURCE_INITIAL_BLEND_METHOD_SRGB_OFF so new browser items use
nonlinear compositing and more closely match their appearance in
Chromium.
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

Successfully merging this pull request may close these issues.

Semitransparent rendering bug in SRGB blending method

1 participant