floor_frag.shader 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. shader_type spatial;
  2. render_mode blend_mix,depth_draw_always,cull_back,unshaded;
  3. uniform float ppos;
  4. vec4 mcol( in vec2 uv , float iTime)
  5. {
  6. float speed = 10.0;
  7. float thickness = 0.25;
  8. float spread = 30.0;
  9. float direction = 1.0;
  10. vec3 ret_col = vec3(0.0);
  11. float resx=800.;
  12. vec2 coord = uv*resx;
  13. vec2 center = vec2(resx/2.);
  14. float dist = length(center - coord);
  15. float distToEdge = 01.0 - dist / (resx / 2.0);
  16. float x = center.x - coord.x;
  17. float y = center.y - coord.y;
  18. float r = -(x * x + y * y);
  19. float circles = cos((r / (spread * 150.0) + (iTime * direction) * speed));
  20. circles *= thickness * 10.0;
  21. float c = smoothstep(1.0 - thickness, 1.0, circles);
  22. c *= distToEdge;
  23. c=clamp(c,0.,1.);
  24. vec3 col = 10.*vec3(2.0, .50, 1.0);
  25. ret_col = col*c;
  26. return vec4(ret_col, c*(ppos));
  27. }
  28. void fragment() {
  29. vec3 rd=normalize(((CAMERA_MATRIX*vec4(normalize(VERTEX),0.0)).xyz));
  30. vec3 nor=normalize((CAMERA_MATRIX * vec4(NORMAL, 0.0)).xyz);
  31. float v = 1.0/( 2. * ( 1. + rd.z ) );
  32. vec2 xy = vec2(rd.y * v, rd.x * v);
  33. vec4 tc=mcol(UV,TIME);
  34. ALBEDO = tc.rgb;
  35. //float intensity = pow(0.122 + dot(NORMAL, normalize(VIEW)), 010.85);
  36. ALPHA=tc.a;
  37. //ALPHA=1.;
  38. }