0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 13:08:50 +02:00
obs-studio/plugins/obs-transitions
James Park ba21fb947e libobs: Fix various alpha issues
There are cases where alpha is multiplied unnecessarily. This change
attempts to use premultiplied alpha blending for composition.

To keep this change simple, The filter chain will continue to use
straight alpha. Otherwise, every source would need to modified to output
premultiplied, and every filter modified for premultiplied input.

"DrawAlphaDivide" shader techniques have been added to convert from
premultiplied alpha to straight alpha for final output. "DrawMatrix"
techniques ignore alpha, so they do not appear to need changing.

One remaining issue is that scale effects are set up here to use the
same shader logic for both scale filters (straight alpha - incorrectly),
and output composition (premultiplied alpha - correctly). A fix could be
made to add additional shaders for straight alpha, but the "real" fix
may be to eliminate the straight alpha path at some point.

For graphics, SrcBlendAlpha and DestBlendAlpha were both ONE, and could
combine together to form alpha values greater than one. This is not as
noticeable of a problem for UNORM targets because the channels are
clamped, but it will likely become a problem in more situations if FLOAT
targets are used.

This change switches DestBlendAlpha to INVSRCALPHA. The blending
behavior of stacked transparents is preserved without overflowing the
alpha channel.

obs-transitions: Use premultiplied alpha blend, and simplify shaders
because both inputs and outputs use premultiplied alpha now.

Fixes https://obsproject.com/mantis/view.php?id=1108
2019-05-08 20:26:52 -07:00
..
data libobs: Fix various alpha issues 2019-05-08 20:26:52 -07:00
CMakeLists.txt obs-transitions: Add stinger transition 2017-07-19 16:23:06 -07:00
easings.h obs-transitions: Add 'slide' transition 2016-03-24 02:19:16 -07:00
obs-transitions.c Plugins: Add descriptions to modules 2018-09-11 18:28:58 -07:00
transition-cut.c obs-transitions: Mark functions as static 2016-02-21 12:11:09 -08:00
transition-fade-to-color.c obs-transitions: Add 'Fade to Color' transition 2016-03-24 16:23:29 -07:00
transition-fade.c obs-transitions: Mark functions as static 2016-02-21 12:11:09 -08:00
transition-luma-wipe.c obs-transitions: Add 'Luma Wipe' transition 2016-07-20 07:05:27 -07:00
transition-slide.c obs-transitions: Add 'slide' transition 2016-03-24 02:19:16 -07:00
transition-stinger.c obs-transitions: Fix potential stinger divide by 0 2018-06-11 19:34:07 -07:00
transition-swipe.c obs-transitions: Add 'slide' transition 2016-03-24 02:19:16 -07:00