You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having trouble trying to implement and get premultiplied alpha support up and working with this plugin, and I'm wondering if anyone can give me a little guidance
I have a camera in unity with a clear flag set to solid colour, and a solid colour set to 0,0,0,0
I am outputting this to a render texture and then trying to use klakspout to send that render texture to OBS where I would like the scene to render over a background I have setup there using premultiplied alpha transparency.
I have the reciever on OBS'es end set up to use premultiplied Alpha composite mode, and I've taken a look at the internal Klakspout blit.shader and am attempting to do the same here, but I seem to be stuck.
First thing's first I try setting
Blend One OneMinusSrcAlpha
just before Cull Off Zwrite... and I almost immediately notice this old school windows graphics stuck on screen effect, behind the latest pass of what I'm rendering.
I'm assuming something here is no longer "blanking" properly between frames so they're basically piling up and that is why this is happening.
I've noticed that the shader itself has 5 internal passes, and I think from what I can tell the first two? passes are for Sending, while it seems like the later passes are for receiving? There is what appears to be a draw pass which runs BlitSimple, and then a blanking pass of sorts which runs BlitClearAlpha.
I've tried setting BlitClearAlpha to return float4(0, 0, 0, 1); as I've heard in a couple places that for pre-multiplied alpha to work it is necessary to clear the render target with a black texture, but I get the feeling just doing this isn't quite what I want and I'm still getting that same, stuck GPU, uncleared rendered texture effect.
In messing with this I've also tried modifying the BlitSimple function to return
return float4(tex2D(_MainTex, texCoord).rgb, 1);
Where the 1 in the alpha channel seems to clear all alpha entirely (no longer stacking rendering passes but instead drawing all black where alphas should be), which I guess makes sense if I think about it, and I've also tried modifing it to just return
tex2D(_MainTex, texCoord);
Just leaving the alpha channel that is there in place as is, but that still results in the previously mentioned effect where frames are rendering on top of each other with no clearing in between them at all.
Is there something different I have to do to somehow clear previously rendered frames so that I can just get the currently rendered frame with pre-multiplied alpha transparency? Or I guess maybe an even better question to ask is, is any of this even on the right track to getting premultiplied alpha to work? If I am far off the mark, how would I go about actually implementing this?
The text was updated successfully, but these errors were encountered:
does the Test scene with alpha work for you? I had no issues with alpha with Spout and Spout2Capture obs plugin so far. maybe i misunderstand.
are you using HDRP/URP and Camera capture mode @PikaChokeMe ?
I'm having trouble trying to implement and get premultiplied alpha support up and working with this plugin, and I'm wondering if anyone can give me a little guidance
I have a camera in unity with a clear flag set to solid colour, and a solid colour set to 0,0,0,0
I am outputting this to a render texture and then trying to use klakspout to send that render texture to OBS where I would like the scene to render over a background I have setup there using premultiplied alpha transparency.
I have the reciever on OBS'es end set up to use premultiplied Alpha composite mode, and I've taken a look at the internal Klakspout blit.shader and am attempting to do the same here, but I seem to be stuck.
First thing's first I try setting
just before
Cull Off Zwrite...
and I almost immediately notice this old school windows graphics stuck on screen effect, behind the latest pass of what I'm rendering.I'm assuming something here is no longer "blanking" properly between frames so they're basically piling up and that is why this is happening.
I've noticed that the shader itself has 5 internal passes, and I think from what I can tell the first two? passes are for Sending, while it seems like the later passes are for receiving? There is what appears to be a draw pass which runs
BlitSimple
, and then a blanking pass of sorts which runsBlitClearAlpha
.I've tried setting BlitClearAlpha to
return float4(0, 0, 0, 1);
as I've heard in a couple places that for pre-multiplied alpha to work it is necessary to clear the render target with a black texture, but I get the feeling just doing this isn't quite what I want and I'm still getting that same, stuck GPU, uncleared rendered texture effect.In messing with this I've also tried modifying the BlitSimple function to return
Where the 1 in the alpha channel seems to clear all alpha entirely (no longer stacking rendering passes but instead drawing all black where alphas should be), which I guess makes sense if I think about it, and I've also tried modifing it to just return
Just leaving the alpha channel that is there in place as is, but that still results in the previously mentioned effect where frames are rendering on top of each other with no clearing in between them at all.
Is there something different I have to do to somehow clear previously rendered frames so that I can just get the currently rendered frame with pre-multiplied alpha transparency? Or I guess maybe an even better question to ask is, is any of this even on the right track to getting premultiplied alpha to work? If I am far off the mark, how would I go about actually implementing this?
The text was updated successfully, but these errors were encountered: