Created
May 3, 2021 09:53
-
-
Save martinlaxenaire/90f1edabc0c92fe92b26d6bc9fb192a6 to your computer and use it in GitHub Desktop.
Mixing two vec4 textures based on alpha in GLSL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// mix foreground and background based on foreground alpha value | |
vec4 finalColor; | |
finalColor.rgb = foreground.rgb + (background.rgb * (1.0 - foreground.a)); | |
finalColor.a = foreground.a + (background.a * (1.0 - foreground.a)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment