Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option for transparent window instead of chroma key #28

Open
jansol opened this issue Feb 12, 2024 · 6 comments
Open

Option for transparent window instead of chroma key #28

jansol opened this issue Feb 12, 2024 · 6 comments

Comments

@jansol
Copy link

jansol commented Feb 12, 2024

At least on plasma wayland, when capturing a transparent window with OBS the captured stream inherits the transparency and gets blended properly on top of other content in OBS. This would be a convenient way to get rid of artifacts on translucent pixels caused by the chroma key e.g. on antialiased outer contour lines (and of course semitransparent areas in general).

@mecwerks
Copy link
Contributor

@jansol Hi there! First of all thank you for using my app!

Sorry if I'm misunderstanding something, but the program currently DOES support window transparency. I have tested this for sure on Windows, but don't recall if I had tested under Linux, although I'm pretty sure I did at the time.

There is this note I had in the readme:

NOTE: If you would like to avoid chroma key in OBS, set "Allow Transparency" in OBS source settings, and set background color to black in the pngapp settings. This is how I personally use it to stream.

Please let me know if this is not the case or if it is broken under Linux.

@jansol
Copy link
Author

jansol commented Feb 13, 2024

Hmm, I don't see an alpha slider anywhere. If I merely set the background to black I get an opaque black background in OBS.

The reason I even noticed that it would work that easily is that I forgot to remove background elements when adding a capture of my semitransparent terminal, which turned out to still be semitransparent in OBS. The capture on Linux / Wayland is based on pipewire which handles all video streams as 32-bit floating-point RGBA so that part will Just Work. The main problem seems to be that the window itself has not been created with an alpha channel (or I'm simply failing at correctly setting the background value for it).

@mecwerks
Copy link
Contributor

I can confirm that window transparency works as intended at least on windows.

You have to use "Game Capture" instead of "Window Capture", and toggle the "Allow Transparency" option. Then you will probably want to add a crop filter to remove the UI elements from the capture.

@jansol
Copy link
Author

jansol commented Feb 13, 2024

There is no "Game Capture" option on Linux, only "Window Capture (PipeWire)" and "Screen Capture (PipeWire)". But again, the problem remains that the window itself is not transparent. There's probably a window creation flag in Löve2D to enable that somewhere, I'll take a look later.... I guess the "Game Capture" uses some windows-specific API to get access to the framebuffer of the application instead of the final window surface.

@mecwerks
Copy link
Contributor

@jansol Window transparency is not an option to enable in Love2D. setBackgroundColor supports an alpha input, and I set this to 0 in the code. However, it seems to not actually do anything on Linux. I can take a look and see if using ffi if I can enable window transparency in some way with SDL directly, but it does not currently seem like it is supported by the engine.

@jansol
Copy link
Author

jansol commented Feb 13, 2024

Looks like it'll require SDL3. Unfortunate. At least it seems to be on the radar: love2d/love#1968

It might be possible to do with the platform-specific native window handle but that's hardly worth the effort.

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

No branches or pull requests

2 participants