Window Capture Transparency (no color-key)

dacoder

Member
Color-key (chroma-key) works great when the object is to just remove certain colors from a scene. But for accurately using overlays, alpha channels need to exist in the produced image. While coding with Java, I found that transparent windows (with images painted on them e.g. a splash screen) would show up black!

My suggestion: if possible, allow window capturing with alpha in it. So that people can window capture something with transparency, without having to use color-key to color it out. I am unaware of how window capture works, if it is just a sub-region on the screen dictated by frame sizes, or actually grabbing the content of a frame from it.

My interest in this subject is because: my program would be x10 better if the user could just signify an image (with alpha) and have that drawn to my window frame, and have the window frame's background be transparent. Then all they have to do is use OBS to capture the window and its alpha. Also: color-key is NOT a viable option here, since I have a fade-in / fade-out effect, and dropshadows in images etc. With color-key the produced image is either full alpha or none.

And why do transparent windows get captured as black screens?

If the dev's want: I can supply a quick demonstration application, consisting of a JFrame that is transparent with an alpha image painted to it. This would allow you to see first-hand what is causing the black screen, or even testing the implementation.
 

dacoder

Member
HomeWorld said:
Did you tried enabling "Capture Layered Windows" in the window/monitor capture settings?

This did not fix the issue. Alpha is still not being captured. This just captures all windows above it apparently.
 

dacoder

Member
HomeWorld said:
If I got it right, there's no way to do that. (not obs fault but a windows limitation)

Oh man, I wonder how I can get this working then... can color-key change dynamically, such as I can send OBS color ints, and have it set the color-key to that? Can there be some way of setting colors that are similar (e.g. darker red vs red) to have a different alpha value? As I understand OBS's color-key it is either full alpha, or none.

I need my application to support fading, maybe I could interact with OBS specifically? Like send it an image at every frame update? Could be feasible...
 

dodgepong

Administrator
Community Helper
The OBS rewrite will support applying shaders to sources, so if a source is opaque, I believe you will be able to apply alpha transparency to it in OBS, for what that's worth. I know that doesn't help the capture of translucent windows itself, but it's something.
 

dacoder

Member
dodgepong said:
The OBS rewrite will support applying shaders to sources, so if a source is opaque, I believe you will be able to apply alpha transparency to it in OBS, for what that's worth. I know that doesn't help the capture of translucent windows itself, but it's something.

So, can you capture transparency from Game Capture?
 

dodgepong

Administrator
Community Helper
I'm not sure what you mean by "capture transparency" with regard to game capture, but you will be able to make the game capture itself transparent.
 

dacoder

Member
dodgepong said:
I'm not sure what you mean by "capture transparency" with regard to game capture, but you will be able to make the game capture itself transparent.

Lets say this: OpenGL's background color (the no object color) is set to green. And I have a green object in the foreground, it is drawn center frame. If I capture the game, only the green object should show, because the green background should be interpolated in OBS as alpha. (of course that should just be an option, not always on)

You cannot use color-key in this instance, because lets say that box in the center is now a different color (red). This of course would work great with color-key, but what if it has a drop-shadow? Then how do you take that slightly darker green, and change it to slightly darker alpha? You can get this pretty close with good color-key settings, such as fiddling with similarity or blending. But this is something that is very hard to setup, especially for a user who doesn't even know what color-key is...

I do not know if this is possible, but it would be nice to have.
 

dodgepong

Administrator
Community Helper
No, that's not possible.

But I'm going to take a stab in the dark at what I think you actually want: graphical overlays with alpha transparency. This is typically accomplished by means of a system called key + fill. You have 2 sources: a "fill", or color channel, which is basically your graphic that you want overlaid, and a "key", or alpha channel, which is basically a grayscale graphic where the black parts are transparent, the white parts are opaque, and the gray parts represent different levels of translucency. This image is a bit small and hard to see, but you can kind of make out what it does.

The OBS rewrite will support key + fill.
 

dacoder

Member
dodgepong said:
No, that's not possible.

But I'm going to take a stab in the dark at what I think you actually want: graphical overlays with alpha transparency. This is typically accomplished by means of a system called key + fill. You have 2 sources: a "fill", or color channel, which is basically your graphic that you want overlaid, and a "key", or alpha channel, which is basically a grayscale graphic where the black parts are transparent, the white parts are opaque, and the gray parts represent different levels of translucency. This image is a bit small and hard to see, but you can kind of make out what it does.

The OBS rewrite will support key + fill.

Ah I have heard of this technique before, that sounds do-able.
So my only request for that feature is this: allow two window (or game) captures, one for the key, and one for the filter. I can easily support that, by having two windows open (the greyscale one not visible) and have the user grab both frames.
 
Top