obsproject / obs-studio

OBS Studio - Free and open source software for live streaming and screen recording
https://obsproject.com
GNU General Public License v2.0
60.27k stars 7.98k forks source link

Additive blending breaks scene transparency #10681

Open gulagkulak opened 5 months ago

gulagkulak commented 5 months ago

Operating System Info

Other

Other OS

Linux Mint 21.3

OBS Studio Version

30.1.2

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://obsproject.com/logs/p6ENsxS0m3ho5ui7

OBS Studio Crash Log URL

No response

Expected Behavior

I built a 3D studio set in Blender and rendered out the background and foreground elements separately using a holdout matte, with the resulting foreground image having a transparent background. I have a separate glare/bloom pass for the foreground, which is supposed to be composited additively on top of the foreground layer.

To get clean glare/bloom out of Blender, the transparent background is replaced with a black background. In every other application (such as Gimp) compositing black on top of transparent additively results in transparency. The goal here is to have foreground elements throw bloom on top of the live host video.

Current Behavior

Bringing these elements into OBS, the first solution I tried was using OBS folders/groups, expecting them to work like layer folders in Gimp where blending is limited only to the layer folder.

image

This didn't work as expected, however, as the foreground_fx image is additively blended with the background_combined layer, despite it being confined to its own folder/group, which blows out the colors of the background image, because it is already rendered with its own glare/bloom pass.

The second solution I tried was making a separate foreground scene with live video elements:

image

And then including that into another scene:

image

But this replaced all transparent areas of the foreground scene with pure black. The weird thing is that if I right-click on the foreground scene and select "Filters", under filters preview window it still shows the background as transparent (grey) instead of black.

TLDR: What's the issue here?

Having a subscene with transparency and a black-background FX image additively blended on top of it breaks scene transparency.

What's the ideal solution here?

Having the option to limit blending only to group/folder like Gimp does.

image

P.S: If you add a feature to OBS before the end of the month that limits blending only to group/folder and prevents additive blending from breaking transparency, I'll donate 20 euros to your ko-fi / patreon / favorite animal shelter / whatever.

Steps to Reproduce

You can try compositing this test image additively on top of any image with transparency for a subtle bloom effect.

image

When a scene with this fx image and another image below it with transparency is included as a subscene in another scene, it replaces transparency with black.

Anything else we should know?

No response

SuslikV commented 5 months ago

Reason. If you blend something not transparent to background it turns to not transparent area.

Not an issue.

But the scene's Filter preview is bugged (at least many moons ago it surely was, and it had OS independent behavior - I cannot test against v30.1.2, sorry). For scene's Filter preview OBS blends sources to the window's colors when blending mode is set. Easy noticeable on single Color Source of #ff0000 in the scene and Blending Mode: Multiply. When you select Dark theme or System theme - there background of the viewport's window is brighter, and against this color the source will be blended. It is no good if result of the Filter's preview depends on UI theme. When Yami theme was introduced this bug was masked, because it was hard to distinguish the preview background from the window background.