Advertisement
Guest User

Untitled

a guest
Feb 16th, 2020
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. @RotRedPanda
  2. shader_type canvas_item;
  3.  
  4. uniform float loc = 0.6;
  5. uniform float rotation = 0.785;
  6. uniform float width = 0.24;
  7. uniform float soft = 1.55;
  8. uniform float bright = 1.09;
  9. uniform float gloss = 1.8;
  10. uniform float speed = 0.31;
  11. uniform vec4 shineColor : hint_color = vec4(1.0);
  12.  
  13. vec4 shine(vec4 _color, vec2 _uv, float _location, float _rotRadians, float _width, float _soft, float _bright, float _gloss){
  14. vec2 angle = vec2(cos(_rotRadians), sin(_rotRadians));
  15. float normPos = dot(_uv, angle);
  16. float normal = 1.0 - min(max(abs((normPos - _location) / _width), 0.0), 1.0);
  17. float shinePower = smoothstep(0.0, _soft * 2.0, normal);
  18. vec3 reflectColor = mix(vec3(1.0), _color.rgb * 10.0, _gloss);
  19. _color.rgb += _color.a * (shinePower / 2.0) * _bright * reflectColor * shineColor.rgb;
  20. return _color;
  21. }
  22.  
  23. void fragment(){
  24. vec2 uv = UV;
  25. vec4 col = textureLod(TEXTURE, uv, 0);
  26. COLOR = shine(col, uv, loc, rotation, width, soft, bright, gloss);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement