parent
ade79bc6f6
commit
34d3f94db6
|
|
@ -50,7 +50,7 @@ float getDepthAo(vec2 pos_screen)
|
|||
vec4 getPositionAo(vec2 pos_screen)
|
||||
{
|
||||
float depth = getDepthAo(pos_screen);
|
||||
vec2 sc = (pos_screen);
|
||||
vec2 sc = getScreenCoordinateAo(pos_screen);
|
||||
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
|
||||
vec4 pos = inv_proj * ndc;
|
||||
pos /= pos.w;
|
||||
|
|
@ -71,7 +71,7 @@ vec2 getKern(int i)
|
|||
kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875;
|
||||
kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000;
|
||||
|
||||
return kern[i];
|
||||
return kern[i] / screen_res;
|
||||
}
|
||||
|
||||
//calculate decreases in ambient lighting when crowded out (SSAO)
|
||||
|
|
@ -79,8 +79,8 @@ float calcAmbientOcclusion(vec4 pos, vec3 norm, vec2 pos_screen)
|
|||
{
|
||||
float ret = 1.0;
|
||||
vec3 pos_world = pos.xyz;
|
||||
vec2 noise_reflect = texture2D(noiseMap, pos_screen.xy).xy;
|
||||
|
||||
vec2 noise_reflect = texture2D(noiseMap, pos_screen.xy * (screen_res / 128)).xy;
|
||||
|
||||
float angle_hidden = 0.0;
|
||||
float points = 0;
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ float calcAmbientOcclusion(vec4 pos, vec3 norm, vec2 pos_screen)
|
|||
{
|
||||
vec2 samppos_screen = pos_screen + scale * reflect(getKern(i), noise_reflect);
|
||||
vec3 samppos_world = getPositionAo(samppos_screen).xyz;
|
||||
|
||||
|
||||
vec3 diff = pos_world - samppos_world;
|
||||
float dist2 = dot(diff, diff);
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ void main()
|
|||
vec4 spec = texture2D(specularRect, frag.xy);
|
||||
vec3 diff = texture2D(diffuseRect, frag.xy).rgb;
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy / 128.0).b;
|
||||
float noise = texture2D(noiseMap, frag.xy).b;
|
||||
vec3 npos = normalize(-pos);
|
||||
|
||||
// As of OSX 10.6.7 ATI Apple's crash when using a variable size loop
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ void main()
|
|||
discard;
|
||||
}
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||
float noise = texture2D(noiseMap, frag.xy).b;
|
||||
dist_atten *= noise;
|
||||
|
||||
lv = proj_origin-pos.xyz;
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ void main()
|
|||
lv = normalize(lv);
|
||||
da = dot(norm, lv);
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||
float noise = texture2D(noiseMap, frag.xy).b;
|
||||
|
||||
vec3 col = texture2D(diffuseRect, frag.xy).rgb;
|
||||
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ void main()
|
|||
|
||||
vec4 spec = texture2D(specularRect, frag.xy);
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||
float noise = texture2D(noiseMap, frag.xy).b;
|
||||
vec3 dlit = vec3(0, 0, 0);
|
||||
|
||||
if (proj_tc.z > 0.0 &&
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ void main()
|
|||
|
||||
vec3 dlit = vec3(0, 0, 0);
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||
float noise = texture2D(noiseMap, frag.xy).b;
|
||||
if (proj_tc.z > 0.0 &&
|
||||
proj_tc.x < 1.0 &&
|
||||
proj_tc.y < 1.0 &&
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ void main()
|
|||
vec4 spec = texture2D(specularRect, frag.xy);
|
||||
vec3 dlit = vec3(0, 0, 0);
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||
float noise = texture2D(noiseMap, frag.xy).b;
|
||||
if (proj_tc.z > 0.0 &&
|
||||
proj_tc.x < 1.0 &&
|
||||
proj_tc.y < 1.0 &&
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ void main()
|
|||
else
|
||||
{
|
||||
|
||||
float noise = texture2D(noiseMap, tc/128.0).b;
|
||||
float noise = texture2D(noiseMap, tc).b;
|
||||
|
||||
diffuse = srgb_to_linear(diffuse);
|
||||
spec.rgb = srgb_to_linear(spec.rgb);
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ void main()
|
|||
diffuse = srgb_to_linear(diffuse);
|
||||
spec.rgb = srgb_to_linear(spec.rgb);
|
||||
|
||||
float noise = texture2D(noiseMap, tc/128.0).b;
|
||||
float noise = texture2D(noiseMap, tc).b;
|
||||
if (proj_tc.z > 0.0 &&
|
||||
proj_tc.x < 1.0 &&
|
||||
proj_tc.y < 1.0 &&
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ void main()
|
|||
diffuse = srgb_to_linear(diffuse);
|
||||
spec.rgb = srgb_to_linear(spec.rgb);
|
||||
|
||||
float noise = texture2D(noiseMap, tc/128.0).b;
|
||||
float noise = texture2D(noiseMap, tc).b;
|
||||
float lit = nl * dist_atten * noise;
|
||||
|
||||
final_color = color.rgb*lit*diffuse;
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ void main()
|
|||
diffuse = srgb_to_linear(diffuse);
|
||||
spec.rgb = srgb_to_linear(spec.rgb);
|
||||
|
||||
float noise = texture2D(noiseMap, tc/128.0).b;
|
||||
float noise = texture2D(noiseMap, tc).b;
|
||||
if (proj_tc.z > 0.0 &&
|
||||
proj_tc.x < 1.0 &&
|
||||
proj_tc.y < 1.0 &&
|
||||
|
|
|
|||
Loading…
Reference in New Issue