mirror of
https://github.com/marinho/godot-visual-effects.git
synced 2024-12-22 14:37:27 +08:00
14 lines
515 B
Plaintext
14 lines
515 B
Plaintext
shader_type canvas_item;
|
|
|
|
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;
|
|
|
|
uniform vec4 colorDarkness : source_color = vec4(0.0, 0.0, 0.0, 1.0);
|
|
uniform vec4 colorLight : source_color = vec4(1.0, 1.0, 1.0, 1.0);
|
|
uniform float colorDivider : hint_range(0.0, 1.0) = .5;
|
|
|
|
void fragment() {
|
|
vec4 pixelColor = texture(SCREEN_TEXTURE, SCREEN_UV);
|
|
float grayscaleValue = dot(pixelColor.rgb, vec3(0.299, 0.587, 0.114));
|
|
COLOR = grayscaleValue < colorDivider ? colorDarkness : colorLight;
|
|
}
|