19 lines
616 B
Plaintext
19 lines
616 B
Plaintext
shader_type canvas_item;
|
|
|
|
// É necessário declarar a textura da tela como um uniform no Godot 4
|
|
uniform sampler2D screen_texture : hint_screen_texture, filter_linear_mipmap;
|
|
|
|
void vertex() {
|
|
// Chamado para cada vértice em que o material está visível.
|
|
}
|
|
|
|
void fragment() {
|
|
// Pegamos a cor da tela usando a textura declarada e a coordenada SCREEN_UV
|
|
vec4 color = texture(screen_texture, SCREEN_UV);
|
|
|
|
// Correção dos parênteses para calcular a média (Preto e Branco)
|
|
float grey = (color.r + color.g + color.b) / 3.0;
|
|
|
|
// Atribuímos o resultado ao COLOR do pixel
|
|
COLOR = vec4(vec3(grey), color.a);
|
|
} |