Advertisement
Guest User

noise_static_chroma.hook

a guest
Feb 25th, 2017
8,080
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.65 KB | None | 0 0
  1. //!HOOK CHROMA
  2. //!BIND HOOKED
  3.  
  4. // Change this to tune the strength of the noise
  5. // Apparently this has to be float on some setups
  6. #define STRENGTH 48.0
  7.  
  8. // PRNG taken from mpv's deband shader
  9. float mod289(float x)  { return x - floor(x / 289.0) * 289.0; }
  10. float permute(float x) { return mod289((34.0*x + 1.0) * x); }
  11. float rand(float x)    { return fract(x / 41.0); }
  12.  
  13. vec4 hook()  {
  14.     vec3 _m = vec3(HOOKED_pos, 0.5) + vec3(1.0);
  15.     float h = permute(permute(permute(_m.x)+_m.y)+_m.z);
  16.     vec4 noise;
  17.     noise.x = rand(h); h = permute(h);
  18.     noise.y = rand(h);
  19.     return HOOKED_tex(HOOKED_pos) + vec4(STRENGTH/8192.0) * (noise - 0.5);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement