• J
    libobs: Fix various alpha issues · ba21fb94
    James Park 提交于
    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
    ba21fb94
lanczos_scale.effect 4.9 KB