SHARE
TWEET

noise_static_luma.hook

a guest Feb 25th, 2017 3,976 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //!HOOK LUMA
  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, 1.0) + vec3(1.0);
  15.     float h = permute(permute(permute(_m.x)+_m.y)+_m.z);
  16.     vec4 noise;
  17.     noise.x = rand(h);
  18.     return HOOKED_tex(HOOKED_pos) + vec4(STRENGTH/8192.0) * (noise - 0.5);
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top