Skip to content

bug: libobs: a source set to Darken blending draws black where it is transparent (upstream #6591) #1404

Closed

Description

@rdoupe

Upstream bug: obsproject/obs-studio#6591, reported by SuslikV in June 2022. jpark37 and jw0z96, the author of the blend modes, agreed there that "there's still a bug here". It was closed in February 2023 as not planned. The forum has the same report (threads/source-blending-modes.148443, Darken noted as wrong for transparent images), where the workaround given is to re-export the image on a white background. Still present in this fork.

Location

  • libobs/obs-scene.c.h, obs_blend_mode_params[OBS_BLEND_DARKEN]: GS_BLEND_ONE for all four factors with GS_BLEND_OP_MIN.
  • Direct3D and OpenGL ignore the blend factors for MIN and MAX, so each channel becomes min(source, destination) on premultiplied colour. A transparent source pixel is (0, 0, 0, 0) and always wins: black in colour and 0 in alpha. Lighten (MAX) does not have the problem, because the background wins there.

Class

Wrong output: black areas in the program and recordings, and a hole in the scene's alpha (visible when the scene is nested or keyed).

How it is reached

Add an image with transparent areas (a PNG logo, an overlay), set its Blending Mode to Darken, and put it over any background.

Reproduced in the current release

v0.1.0-beta.20261014 AppImage, headless (private Xvfb, private D-Bus, fresh HOME), driven over obs-websocket. A light grey (209) colour source with a PNG over it whose left half is transparent and whose right half is opaque grey (128), then a scene screenshot:

Blend mode Transparent half Opaque half
Normal 209, 209, 209, alpha 1 128
Darken 0, 0, 0, alpha 0 128
Lighten 209, 209, 209, alpha 1 209
Multiply 209, 209, 209, alpha 1 104

Fix

Darken items always render through their item texture. Clear that texture to opaque white instead of transparent black for Darken, so the source is drawn over white: a transparent pixel then leaves the background, an opaque pixel is unchanged, and a partly transparent one is darkened as the image over white would be (the workaround users were given). PR follows.

Activity

  1. rdoupe commented on Oct 18, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: this issue. RED/GREEN are ready; PR follows once the full test run finishes.

  2. added
    claimed
    on Oct 18, 2026
  3. rdoupe commented on Oct 18, 2026

    @rdoupe
    CollaboratorAuthor

    @SuslikV you reported this in obsproject/obs-studio#6591: a source set to Darken blending drew black where it is transparent and cut a hole in the scene. That's fixed here in obs-rust by #1406, merged today with a regression test.

    Darken uses the MIN blend op, and Direct3D and OpenGL ignore blend factors for MIN, so a transparent pixel (0, 0, 0, 0) always won. A Darken item is now drawn over opaque white in its item texture, so where it's transparent the minimum keeps the background, colour and alpha. Opaque pixels are unchanged, and partly transparent ones darken as the source over white would, which matches the re-export-on-white workaround. Only Darken items change.

    Tested headless with a scene screenshot: a light grey background with a PNG over it, left half transparent and right half grey 128. With Darken, 0.1.0-beta.20261014 gave black with alpha 0 on the left. With the fix the left half keeps the background (209 grey, alpha 1), and the right half stays 128.

    It will be in the next obs-rust daily release after 0.1.0-beta.20261018: https://github.com/obs-rust/obs-studio/releases (Windows, macOS and Linux builds; on Arch it's obs-studio-rust-git in the AUR). obs-rust is an AI-assisted fork of OBS, based on current OBS master, with extra bug fixes like this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    claimed

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions