From de7cec3dee2c3609fe257112cb681f5337b33221 Mon Sep 17 00:00:00 2001 From: jpark37 Date: Tue, 4 May 2021 18:29:36 -0700 Subject: [PATCH] libobs: Add DrawAlphaBlend technique Useful when fixed-function blend does not provide enough precision. --- libobs/data/default.effect | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libobs/data/default.effect b/libobs/data/default.effect index 0d754e1fd..60eb609cf 100644 --- a/libobs/data/default.effect +++ b/libobs/data/default.effect @@ -62,6 +62,13 @@ float4 PSDrawNonlinearAlpha(VertInOut vert_in) : TARGET return rgba; } +float4 PSDrawAlphaBlend(VertInOut vert_in) : TARGET +{ + float4 rgba = image.Sample(def_sampler, vert_in.uv); + rgba.rgb *= rgba.a; + return rgba; +} + technique Draw { pass @@ -88,3 +95,12 @@ technique DrawNonlinearAlpha pixel_shader = PSDrawNonlinearAlpha(vert_in); } } + +technique DrawAlphaBlend +{ + pass + { + vertex_shader = VSDefault(vert_in); + pixel_shader = PSDrawAlphaBlend(vert_in); + } +}