🎉 Add support for alpha channel in color of TV Effect, TV Glitch, and Glitch
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
|
||||
// The content from common.glsl is automatically prepended to each shader effect.
|
||||
|
||||
uniform vec3 uColor;
|
||||
uniform vec4 uColor;
|
||||
uniform float uSeed;
|
||||
uniform float uScale;
|
||||
uniform float uStrength;
|
||||
@@ -37,18 +37,18 @@ void main() {
|
||||
vec4 oColor = getInputColor(vec2(xPos, iTexCoord.y));
|
||||
|
||||
// Mix in some random interference lines.
|
||||
vec3 interference = uColor * hash12(vec2(yPos * time));
|
||||
vec3 interference = uColor.rgb * hash12(vec2(yPos * time));
|
||||
float interferenceStrength = noise * min(strength, 1.0);
|
||||
oColor.rgb = mix(oColor.rgb, interference, interferenceStrength);
|
||||
oColor.rgb = mix(oColor.rgb, interference, uColor.a * interferenceStrength);
|
||||
|
||||
// Mix in some grainy noise.
|
||||
vec3 grain = uColor * simplex2D(uSize * iTexCoord + vec2(time * 100.0));
|
||||
vec3 grain = uColor.rgb * simplex2D(uSize * iTexCoord + vec2(time * 100.0));
|
||||
float grainStrength = 0.2 * min(strength, 1.0);
|
||||
oColor.rgb = mix(oColor.rgb, grain, grainStrength);
|
||||
oColor.rgb = mix(oColor.rgb, grain, uColor.a * grainStrength);
|
||||
|
||||
// Add a subtle line pattern every 4 pixels.
|
||||
if (floor(mod(yPos * 0.25, 2.0)) == 0.0) {
|
||||
oColor.rgb = mix(uColor, oColor.rgb, 1.0 - (0.15 * noise));
|
||||
oColor.rgb = mix(oColor.rgb, uColor.rgb, uColor.a * (0.15 * noise));
|
||||
}
|
||||
|
||||
// Shift green/blue channels.
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
// The content from common.glsl is automatically prepended to each shader effect.
|
||||
|
||||
uniform vec3 uColor;
|
||||
uniform vec4 uColor;
|
||||
uniform float uSeed;
|
||||
uniform float uScale;
|
||||
uniform float uStrength;
|
||||
@@ -57,18 +57,18 @@ void main() {
|
||||
vec4 oColor = getInputColor(vec2(xPos, coords.y));
|
||||
|
||||
// Mix in some random interference lines.
|
||||
vec3 interference = uColor * hash12(vec2(yPos * time));
|
||||
vec3 interference = uColor.rgb * hash12(vec2(yPos * time));
|
||||
float interferenceStrength = noise * min(strength, 1.0);
|
||||
oColor.rgb = mix(oColor.rgb, interference, interferenceStrength);
|
||||
oColor.rgb = mix(oColor.rgb, interference, uColor.a * interferenceStrength);
|
||||
|
||||
// Mix in some grainy noise.
|
||||
vec3 grain = uColor * simplex2D(uSize * coords + vec2(time * 100.0));
|
||||
vec3 grain = uColor.rgb * simplex2D(uSize * coords + vec2(time * 100.0));
|
||||
float grainStrength = 0.2 * min(strength, 1.0);
|
||||
oColor.rgb = mix(oColor.rgb, grain, grainStrength);
|
||||
oColor.rgb = mix(oColor.rgb, grain, uColor.a * grainStrength);
|
||||
|
||||
// Add a subtle line pattern every 4 pixels.
|
||||
if (floor(mod(yPos * 0.25, 2.0)) == 0.0) {
|
||||
oColor.rgb = mix(uColor, oColor.rgb, 1.0 - (0.15 * noise));
|
||||
oColor.rgb = mix(oColor.rgb, uColor.rgb, uColor.a * (0.15 * noise));
|
||||
}
|
||||
|
||||
// Shift green/blue channels.
|
||||
@@ -101,7 +101,8 @@ void main() {
|
||||
float ffMask = 1.0 - smoothstep(0.0, 1.0, ffProg);
|
||||
|
||||
// Assemble the final color value.
|
||||
oColor.rgb = mix(oColor.rgb, uColor * oColor.a, smoothstep(0.0, 1.0, tvProgress));
|
||||
oColor.rgb =
|
||||
mix(oColor.rgb, uColor.rgb * oColor.a, uColor.a * smoothstep(0.0, 1.0, tvProgress));
|
||||
float mask = tbMask * lrMask * ffMask;
|
||||
|
||||
oColor.a *= mask;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
// The content from common.glsl is automatically prepended to each shader effect.
|
||||
|
||||
uniform vec3 uColor;
|
||||
uniform vec4 uColor;
|
||||
|
||||
const float BLUR_WIDTH = 0.01; // Width of the gradients.
|
||||
const float TB_TIME = 0.7; // Relative time for the top/bottom animation.
|
||||
@@ -56,7 +56,8 @@ void main() {
|
||||
float mask = tbMask * lrMask * ffMask;
|
||||
|
||||
vec4 oColor = getInputColor(coords);
|
||||
oColor.rgb = mix(oColor.rgb, uColor * oColor.a, smoothstep(0.0, 1.0, prog));
|
||||
oColor.rgb =
|
||||
mix(oColor.rgb, uColor.rgb * oColor.a, uColor.a * smoothstep(0.0, 1.0, prog));
|
||||
oColor.a *= mask;
|
||||
|
||||
// These are pretty useful for understanding how this works.
|
||||
|
||||
@@ -149,7 +149,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
<object class="GtkColorButton" id="glitch-color">
|
||||
<property name="valign">center</property>
|
||||
<property name="width-request">250</property>
|
||||
<property name="use_alpha">0</property>
|
||||
<property name="use_alpha">1</property>
|
||||
<property name="show_editor">1</property>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -48,7 +48,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
<property name="activatable-widget">tv-effect-color</property>
|
||||
<child>
|
||||
<object class="GtkColorButton" id="tv-effect-color">
|
||||
<property name="use_alpha">0</property>
|
||||
<property name="use_alpha">1</property>
|
||||
<property name="show_editor">1</property>
|
||||
<property name="width-request">250</property>
|
||||
<property name="valign">center</property>
|
||||
|
||||
@@ -149,7 +149,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
<object class="GtkColorButton" id="tv-glitch-color">
|
||||
<property name="valign">center</property>
|
||||
<property name="width-request">250</property>
|
||||
<property name="use_alpha">0</property>
|
||||
<property name="use_alpha">1</property>
|
||||
<property name="show_editor">1</property>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -263,7 +263,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkColorButton" id="glitch-color">
|
||||
<property name="use_alpha">0</property>
|
||||
<property name="use_alpha">1</property>
|
||||
<property name="show_editor">1</property>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -95,7 +95,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkColorButton" id="tv-effect-color">
|
||||
<property name="use_alpha">0</property>
|
||||
<property name="use_alpha">1</property>
|
||||
<property name="show_editor">1</property>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -263,7 +263,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkColorButton" id="tv-glitch-color">
|
||||
<property name="use_alpha">0</property>
|
||||
<property name="use_alpha">1</property>
|
||||
<property name="show_editor">1</property>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -220,7 +220,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkColorButton" id="glitch-color">
|
||||
<property name="use_alpha">0</property>
|
||||
<property name="use_alpha">1</property>
|
||||
<property name="show_editor">1</property>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -82,7 +82,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkColorButton" id="tv-effect-color">
|
||||
<property name="use_alpha">0</property>
|
||||
<property name="use_alpha">1</property>
|
||||
<property name="show_editor">1</property>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -220,7 +220,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkColorButton" id="tv-glitch-color">
|
||||
<property name="use_alpha">0</property>
|
||||
<property name="use_alpha">1</property>
|
||||
<property name="show_editor">1</property>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
Reference in New Issue
Block a user