Advertisement
Miziziziz

film shader godot

Jun 8th, 2018
1,980
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. # conversion of this tutorial: http://fernandourquijo.com/index.php/2017/06/11/analyzing-and-emulating-limbo-style-shader/
  2. # to godot, with some of my own tweaks, be sure to get accompanying gd script: https://pastebin.com/uhBb2xCs
  3.  
  4. shader_type canvas_item;
  5. render_mode unshaded;
  6.  
  7. uniform float randx;
  8. uniform float randy;
  9. uniform float grain_scale : hint_range(0.0, 1.0);
  10. uniform sampler2D noise_tex;
  11. uniform sampler2D vignette_tex;
  12.  
  13.  
  14. void fragment()
  15. {
  16. vec4 col = texture(SCREEN_TEXTURE, SCREEN_UV);
  17. float lum = col.r * 0.299 + col.g * 0.587 + col.b * 0.114;
  18.  
  19. vec2 offset = vec2(randx,randy);
  20. vec4 noise = texture(noise_tex, mod(SCREEN_UV * grain_scale + offset, 1.0));
  21. vec4 v_fade = texture(vignette_tex, SCREEN_UV);
  22.  
  23. COLOR.rgb = vec3(lum, lum, lum) * noise.rgb * v_fade.rgb;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement