Last active
August 28, 2024 23:08
-
-
Save erdavids/3cc909f68adb8e8b6589158e30819eff to your computer and use it in GitHub Desktop.
This file contains hidden or 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
shader_type canvas_item; | |
uniform vec4 color_1 = vec4(.0, .0, .0, 1.0); | |
uniform vec4 color_2 = vec4(0.5, 0.5, 0.5, 1.0); | |
void fragment() { | |
vec4 colors[2] = {color_1, color_2}; | |
float min_diff = -1.0; | |
vec4 min_color = vec4(0.0, 0.0, 0.0, 1.0); | |
vec2 uv = SCREEN_UV; | |
vec4 temp = textureLod(SCREEN_TEXTURE, uv, 0.0); | |
min_diff = 1000.0; | |
for (int i = 0; i < colors.length(); i++) { | |
float curr_dist = distance(colors[i], temp); | |
if (curr_dist < min_diff) { | |
min_diff = curr_dist; | |
min_color = colors[i]; | |
} | |
} | |
COLOR.rgb = min_color.rgb; | |
} |
Apologies for that, my VPS was down. Should be available again now.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@benergize the download link to your program is broken, would you mind re-uploading it?