1
- // based on https://www.shadertoy.com/view/Ms3XWH
1
+ // based on https://www.shadertoy.com/view/Ms3XWH converted by Exeldro v 1.0
2
+ // updated by Charles 'Surn' Fettinger for obs-shaderfilter 9/2020
3
+ // Converted to OpenGL by Exeldro February 19, 2022
2
4
uniform float range = 0.05 ;
3
5
uniform float noiseQuality = 250.0 ;
4
6
uniform float noiseIntensity = 0.88 ;
5
7
uniform float offsetIntensity = 0.02 ;
6
8
uniform float colorOffsetIntensity = 1.3 ;
9
+ uniform float lumaMin = 0.01 ;
10
+ uniform float lumaMinSmooth = 0.04 ;
11
+ uniform float Alpha_Percentage = 100 ; // <Range(0.0,100.0)>
12
+ uniform bool Apply_To_Image;
13
+ uniform bool Replace_Image_Color;
14
+ uniform float4 Color_To_Replace;
15
+ uniform bool Apply_To_Specific_Color;
16
+
17
+ float dot (float2 a,float2 b){
18
+ return a.x* b.x+ a.y* b.y;
19
+ }
7
20
8
21
float rand(float2 co)
9
22
{
@@ -20,12 +33,21 @@ float verticalBar(float pos, float uvY, float offset)
20
33
return x;
21
34
}
22
35
36
+ float modu(float x, float y)
37
+ {
38
+ return (x / y) - floor (x / y);
39
+ }
40
+
41
+ float dot (float4 a,float4 b){
42
+ return a.r* b.r+ a.g* b.g+ a.b* b.b+ a.a* b.a;
43
+ }
44
+
23
45
float4 mainImage(VertData v_in) : TARGET
24
46
{
25
47
float2 uv = v_in.uv;
26
48
for (float i = 0.0 ; i < 0.71 ; i += 0.1313 )
27
49
{
28
- float d = (elapsed_time * i) % 1.7 ;
50
+ float d = modu (elapsed_time * i, 1.7 ) ;
29
51
float o = sin (1.0 - tan (elapsed_time * 0.24 * i));
30
52
o *= offsetIntensity;
31
53
uv.x += verticalBar(d, uv.y, o);
@@ -43,6 +65,27 @@ float4 mainImage(VertData v_in) : TARGET
43
65
float g = image.Sample(textureSampler, uv + offsetG).g;
44
66
float b = image.Sample(textureSampler, uv).b;
45
67
46
- float4 output = float4(r, g, b, 1.0 );
47
- return output;
68
+ float4 rgba = float4(r, g, b, 1.0 );
69
+
70
+ float4 color;
71
+ float4 original_color;
72
+ if (Apply_To_Image)
73
+ {
74
+ color = image.Sample(textureSampler, v_in.uv);
75
+ original_color = color;
76
+ float luma = dot (color, float4(0.30 , 0.59 , 0.11 , 1.0 ));
77
+ if (Replace_Image_Color)
78
+ color = float4(luma,luma,luma,luma);
79
+ rgba = lerp(original_color, rgba * color, clamp (Alpha_Percentage * .01 , 0 , 1.0 ));
80
+
81
+ }
82
+ if (Apply_To_Specific_Color)
83
+ {
84
+ color = image.Sample(textureSampler, v_in.uv);
85
+ original_color = color;
86
+ color = (distance (color.rgb, Color_To_Replace.rgb) <= 0.075 ) ? rgba : color;
87
+ rgba = lerp(original_color, color, clamp (Alpha_Percentage * .01 , 0 , 1.0 ));
88
+ }
89
+
90
+ return rgba;
48
91
}
0 commit comments