diff options
Diffstat (limited to 'shaders/glsl330/blur.fs')
| -rw-r--r-- | shaders/glsl330/blur.fs | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/shaders/glsl330/blur.fs b/shaders/glsl330/blur.fs index 44ea42b1..7c31f727 100644 --- a/shaders/glsl330/blur.fs +++ b/shaders/glsl330/blur.fs @@ -1,12 +1,16 @@ #version 330 +// Input vertex attributes (from vertex shader) in vec2 fragTexCoord; +in vec4 fragColor; -out vec4 fragColor; - +// Input uniform values uniform sampler2D texture0; uniform vec4 fragTintColor; +// Output fragment color +out vec4 finalColor; + // NOTE: Add here your custom variables const float renderWidth = 1280.0; @@ -17,13 +21,14 @@ float weight[3] = float[](0.2270270270, 0.3162162162, 0.0702702703); void main() { - vec3 tc = texture(texture0, fragTexCoord).rgb*weight[0]; - + // Texel color fetching from texture sampler + vec3 texelColor = texture(texture0, fragTexCoord).rgb*weight[0]; + for (int i = 1; i < 3; i++) { - tc += texture(texture0, fragTexCoord + vec2(offset[i])/renderWidth, 0.0).rgb*weight[i]; - tc += texture(texture0, fragTexCoord - vec2(offset[i])/renderWidth, 0.0).rgb*weight[i]; + texelColor += texture(texture0, fragTexCoord + vec2(offset[i])/renderWidth, 0.0).rgb*weight[i]; + texelColor += texture(texture0, fragTexCoord - vec2(offset[i])/renderWidth, 0.0).rgb*weight[i]; } - fragColor = vec4(tc, 1.0); + finalColor = vec4(texelColor, 1.0); }
\ No newline at end of file |
