Advertisement
Zunesha

Shaders Interessantes aplicados em TextureRect contendo texuras em branco Godot 4

Nov 14th, 2023 (edited)
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shaders Interessantes aplicados em TextureRect contendo texuras em branco Godot 4 ~>
  2.  
  3. ################################################## 1- BLUR ##################################################
  4. shader_type canvas_item;
  5.  
  6. uniform float amount : hint_range(0.0, 5.0);
  7. uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;
  8.  
  9. void fragment() {
  10.     COLOR = textureLod(SCREEN_TEXTURE, SCREEN_UV, amount);
  11. }
  12. ################################################ 2- Pixelize #################################################
  13. shader_type canvas_item;
  14.  
  15. uniform float size_x = 0.008;
  16. uniform float size_y = 0.008;
  17. uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;
  18. void fragment() {
  19.     vec2 uv = SCREEN_UV;
  20.     uv -= mod(uv, vec2(size_x, size_y));
  21.  
  22.     COLOR.rgb = textureLod(SCREEN_TEXTURE, uv, 0.0).rgb;
  23. }
  24. ################################################ 3- Contrasted #################################################
  25. shader_type canvas_item;
  26. uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;
  27.  
  28. void fragment() {
  29.     vec3 c = textureLod(SCREEN_TEXTURE, SCREEN_UV, 0.0).rgb;
  30.     c = mod(c + vec3(0.5), vec3(1.0));
  31.     COLOR.rgb = c;
  32. }
  33. ################################################ 3- Negative #################################################
  34. shader_type canvas_item;
  35. uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;
  36.  
  37. void fragment() {
  38.     vec3 c = textureLod(SCREEN_TEXTURE, SCREEN_UV, 0.0).rgb;
  39.     c = vec3(1.0) - c;
  40.     COLOR.rgb = c;
  41. }
  42. ##################################### 4- EFEITO DENTRO D'ÁGUA ( EM COLORRECT BRANOCO) #################################################
  43. shader_type canvas_item;
  44.  
  45. uniform float wave_count : hint_range(1.0, 20.0, 1.0) = 20.0;
  46. uniform float speed : hint_range(0.0, 10.0, 0.1) = 3.0;
  47. uniform float height : hint_range(0.0, 0.1, 0.001) = 0.003;
  48. uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;
  49. uniform vec4 water_tint : source_color = vec4(0.2, 0.6, 1.0, 0.1);
  50.  
  51. void fragment() {
  52.     vec2 cPos = -1.0 + 2.0 * UV / (1.0 / TEXTURE_PIXEL_SIZE);
  53.     float cLength = length(cPos);
  54.     vec2 uv = FRAGCOORD.xy / (1.0 / SCREEN_PIXEL_SIZE).xy + (cPos/cLength) * cos(cLength * wave_count - TIME * speed) * height;
  55.     vec3 col = texture(SCREEN_TEXTURE,uv).xyz;
  56.     COLOR = vec4(col,1.0);
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement