Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 3304)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 3306)
@@ -10,5 +10,7 @@
 //#define NUM_SAMPLES 24
 #define NUM_SAMPLES 48
+//#define NUM_SAMPLES 16
 
+//#define MIN_SAMPLES 48
 #define MIN_SAMPLES 8
 
@@ -19,8 +21,4 @@
 /// scale factor that takes angle of sample normal into account 
 #define VIEW_CORRECTION_SCALE 1.0f
-
-//#define NUM_SSAO_FILTER_SAMPLES 13 // 7x7
-#define NUM_SSAO_FILTER_SAMPLES 9
-//#define NUM_SSAO_FILTER_SAMPLES 5
 
 #define SSAO_CONVERGENCE_THRESHOLD 700.0f
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3304)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3306)
@@ -295,5 +295,6 @@
 		// to have any influence in the current or last frame
 		const float tooFarAway = step(0.5f, lengthToSample - changeFactor);
-		validSamples = max(validSamples, (1.0f - tooFarAway) * pixelValid * step(-0.1f, cosAngle));
+		//validSamples = max(validSamples, (1.0f - tooFarAway) * pixelValid * step(-0.1f, cosAngle));
+		validSamples = max(validSamples, pixelValid);
 
 #ifdef USE_GTX
@@ -415,9 +416,9 @@
 
 	// completely reset the ao in this pixel
-	const float completelyResetThres = 4.0f;
+	const float completelyResetThres = 20.0f;
 	// don't fully reset the ao in this pixel, but give low weight to old solution
 	const float partlyResetThres = 1.0f;
 	
-	if (!isMovingObject)
+	if (1)//!isMovingObject)
 	{
 		if (ao.y > completelyResetThres) 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg	(revision 3305)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg	(revision 3306)
@@ -166,6 +166,7 @@
 
 	OUT.illum_col = tex2Dlod(ssaoTex, float4(IN.texCoord, 0, 0));
-	// just take unfiltered convergence in current pixel
+	// compute minimal convergence for savetly reasons, write it out
 	const float convergence = ComputeConvergenceHalfRes(ssaoTex, IN.texCoord, res * 0.5f);
+	OUT.illum_col.y = convergence;
 
 	const float2 xyStep = float2(1.0f / res.x, 0);
@@ -221,6 +222,6 @@
 	if (depth < DEPTH_THRESHOLD)
 	{
-		OUT.illum_col.xyz = col.xyz * max(2e-2f, 1.0f - ao.x);
-		//OUT.illum_col.xyz = col.xyz * ao.x;
+		//OUT.illum_col.xyz = col.xyz * max(2e-2f, 1.0f - ao.x);
+		OUT.illum_col.xyz = max(2e-2f, 1.0f - ao.x);
 	}
 	else
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg	(revision 3304)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg	(revision 3306)
@@ -231,4 +231,5 @@
 	// compute position from old frame for dynamic objects + translational portion
 	//const float3 translatedPos = difVec - oldEyePos + worldPos.xyz;
+	// don't use difVec here: want to detect if the actual pixel has changed => ssao changed
 	const float3 translatedPos = -oldEyePos + worldPos.xyz;
 
@@ -259,6 +260,7 @@
 	
 	// test if this pixel was valid in the old frame
-	float pixelValid;
-
+	float IsPixelValid;
+
+	// check if the pixel belonged to a dyanmic object in the last frame
 	const bool oldDynamic = (squaredLen > DYNAMIC_OBJECTS_THRESHOLD);
 	const bool newDynamic = (oldPixel.z > DYNAMIC_OBJECTS_THRESHOLD);
@@ -270,28 +272,32 @@
 	const float pixelCouldBeValid = 2.0f;
 	// this pixel information has to be discarded in order to not create artifacts
-	const float pixelNotValid = 10.0f;
-
-	if ((oldTexCoords.x < .0f) || (oldTexCoords.x >= 1.0f) || 
-		(oldTexCoords.y < .0f) || (oldTexCoords.y >= 1.0f))
+	const float pixelIsNotValid = 100.0f;
+
+	const float xOffs = 0;// 0.5f / 1024.0f;
+	const float yOffs = 0;// 0.5f / 768.0f;
+
+	if ((oldTexCoords.x < xOffs) || (oldTexCoords.x > (1.0f - xOffs)) || 
+		(oldTexCoords.y < yOffs) || (oldTexCoords.y > (1.0f - yOffs))
+		)
 	{
-		pixelValid = pixelNotValid;
-	}
-	else if (//!((oldEyeSpaceDepth > DEPTH_THRESHOLD) || (projectedEyeSpaceDepth > DEPTH_THRESHOLD)) &&
-		// check if changed from dynamic to not dynamic object
+		IsPixelValid = pixelIsNotValid;
+	}
+	else if (// check if changed from dynamic to not dynamic object
 		((oldDynamic && !newDynamic) || (!oldDynamic && newDynamic) ||
-		// check if we have a dynamic object and is a depth discontinuity
 		(
+		(oldEyeSpaceDepth < DEPTH_THRESHOLD) && (projectedEyeSpaceDepth < DEPTH_THRESHOLD) &&
+		// check if we have a dynamic object 
 		(oldDynamic || newDynamic) && 
-		//(depthDif > 1e-5f))))
+		// and is a depth discontinuity
 		(depthDif > MIN_DEPTH_DIFF))))
 	{	
-		pixelValid = pixelCouldBeValid; 
+		IsPixelValid = pixelCouldBeValid; 
 	}
 	else 
 	{
-		pixelValid = pixelIsValid;
-	}
-
-	return float2(pixelValid, abs(oldEyeSpaceDepth - projectedEyeSpaceDepth));
+		IsPixelValid = pixelIsValid;
+	}
+
+	return float2(IsPixelValid, abs(oldEyeSpaceDepth - projectedEyeSpaceDepth));
 }
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3305)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3306)
@@ -625,5 +625,5 @@
 	if (0) LoadPompeiiFloor();
 
