XaskeL

gta 5 radio effect

Dec 3rd, 2019
142
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #ifdef GL_ES
  2.     precision mediump float;
  3. #endif
  4.  
  5. float normpdf(in float x, in float sigma)
  6. {
  7.     return 0.39894*exp(-0.5*x*x/(sigma*sigma))/sigma;
  8. }
  9.  
  10. void mainImage( out vec4 fragColor, in vec2 fragCoord )
  11. {
  12.     vec2 uv = fragCoord/iResolution.xy;
  13.     // GAUSSIAN BLUR PASS
  14.     //vec4 color = texture(iChannel0, uv).rgba;
  15.  
  16.     const int mSize = 32;
  17.     const int kSize = (mSize-1)/2;
  18.     float kernel[mSize];
  19.     vec3 final_colour = vec3(0.0);
  20.        
  21.     //create the 1-D kernel
  22.     float sigma = 4.0;
  23.     float Z = 0.0;
  24.     for (int j = 0; j <= kSize; ++j)
  25.     {
  26.         kernel[kSize+j] = kernel[kSize-j] = normpdf(float(j), sigma);
  27.     }
  28.  
  29.     //get the normalization factor (as the gaussian has been clamped)
  30.     for (int j = 0; j < mSize; ++j)
  31.     {
  32.         Z += kernel[j];
  33.     }
  34.  
  35.     //read out the texels
  36.     for (int i=-kSize; i <= kSize; ++i)
  37.     {
  38.         for (int j=-kSize; j <= kSize; ++j)
  39.         {
  40.             final_colour += kernel[kSize+j]*kernel[kSize+i]*texture(iChannel0, (fragCoord.xy+vec2(float(i),float(j))) / iResolution.xy).rgb;
  41.         }
  42.     }
  43.    
  44.     fragColor = vec4(final_colour/(Z*Z), 1.0);
  45.  
  46.     // GREEN COLOR PASS
  47.     fragColor *= vec4(1, 1.20, 1, 1);
  48.  
  49.     // VIGNETTE PASS
  50.     vec2 coord = (uv - 0.5) * (iResolution.x/iResolution.y) * 2.0;
  51.     float rf = sqrt(dot(coord, coord)) * 0.3;
  52.     float rf2_1 = rf * rf + 1.0;
  53.     float e = 1.0 / (rf2_1 * rf2_1);
  54.    
  55.     vec4 src = vec4(1.0,1.0,1.0,1.0);
  56.     fragColor = vec4(fragColor.rgb * e, 1.0);
  57. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×