From fb1ba861f38e1711f839d832be11d0e69ba3d144 Mon Sep 17 00:00:00 2001 From: Andrei Soprachev <13734096+SoprachevAK@users.noreply.github.com> Date: Mon, 17 Aug 2026 06:39:45 +0300 Subject: [PATCH 1/2] Fix premultiplied sRGB rendering 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. --- obs-browser-source.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/obs-browser-source.cpp b/obs-browser-source.cpp index 964e25999..d01e581aa 100644 --- a/obs-browser-source.cpp +++ b/obs-browser-source.cpp @@ -597,33 +597,25 @@ void BrowserSource::Render() gs_effect_t *effect = obs_get_base_effect(OBS_EFFECT_DEFAULT); #endif - bool linear_sample = extra_texture == NULL; gs_texture_t *draw_texture = texture; - if (!linear_sample && !obs_source_get_texcoords_centered(source)) { + if (extra_texture && !obs_source_get_texcoords_centered(source)) { gs_copy_texture(extra_texture, texture); draw_texture = extra_texture; - - linear_sample = true; } + const bool linear_srgb = gs_get_linear_srgb(); const bool previous = gs_framebuffer_srgb_enabled(); - gs_enable_framebuffer_srgb(true); + gs_enable_framebuffer_srgb(linear_srgb); gs_blend_state_push(); gs_blend_function(GS_BLEND_ONE, GS_BLEND_INVSRCALPHA); gs_eparam_t *const image = gs_effect_get_param_by_name(effect, "image"); - const char *tech; - if (linear_sample) { - gs_effect_set_texture_srgb(image, draw_texture); - tech = "Draw"; - } else { - gs_effect_set_texture(image, draw_texture); - tech = "DrawSrgbDecompress"; - } + gs_effect_set_texture(image, draw_texture); const uint32_t flip_flag = flip ? GS_FLIP_V : 0; + const char *tech = linear_srgb ? "DrawSrgbDecompressPremultiplied" : "Draw"; while (gs_effect_loop(effect, tech)) gs_draw_sprite(draw_texture, flip_flag, 0, 0); From ecf1d9f42e5a8d52d5f70d599c8ec9c54df82a71 Mon Sep 17 00:00:00 2001 From: Andrei Soprachev <13734096+SoprachevAK@users.noreply.github.com> Date: Mon, 17 Aug 2026 06:42:50 +0300 Subject: [PATCH 2/2] Use sRGB-off as initial blend method 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. --- obs-browser-plugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs-browser-plugin.cpp b/obs-browser-plugin.cpp index 95a168c6b..3f106479e 100644 --- a/obs-browser-plugin.cpp +++ b/obs-browser-plugin.cpp @@ -433,7 +433,7 @@ void RegisterBrowserSource() info.id = "browser_source"; info.type = OBS_SOURCE_TYPE_INPUT; info.output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_AUDIO | OBS_SOURCE_CUSTOM_DRAW | OBS_SOURCE_INTERACTION | - OBS_SOURCE_DO_NOT_DUPLICATE | OBS_SOURCE_SRGB; + OBS_SOURCE_DO_NOT_DUPLICATE | OBS_SOURCE_SRGB | OBS_SOURCE_INITIAL_BLEND_METHOD_SRGB_OFF; info.get_properties = browser_source_get_properties; info.get_defaults = browser_source_get_defaults; info.icon_type = OBS_ICON_TYPE_BROWSER;