-#if 1
+#if 0
 	const Vector3 sceneCenter(470.398f, 240.364f, 181.7f);
 	//const Vector3 sceneCenter(470.398f, 240.364f, 180.3);
@@ -1573,14 +1573,4 @@
 		cout << "new ssao sample intensity: " << ssaoSampleIntensity << endl;
 		break;
-	/*case 'o':
-		if (ssaoFilterRadius >= 0.0f) ssaoFilterRadius -= 1.0f;
-		if (deferredShader) deferredShader->SetSsaoFilterRadius(ssaoFilterRadius);
-		cout << "new ssao filter radius: " << ssaoFilterRadius << endl;
-		break;
-	case 'O':
-		ssaoFilterRadius += 1.0f;
-		if (deferredShader) deferredShader->SetSsaoFilterRadius(ssaoFilterRadius);
-		cout << "new ssao filter radius: " << ssaoFilterRadius << endl;
-		break;*/
 	/*	case 'o':
 	case 'O':
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 3305)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 3306)
@@ -81,8 +81,4 @@
 // dof samples
 static Sample2 dofSamples[NUM_DOF_TABS];
-
-
-static float ssaoFilterOffsets[NUM_SSAO_FILTER_SAMPLES * 2];
-static float ssaoFilterWeights[NUM_SSAO_FILTER_SAMPLES];
 
 static Texture *sHaloTex[5];
@@ -350,5 +346,4 @@
 	mDownSampleFbo->AddColorBuffer(ColorBufferObject::RGB_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR);
 
-
 	for (int i = 0; i < 2; ++ i)
 	{
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/vienna.env
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/vienna.env	(revision 3299)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/vienna.env	(revision 3306)
@@ -115,3 +115,3 @@
 tempCohFactor=2000.0f
 # ssao filter radius
-ssaoFilterRadius=12.0f
+ssaoFilterRadius=3.0f
