shader_type canvas_item; uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_nearest; uniform float brightness : hint_range(0.0, 2.0) = 1.0; uniform float contrast : hint_range(0.0, 2.0) = 1.0; uniform float saturation : hint_range(0.0, 2.0) = 1.0; void fragment() { // 1. Get the screen color vec4 tex_color = textureLod(screen_texture, SCREEN_UV, 0.0); vec3 color = tex_color.rgb; // 2. Adjust Brightness // Simply multiply by the brightness factor color *= brightness; // 3. Adjust Contrast // Interpolate between a neutral gray (0.5) and the current color color = mix(vec3(0.5), color, contrast); // 4. Adjust Saturation // Calculate grayscale (luminance) using standard weights float luminance = dot(color, vec3(0.2126, 0.7152, 0.0722)); vec3 grayscale = vec3(luminance); // Interpolate between grayscale and color color = mix(grayscale, color, saturation); COLOR = vec4(color, tex_color.a); }