🔧 Fix straight alpha

This commit is contained in:
Simon Schneegans
2022-05-08 20:49:29 +02:00
parent fa8e3a17c1
commit 78679ef139
8 changed files with 33 additions and 25 deletions
+5 -1
View File
@@ -238,25 +238,29 @@ if (utils.isInShellProcess()) {
vec4 windowColor = texture2D(uTexture, cogl_tex_coord_in[0].st);
// Dissolve window to effect color / transparency.
cogl_color_out = mix(vec4(uColor, 1.0) * windowColor.a, windowColor, 0.5 * masks.w + 0.5) * masks.w;
cogl_color_out.rgb = mix(uColor, windowColor.rgb, 0.5 * masks.w + 0.5);
cogl_color_out.a = windowColor.a * masks.w;
// Add leading shower particles.
vec2 showerUV = cogl_tex_coord_in[0].st + vec2(0, -0.7*uProgress/SHOWER_TIME);
showerUV *= 0.02 * vec2(uSizeX, uSizeY) / uScale;
float shower = pow(simplex2D(showerUV), 10.0);
cogl_color_out.rgb += uColor * shower * masks.x;
cogl_color_out.a += shower * masks.x;
// Add trailing streak lines.
vec2 streakUV = cogl_tex_coord_in[0].st + vec2(0, -uProgress/SHOWER_TIME);
streakUV *= vec2(0.05 * uSizeX, 0.001 * uSizeY) / uScale;
float streaks = simplex2DFractal(streakUV) * 0.5;
cogl_color_out.rgb += uColor * streaks * masks.y;
cogl_color_out.a += streaks * masks.y;
// Add glimmering atoms.
vec2 atomUV = cogl_tex_coord_in[0].st + vec2(0, -0.025*uProgress/SHOWER_TIME);
atomUV *= 0.2 * vec2(uSizeX, uSizeY) / uScale;
float atoms = pow((simplex3D(vec3(atomUV, uTime))), 5.0);
cogl_color_out.rgb += uColor * atoms * masks.z;
cogl_color_out.a += atoms * masks.z;
// These are pretty useful for understanding how this works.
// cogl_color_out = vec4(masks.rgb, 1.0);