Guest User

Untitled

a guest
Oct 23rd, 2021
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. shader_type spatial;
  2.  
  3. uniform sampler2D noise;
  4.  
  5. uniform vec4 color : hint_color;
  6. uniform vec2 center = vec2(.5, .5);
  7. uniform float radial_scale = 1.0;
  8. uniform float length_scale = 1.0;
  9.  
  10. uniform float divide_factor = 1.0;
  11.  
  12. void vertex() {
  13.     vec2 delta = UV - center;
  14.     float radius = length(delta) * 2.0 * radial_scale - .15;
  15.     float angle = atan(delta.x, delta.y) * 1.0 / 6.28 * length_scale;
  16.    
  17.     float depth = radius / divide_factor;
  18.     depth = clamp(1.0 - depth, 0.0, 1.0);
  19.    
  20.     depth = pow(depth, 2.0) * 1.0;
  21.    
  22.     VERTEX.y -= depth;
  23.     NORMAL.y -= depth;
  24.    
  25.     COLOR.x = radius;
  26.     COLOR.y = angle;
  27.     COLOR.z = depth;
  28. }
  29.    
  30. void fragment() {
  31.     vec2 delta = UV - center;
  32.     float angle = atan(delta.x, delta.y) * 1.0 / 6.28 * length_scale;
  33.    
  34.     float scaling_distance = COLOR.x * 1.5;
  35.    
  36.     vec2 uvs = vec2(scaling_distance + TIME * .12, scaling_distance + angle);
  37.     float whirpool = step(texture(noise, uvs).x, .5);
  38.    
  39.     if(COLOR.z < .01 || whirpool > .5) {
  40.         ALBEDO = color.rgb * (1.0 - COLOR.z * 1.4);
  41.        
  42.         if(COLOR.z >= .01) {
  43.             ALBEDO.r += .03;
  44.         }
  45.     } else {
  46.         ALBEDO.rgb = color.rgb * .35;
  47.     }
  48.    
  49.     ROUGHNESS = 1.0;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment