Guest User

dead pixel shader godot

a guest
May 7th, 2024
750
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 1 0
  1. shader_type canvas_item;
  2.  
  3. uniform float dead_screen_percent : hint_range(0.0, 1.0);
  4. uniform sampler2D dead_pixel_colors : hint_default_white;
  5. uniform sampler2D noise: hint_default_white;
  6.  
  7. uniform vec2 resolution = vec2(640, 480);
  8.  
  9. void fragment() {
  10. vec2 st = UV;
  11. st = round(st * resolution) / resolution;
  12. vec2 rnd_noise = texture(noise, st).xy;
  13.  
  14. vec4 col = texture(dead_pixel_colors,vec2(rnd_noise.x, 0.0));
  15. float alpha = step(1.0-dead_screen_percent, rnd_noise.y);
  16. col.a = alpha;
  17.  
  18. COLOR = col;
  19. }
  20.  
  21.  
Advertisement
Add Comment
Please, Sign In to add comment