Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 3299)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 3304)
@@ -68,3 +68,6 @@
 #define SSAO_FILTER_RADIUS 3
 
+#define DEPTH_THRESHOLD 1e10f
+
+
 #endif // __SHADERENV_H
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg	(revision 3301)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg	(revision 3304)
@@ -145,5 +145,5 @@
 	// filter up to a certain convergance value and leave out background (sky) by checking depth
 	if (//(convergence < SSAO_CONVERGENCE_THRESHOLD) &&
-		(col.w < 1e10f))
+		(col.w < DEPTH_THRESHOLD))
 	{
 		const float distanceScale = 1.0f;
@@ -159,10 +159,13 @@
 
 	// just apply ssao if we are not in the sky
-	if (col.w < 1e10f)
+	if (col.w < DEPTH_THRESHOLD)
+	{
 		OUT.illum_col.xyz = col.xyz * max(2e-2f, 1.0f - ao.x);
 		//OUT.illum_col.xyz = col.xyz * ao.x;
+	}
 	else
+	{
 		OUT.illum_col.xyz = col.xyz;
-
+	}
 
 	//OUT.illum_col.xyz = float3(abs(ao.y * 1e2f), abs(ao.z * 1e2f), abs(ao.w * 1e2f));
@@ -214,5 +217,5 @@
 	// filter up to a certain convergance value and leave out background (sky) by checking depth
 	if ((convergence < SSAO_CONVERGENCE_THRESHOLD) && 
-		(col.w < 1e10f))
+		(col.w < DEPTH_THRESHOLD))
 	{
 		const float distanceScale = 1.0f;
@@ -229,5 +232,5 @@
 
 	// just apply ssao if we are not in the sky
-	if (col.w < 1e10f)
+	if (col.w < DEPTH_THRESHOLD)
 	{
 		OUT.illum_col.xyz = col.xyz * max(2e-2f, 1.0f - ao.x);
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3303)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3304)
@@ -396,5 +396,5 @@
 
 	// cull background note: this should be done with the stencil buffer
-	if (eyeSpaceDepth < 1e10f)
+	if (eyeSpaceDepth < DEPTH_THRESHOLD)
 	{
 		ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), oldWeight, sampleIntensity, isMovingObject);
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg	(revision 3303)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg	(revision 3304)
@@ -63,5 +63,6 @@
 			   float3 tl,
 			   float3 tr,
-			   float2 xyStep)
+			   float2 xyStep,
+			   float convergence)
 {
 	float2 result = float2(0.0f, 0.0f);
@@ -69,7 +70,11 @@
 	const float3 centerPos = ReconstructSamplePos(colorsTex, texCoord, bl, br, tl, tr);
 
-	for (int i = -SSAO_FILTER_RADIUS; i < SSAO_FILTER_RADIUS; ++ i)
+	const float scale = saturate((SSAO_CONVERGENCE_THRESHOLD - convergence) / SSAO_CONVERGENCE_THRESHOLD);
+	//const int radius = SSAO_FILTER_RADIUS * saturate((SSAO_CONVERGENCE_THRESHOLD - convergence) / SSAO_CONVERGENCE_THRESHOLD);
+	
+	//for (int i = -radius; i <= radius; ++ i)
+	for (int i = -SSAO_FILTER_RADIUS; i <= SSAO_FILTER_RADIUS; ++ i)
 	{
-		float4 sampleTexCoord = float4(texCoord + i * xyStep, .0f, .0f);
+		float4 sampleTexCoord = float4(texCoord + i * xyStep * scale, .0f, .0f);
 		result += FilterSample(sampleTexCoord, ssaoTex, colorsTex, centerPos, bl, br, tl, tr);
 	}
@@ -104,8 +109,8 @@
 
 	// filter up to a certain convergance value and leave out background (sky) by checking depth
-	if ((convergence < SSAO_CONVERGENCE_THRESHOLD) && (depth < 1e10f))
+	if ((convergence < SSAO_CONVERGENCE_THRESHOLD) && (depth < DEPTH_THRESHOLD))
 	{
 		// the filtered ssao value
-		OUT.illum_col.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep);
+		OUT.illum_col.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep, convergence);
 	}
 
@@ -140,12 +145,12 @@
 
 	// filter up to a certain convergance value and leave out background (sky) by checking depth
-	if ((convergence < SSAO_CONVERGENCE_THRESHOLD) && (depth < 1e10f))
+	if ((convergence < SSAO_CONVERGENCE_THRESHOLD) && (depth < DEPTH_THRESHOLD))
 	{
 		// the filtered ssao value
-		ao.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep);
+		ao.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep, convergence);
 	}
 
 	// just apply ssao if we are not in the sky
-	if (depth < 1e10f)
+	if (depth < DEPTH_THRESHOLD)
 	{
 		OUT.illum_col.xyz = col.xyz * max(2e-2f, 1.0f - ao.x);
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg	(revision 3284)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg	(revision 3304)
@@ -277,5 +277,5 @@
 		pixelValid = pixelNotValid;
 	}
-	else if (//!((oldEyeSpaceDepth > 1e10f) || (projectedEyeSpaceDepth > 1e10f)) &&
+	else if (//!((oldEyeSpaceDepth > DEPTH_THRESHOLD) || (projectedEyeSpaceDepth > DEPTH_THRESHOLD)) &&
 		// check if changed from dynamic to not dynamic object
 		((oldDynamic && !newDynamic) || (!oldDynamic && newDynamic) ||
