8 uniform vec3 lightPos;
\r
9 uniform vec3 lightColor;
\r
10 uniform vec3 objectColor;
\r
11 uniform vec3 viewPos;
\r
13 vec4 blur(sampler2D tex, vec2 uv, vec2 res) {
\r
14 float Pi = 6.28318530718; // Pi*2
\r
16 // GAUSSIAN BLUR SETTINGS {{{
\r
17 float Directions = 16.0; // BLUR DIRECTIONS (Default 16.0 - More is better but slower)
\r
18 float Quality = 4.0; // BLUR QUALITY (Default 4.0 - More is better but slower)
\r
19 float Size = 8.0; // BLUR SIZE (Radius)
\r
20 // GAUSSIAN BLUR SETTINGS }}}
\r
22 vec2 Radius = Size/res;
\r
25 vec4 Color = texture(tex, uv);
\r
27 // Blur calculations
\r
28 for( float d=0.0; d<Pi; d+=Pi/Directions) {
\r
29 for(float i=1.0/Quality; i<=1.0; i+=1.0/Quality) {
\r
30 Color += texture( tex, uv+vec2(cos(d),sin(d))*Radius*i);
\r
35 Color /= Quality * Directions - 15.0;
\r
41 vec3 norm = normalize(Normal);
\r
42 vec3 lightDir = normalize(lightPos - FragPos);
\r
44 float diff = max(dot(norm, lightDir), 0.0);
\r
45 vec3 diffuse = diff * lightColor;
\r
47 float ambientStrength = 0.1;
\r
48 vec3 ambient = ambientStrength * lightColor;
\r
50 float specularStrength = 0.5;
\r
51 vec3 viewDir = normalize(viewPos - FragPos);
\r
52 vec3 reflectDir = reflect(-lightDir, norm);
\r
53 float spec = pow(max(dot(viewDir, reflectDir), 0.0), 32);
\r
54 vec3 specular = specularStrength * spec * lightColor;
\r
56 vec3 result = (ambient + diffuse) * objectColor;
\r
58 result = vec3(length(FragPos - lightPos));
\r
60 FragColor = vec4(result, 1.0f);
\r