How to apply a filter (or shader) to the entire screen and post-process the entire window?
Cause I tried just creating a Canvas with a sprite but it does process the sprite but not the entire content behind
How to apply a filter (or shader) to the entire screen and post-process the entire window?
Cause I tried just creating a Canvas with a sprite but it does process the sprite but not the entire content behind
I would suggest using a ColorRect node or a TextureRect node, set the layout to full rect
, and then write a CanvasItem shader on top of that. You will want to use SCREEN_TEXTURE
and SCREEN_UV
instead of TEXTURE
and UV
though.
A super simple shader that makes the screen always have a red tint:
shader_type canvas_item
void fragment() {
vec3 screen_pixel = texture(SCREEN_TEXTURE, SCREEN_UV).rgb
screen_pixel.r = 1
COLOR = screen_pixel
}
shader_type canvas_item;
void fragment() { vec3 screen_pixel = texture(SCREEN_TEXTURE, SCREEN_UV).rgb; screen_pixel.r = 1; COLOR = screen_pixel; }
Error: invalid argment float or int at line (screen_pixel.r = 1;)
however I've tried with another simple shader algo but it doesnt produce any result, the TextureRectangle still remain transparent, invisible
@"K-Storm-Studio Ltd" said: shader_type canvas_item;
void fragment() { vec3 screen_pixel = texture(SCREEN_TEXTURE, SCREEN_UV).rgb; screen_pixel.r = 1; COLOR = screen_pixel; }
Error: invalid argment float or int at line (screen_pixel.r = 1;)
Try changing screen_pixel.r = 1;
to screen_pixel.r = 1.0;
and that should fix the error about the invalid argument (I think).