Newer
Older
DungeonShooting / DungeonShooting_Godot / resource / shader / RingOfPower.gdshader
@小李xl 小李xl on 21 Mar 2024 948 bytes 测试特效
  1. shader_type canvas_item;
  2. render_mode blend_add;
  3.  
  4. uniform float radius : hint_range(0.0, 1.0, 0.01) = .7;
  5. uniform float thickness : hint_range(0.0, 1.0, 0.01) = .2;
  6. uniform vec4 color : source_color = vec4(0.9, 0.4, 0.1, 1.0);
  7. uniform float brightness : hint_range(0.0, 15.0, 0.01) = 5.0;
  8. uniform float angular_speed : hint_range(-5.0, 5.0, 0.01) = 2.5;
  9. uniform float radial_speed : hint_range(-5.0, 5.0, 0.01) = 1.4;
  10. uniform float alpha : hint_range(0.0, 1.0, 0.01) = .5;
  11. uniform sampler2D noise;
  12.  
  13. void fragment() {
  14. vec2 v = vec2(.5) - UV;
  15. float d = length(v) * 2.;
  16. float angle = atan(v.y, v.x) + (TIME * angular_speed);
  17. float thick_ratio = 1. - (abs(d - max(0., radius)) / max(.0001, thickness));
  18. vec2 polar = fract(vec2(angle / 6.28, d + (TIME * radial_speed)));
  19. vec4 col = thick_ratio * brightness * color;
  20. vec3 tex = texture(noise, polar).rgb;
  21. col.a = (alpha * (tex.r + tex.g + tex.b) * clamp(thick_ratio, 0., 1.)) / 3.;
  22. COLOR = col;
  23. }