Zunesha

Shader de efeito slowmotion na tela ( embassado nos cantos e nítido no centro ) Godot 4+

Dec 17th, 2025
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
GDScript 1.45 KB | Gaming | 0 0
  1. //Shader de efeito slowmotion na tela ( embassado nos cantos e nítido no centro ) Godot 4+
  2.  
  3. shader_type canvas_item;
  4.  
  5. uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;
  6.  
  7. uniform float slow_intensity : hint_range(0.0, 1.0) = 0.0;
  8. uniform int blur_samples : hint_range(4, 32) = 12;
  9. uniform float blur_strength : hint_range(0.0, 0.02) = 0.008;
  10. uniform float desaturation_amount : hint_range(0.0, 1.0) = 0.6;
  11. uniform float vignette_strength : hint_range(0.0, 1.0) = 0.5;
  12.  
  13. void fragment() {
  14.     vec2 center = vec2(0.5, 0.5);
  15.     vec2 uv = SCREEN_UV;
  16.    
  17.     // Radial blur
  18.     vec4 color = texture(SCREEN_TEXTURE, uv);
  19.     vec2 to_center = uv - center;
  20.     float total_weight = 1.0;
  21.    
  22.     for (int i = 1; i < blur_samples; i++) {
  23.         float step_factor = float(i) / float(blur_samples);
  24.         vec2 offset = to_center * step_factor * blur_strength * slow_intensity;
  25.         vec4 sample_color = texture(SCREEN_TEXTURE, uv + offset);
  26.         color += sample_color;
  27.         total_weight += 1.0;
  28.     }
  29.    
  30.     color /= total_weight;
  31.    
  32.     // Desaturation
  33.     float luminance = dot(color.rgb, vec3(0.299, 0.587, 0.114));
  34.     color.rgb = mix(vec3(luminance), color.rgb, 1.0 - desaturation_amount * slow_intensity);
  35.    
  36.     // Vignette
  37.     float dist = length(to_center);
  38.     float vignette = smoothstep(0.4, 0.8, dist);
  39.     color.rgb *= 1.0 - vignette * vignette_strength * slow_intensity;
  40.    
  41.     COLOR = color;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment