You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CircleScanMaterial.glsl 942B

1234567891011121314151617181920212223242526
  1. uniform vec4 color;
  2. uniform float speed;
  3. float circle(vec2 uv, float r, float blur) {
  4. float d = length(uv) * 2.0;
  5. float c = smoothstep(r+blur, r, d);
  6. return c;
  7. }
  8. czm_material czm_getMaterial(czm_materialInput materialInput)
  9. {
  10. czm_material material = czm_getDefaultMaterial(materialInput);
  11. vec2 st = materialInput.st - .5;
  12. material.diffuse = color.rgb;
  13. material.emission = vec3(0);
  14. float t =fract(czm_frameNumber * speed / 1000.0);
  15. float s = 0.3;
  16. float radius1 = smoothstep(.0, s, t) * 0.5;
  17. float alpha1 = circle(st, radius1, 0.01) * circle(st, radius1, -0.01);
  18. float alpha2 = circle(st, radius1, 0.01 - radius1) * circle(st, radius1, 0.01);
  19. float radius2 = 0.5 + smoothstep(s, 1.0, t) * 0.5;
  20. float alpha3 = circle(st, radius1, radius2 + 0.01 - radius1) * circle(st, radius1, -0.01);
  21. material.alpha = smoothstep(1.0, s, t) * (alpha1 + alpha2*0.1 + alpha3*0.1);
  22. material.alpha *= color.a;
  23. return material;
  24. }