Advertisement
Guest User

rolling-shutter.shadron

a guest
Jul 15th, 2017
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1.  
  2. #include <math_constants>
  3. #include <multisample>
  4.  
  5. const int SIZE = 480;
  6.  
  7. param int SAMPLES = 3 : logrange(1, 16);
  8. param float RPM = 60 : logrange(1, 10000);
  9. param float shutterDelay;
  10.  
  11. glsl float spinner(vec2 pos, float rotation) {
  12. float r = length(pos);
  13. float a = atan(-pos.y, pos.x)-rotation;
  14. float t = max(0.5+0.5*sin(3.0*a), 0.1875);
  15. return step(0.125, r)-step(t, r);
  16. }
  17.  
  18. glsl vec4 rollingShutter(vec2 p) {
  19. float rowTime = shadron_Time+(0.5-p.y)*shutterDelay;
  20. float angle = TAU/60.0*RPM*rowTime;
  21. float fill = spinner(1.0625*(2.0*p-1.0), angle);
  22. return vec4(vec3(1.0-0.8375*fill), 1.0);
  23. }
  24.  
  25. animation RollingShutter = glsl(multisample<rollingShutter, SAMPLES>, SIZE);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement