Browse Source

libobs: Add DrawAlphaBlend technique

Useful when fixed-function blend does not provide enough precision.
jpark37 4 years ago
parent
commit
de7cec3dee
1 changed files with 16 additions and 0 deletions
  1. 16 0
      libobs/data/default.effect

+ 16 - 0
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);
+	}
+}