shader_type canvas_item; // Full-screen nausea desaturation. // Samples the screen, converts to luminance, and blends back toward grayscale // based on the `desaturation` uniform (0 = full color, 1 = full grayscale). uniform sampler2D screen_tex : hint_screen_texture, filter_linear_mipmap; uniform float desaturation : hint_range(0.0, 1.0) = 0.0; // Rec. 709 luma weights. const vec3 LUMA = vec3(0.2126, 0.7152, 0.0722); void fragment() { vec3 col = texture(screen_tex, SCREEN_UV).rgb; float gray = dot(col, LUMA); vec3 result = mix(col, vec3(gray), clamp(desaturation, 0.0, 1.0)); COLOR = vec4(result, 1.0); }