Guest User

shader code

a guest
Oct 25th, 2025
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
GDScript 0.81 KB | Source Code | 0 0
  1. shader_type particles;
  2. render_mode keep_data;
  3.  
  4. uniform bool fadeCont;
  5. uniform float fadeStep : hint_range(0.0, 10.0);
  6. uniform float red : hint_range(0.0, 1.0);
  7. uniform float green : hint_range(0.0, 1.0);
  8. uniform float blue : hint_range(0.0, 1.0);
  9. uniform float tex_anim_offset;
  10.  
  11. void start() {
  12.     // Called when a particle is spawned.
  13. }
  14.  
  15. void process() {
  16.     // Called every frame on existing particles (according to the Fixed FPS property).
  17.     CUSTOM.y += DELTA / LIFETIME;
  18.     CUSTOM.w = 1.0;
  19.     float tv = CUSTOM.y / CUSTOM.w;
  20.    
  21.    
  22.     COLOR.rgb = vec3(COLOR.r * red, COLOR.g * green, COLOR.b * blue) * 10.0;
  23.    
  24.     if (fadeCont) {
  25.         COLOR.a = 1.0 - tv;
  26.     } else {
  27.         COLOR.a = floor((1.0 - tv) * fadeStep) / fadeStep;
  28.     }
  29.     if (RESTART) {
  30.         CUSTOM.z = tex_anim_offset;
  31.         CUSTOM.y = 0.0;
  32.         COLOR = vec4(1.0);
  33.     }
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment