Guest User

tile shader code

a guest
Sep 21st, 2025
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Godot GLSL 1.07 KB | Source Code | 0 0
  1. shader_type canvas_item;
  2.  
  3. uniform sampler2D anim_texture;
  4. uniform float bpm = 95.0;
  5. uniform vec4 component_multiply : hint_color;
  6. uniform float b_mult = 0.5;
  7.  
  8. uniform vec4 color_r : hint_color;
  9. uniform vec4 color_g : hint_color;
  10. uniform vec4 color_b : hint_color;
  11.  
  12. void fragment(){
  13.     float a = texture(TEXTURE, UV).a;
  14.     float r = texture(TEXTURE, UV).r;
  15.     float g = texture(TEXTURE, UV).g;
  16.     float b = texture(TEXTURE, UV).b;
  17.     b *= b_mult;
  18.     float time_phase = mod(TIME * bpm / 60.0, 1.0);
  19.     float r_value = texture(anim_texture, vec2(time_phase, r)).r;
  20.     float g_value = texture(anim_texture, vec2(time_phase, g)).g;
  21.     float b_value = texture(anim_texture, vec2(time_phase, b)).b;
  22.    
  23.     r_value *= component_multiply.r;
  24.     g_value *= component_multiply.g;
  25.     b_value *= component_multiply.b;
  26. //  COLOR.rgb = max(g_value, max(r_value, b_value)) * vec3(1.0);
  27.     vec4 color = vec4(0.0);
  28.     color = mix(color, color_b, b_value);
  29.     color = mix(color, color_r, r_value);
  30.     color = mix(color, color_g, g_value);
  31.     COLOR.rgb = color.rgb;
  32.     COLOR.a = min(max(max(r_value, b_value), g_value), a);
  33.    
  34. }
Advertisement
Add Comment
Please, Sign In to add comment