However, it is causing a problem (both here, and in my plugins) where for alpha values of zero, the RGB values must be zero as well, otherwise the output alpha channel is incorrect. For example, given a very simple shader:
This should render a red ellipse in the center of the source, with transparent alpha outside of the circle. In earlier versions of shaderfilter this is exactly what happens:
However in the new version, the pixels outside of the ellipse are rendered with a very high (nearly 1.0) alpha:
If we alter the shader slightly to ensure that all pixels outside of the ellipse have their RGB values set to (0.0, 0.0, 0.0) things render as they should:
Shaderfilter rendering was recently change to use
obs_source_process_filter_begin_with_color_space
when rendering the output rather thanobs_source_process_filter_begin
( https://github.com/exeldro/obs-shaderfilter/blob/618008b688f6a4004eda35164a063ae235cf8a21/obs-shaderfilter.c#L1164 ). This was likely done to fix some color blending issues when alpha is neither zero nor one.However, it is causing a problem (both here, and in my plugins) where for alpha values of zero, the RGB values must be zero as well, otherwise the output alpha channel is incorrect. For example, given a very simple shader:
This should render a red ellipse in the center of the source, with transparent alpha outside of the circle. In earlier versions of shaderfilter this is exactly what happens:![image](https://github.com/exeldro/obs-shaderfilter/assets/72580859/5abcbd91-2634-43a6-935e-4dd7fe9f144b)
However in the new version, the pixels outside of the ellipse are rendered with a very high (nearly 1.0) alpha:![image](https://github.com/exeldro/obs-shaderfilter/assets/72580859/809962e9-c881-4b6d-8e9d-5e7cbf6cd7e2)
If we alter the shader slightly to ensure that all pixels outside of the ellipse have their RGB values set to![image](https://github.com/exeldro/obs-shaderfilter/assets/72580859/7eb90dc1-b7d6-4936-b11b-009cc570252e)
(0.0, 0.0, 0.0)
things render as they should:I suspect the reason is that both the alpha, and the magnitude of the RGB values are being used for the output channel. Perhaps it has something to do with the blend functions set here? https://github.com/exeldro/obs-shaderfilter/blob/618008b688f6a4004eda35164a063ae235cf8a21/obs-shaderfilter.c#L1173