🔧 Fix straight alpha

This commit is contained in:
Simon Schneegans
2022-05-08 14:15:43 +02:00
parent 6555a8f02c
commit 88a56998d6
2 changed files with 7 additions and 5 deletions
+1 -1
View File
@@ -264,7 +264,7 @@ if (utils.isInShellProcess()) {
if (tileProgress > hex.z) { if (tileProgress > hex.z) {
// Crop outer parts of the shrinking tiles. // Crop outer parts of the shrinking tiles.
cogl_color_out *= vec4(0.0); cogl_color_out.a = 0.0;
} else { } else {
+6 -4
View File
@@ -196,6 +196,7 @@ if (utils.isInShellProcess()) {
// Inject some common shader snippets. // Inject some common shader snippets.
${shaderSnippets.standardUniforms()} ${shaderSnippets.standardUniforms()}
${shaderSnippets.noise()} ${shaderSnippets.noise()}
${shaderSnippets.compositing()}
// See assets/README.md for how this texture was created. // See assets/README.md for how this texture was created.
uniform bool uForOpening; uniform bool uForOpening;
@@ -279,17 +280,18 @@ if (utils.isInShellProcess()) {
} }
// Hide flashes where there is now window. // Hide flashes where there is now window.
flashIntensity *= cogl_color_out.a; vec4 flash = uFlashColor;
flash.a *= flashIntensity * cogl_color_out.a * (1.0 - progress);
// Hide scratched out parts. // Hide scratched out parts.
cogl_color_out *= (scratchMap > progress ? 1 : 0); cogl_color_out.a *= (scratchMap > progress ? 1 : 0);
// Add flash color. // Add flash color.
cogl_color_out.rgb += flashIntensity * mix(uFlashColor.rgb * uFlashColor.a, vec3(0), progress); cogl_color_out = blendOver(flash, cogl_color_out);
// Fade out the remaining shards. // Fade out the remaining shards.
float fadeProgress = smoothstep(0, 1, (progress - 1.0 + FF_TIME)/FF_TIME); float fadeProgress = smoothstep(0, 1, (progress - 1.0 + FF_TIME)/FF_TIME);
cogl_color_out *= sqrt(1-fadeProgress*fadeProgress); cogl_color_out.a *= sqrt(1-fadeProgress*fadeProgress);
// These are pretty useful for understanding how this works. // These are pretty useful for understanding how this works.
// cogl_color_out = vec4(vec3(flashIntensity), 1); // cogl_color_out = vec4(vec3(flashIntensity), 1);