only a shader for darknwess, use in a colorRect
shader_type canvas_item;
uniform sampler2D screen_texture : hint_screen_texture, filter_linear_mipmap;
group_uniforms Atmosphere;
uniform float darkness : hint_range(0.0, 1.0) = 0.4;
uniform float contrast : hint_range(0.5, 1.5) = 1.1;
uniform float saturation : hint_range(0.0, 1.0) = 0.5;
group_uniforms Night_Tint;
uniform vec3 shadow_tint : source_color = vec3(0.4, 0.55, 0.9);
uniform float tint_strength : hint_range(0.0, 1.0) = 0.4;
group_uniforms Vignette;
uniform float vignette_intensity : hint_range(0.0, 2.0) = 0.6;
uniform float vignette_softness : hint_range(0.0, 1.0) = 0.5;
const vec3 LUMA_COEFFS = vec3(0.2126, 0.7152, 0.0722);
void fragment() {
vec4 screen = texture(screen_texture, SCREEN_UV);
float lum = dot(screen.rgb, LUMA_COEFFS);
vec3 color = (screen.rgb - 0.5) * contrast + 0.5;
color *= (1.0 - darkness);
float tint_factor = (1.0 - lum) * tint_strength;
color = mix(color, color * shadow_tint, tint_factor);
float gray = dot(color, LUMA_COEFFS);
color = mix(vec3(gray), color, saturation);
vec2 uv = SCREEN_UV - 0.5;
float dist = length(uv);
float vignette = 1.0 - smoothstep(
1.0 - vignette_softness,
1.5 - vignette_softness + (1.0 / vignette_intensity),
dist * vignette_intensity * 3.0
);
color *= vignette;
COLOR = vec4(color, screen.a);
}
Join the discussion! Log in to share your thoughts.
Log In to Comment