Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Shader de efeito slowmotion na tela ( embassado nos cantos e nítido no centro ) Godot 4+
- shader_type canvas_item;
- uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;
- uniform float slow_intensity : hint_range(0.0, 1.0) = 0.0;
- uniform int blur_samples : hint_range(4, 32) = 12;
- uniform float blur_strength : hint_range(0.0, 0.02) = 0.008;
- uniform float desaturation_amount : hint_range(0.0, 1.0) = 0.6;
- uniform float vignette_strength : hint_range(0.0, 1.0) = 0.5;
- void fragment() {
- vec2 center = vec2(0.5, 0.5);
- vec2 uv = SCREEN_UV;
- // Radial blur
- vec4 color = texture(SCREEN_TEXTURE, uv);
- vec2 to_center = uv - center;
- float total_weight = 1.0;
- for (int i = 1; i < blur_samples; i++) {
- float step_factor = float(i) / float(blur_samples);
- vec2 offset = to_center * step_factor * blur_strength * slow_intensity;
- vec4 sample_color = texture(SCREEN_TEXTURE, uv + offset);
- color += sample_color;
- total_weight += 1.0;
- }
- color /= total_weight;
- // Desaturation
- float luminance = dot(color.rgb, vec3(0.299, 0.587, 0.114));
- color.rgb = mix(vec3(luminance), color.rgb, 1.0 - desaturation_amount * slow_intensity);
- // Vignette
- float dist = length(to_center);
- float vignette = smoothstep(0.4, 0.8, dist);
- color.rgb *= 1.0 - vignette * vignette_strength * slow_intensity;
- COLOR = color;
- }
Advertisement
Add Comment
Please, Sign In to add comment