lost_soul

A 3D walking simulator game
Log | Files | Refs | README | LICENSE

blur.fs (944B)


      1 #version 330
      2 
      3 // Input vertex attributes (from vertex shader)
      4 in vec2 fragTexCoord;
      5 in vec4 fragColor;
      6 
      7 // Input uniform values
      8 uniform sampler2D texture0;
      9 uniform vec4 colDiffuse;
     10 
     11 // Output fragment color
     12 out vec4 finalColor;
     13 
     14 // NOTE: Add here your custom variables
     15 
     16 // NOTE: Render size values must be passed from code
     17 const float renderWidth = 800;
     18 const float renderHeight = 450;
     19 
     20 float offset[3] = float[](0.0, 1.3846153846, 3.2307692308);
     21 float weight[3] = float[](0.2270270270, 0.3162162162, 0.0702702703);
     22 
     23 void main()
     24 {
     25     // Texel color fetching from texture sampler
     26     vec3 texelColor = texture(texture0, fragTexCoord).rgb*weight[0];
     27 
     28     for (int i = 1; i < 3; i++)
     29     {
     30         texelColor += texture(texture0, fragTexCoord + vec2(offset[i])/renderWidth, 0.0).rgb*weight[i];
     31         texelColor += texture(texture0, fragTexCoord - vec2(offset[i])/renderWidth, 0.0).rgb*weight[i];
     32     }
     33 
     34     finalColor = vec4(texelColor, 1.0);
     35 }