Created
January 8, 2021 12:45
-
-
Save deakcor/e2c96a404550b7f022281780dd6342ce to your computer and use it in GitHub Desktop.
Color replacement shader for Godot Engine
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
/** | |
* Replace a color by another one. | |
* License: CC0 | |
* https://creativecommons.org/publicdomain/zero/1.0/ | |
*/ | |
shader_type canvas_item; | |
uniform vec4 remove_color: hint_color; | |
uniform vec4 replace_color: hint_color; | |
void fragment(){ | |
vec4 col = texture(TEXTURE, UV); | |
if (col.rgb == remove_color.rgb){ | |
col = replace_color; | |
} | |
COLOR = col; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example with green color replaced by transparent one.