Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 3327)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 3328)
@@ -5,9 +5,9 @@
 ////////////
 //-- ssao + gi parameters
-#define NUM_PRECOMPUTED_SAMPLES 100
+#define NUM_PRECOMPUTED_SAMPLES 4096
 //#define NUM_SAMPLES 8
 //#define NUM_SAMPLES 16
 //#define NUM_SAMPLES 24
-#define NUM_SAMPLES 8
+#define NUM_SAMPLES 48
 
 //#define MIN_SAMPLES 48
@@ -61,5 +61,5 @@
 #define NUM_DOF_TABS 16
 
-//#define USE_GTX
+#define USE_GTX
 
 #define SSAO_FILTER_RADIUS 5
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3327)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3328)
@@ -179,5 +179,4 @@
 			 sampler2D colors,
 			 sampler2D noiseTex,
-			 //float2 samples[NUM_PRECOMPUTED_SAMPLES],
 			 sampler2D samples,
 			 float3 normal,
@@ -211,5 +210,5 @@
 		//-- (affects performance for some reason!)
 
-		if (1)//convergence < SSAO_CONVERGENCE_THRESHOLD)
+		if (convergence < SSAO_CONVERGENCE_THRESHOLD)
 		{
 			float2 mynoise = tex2Dlod(noiseTex, float4(IN.texCoord * 4.0f, 0, 0)).xy;
@@ -274,9 +273,9 @@
 		// to the current pixel or if the angle is small enough
 		// to have any influence in the current or last frame
-#if 0
+#if 1
 		const float tooFarAway = step(0.5f, lengthToSample - changeFactor);
 
 		const float partlyResetThres = 1.0f;
-		if (0)//pixelValid <= partlyResetThres)
+		if (pixelValid <= partlyResetThres)
 			validSamples = max(validSamples, pixelValid * (1.0f - tooFarAway) * step(-0.1f, cosAngle));
 		else
@@ -295,5 +294,5 @@
 			// (=> there was no discontinuity recently)
 			//else if (isMovingObject && (convergence > SSAO_CONVERGENCE_THRESHOLD)) break;
-			//else if (isMovingObject && (convergence > NUM_SAMPLES * 5)) break;
+			else if (isMovingObject && (convergence > NUM_SAMPLES * 5)) break;
 		}
 #endif
@@ -407,5 +406,5 @@
 		// or if the angle is small enough
 		// to have any influence in the current or last frame
-#if 0
+#if 1
 		const float partlyResetThres = 1.0f;
 
@@ -456,5 +455,4 @@
 			uniform sampler2D noiseTex,
 			uniform sampler2D samples,
-			//uniform float2 samples[NUM_PRECOMPUTED_SAMPLES],
 			uniform sampler2D oldTex,
 			uniform float4x4 modelViewProj,
@@ -513,6 +511,7 @@
 
 	const float oldSsao = temporalVals.x;
-	const float oldWeight = temporalVals.y;
-	const float oldIdx = 0;//temporalVals.z;
+	
+	float oldWeight = temporalVals.y;
+	float oldIdx = temporalVals.z;
 
 	float3 ao;
@@ -551,5 +550,5 @@
 	
 	// don't check for moving objects, otherwise almost no coherence
-	/*if (!isMovingObject)
+	if (!isMovingObject)
 	{
 		if (ao.y > completelyResetThres) 
@@ -560,9 +559,9 @@
 		else if (ao.y > partlyResetThres)
 		{
-			//oldWeight = min(oldWeight, 4.0f * newWeight);
-			oldWeight = .0f; 
-			oldIdx = .0f;
-		}
-	}*/
+			oldWeight = min(oldWeight, 4.0f * newWeight);
+			//oldWeight = .0f; 
+			//oldIdx = .0f;
+		}
+	}
 
 
@@ -586,5 +585,4 @@
 	//OUT.illum_col.z = SqrLen(diffVec);
 
-	//OUT.illum_col.xyz = normal.xyz;
 	return OUT;
 }
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg	(revision 3327)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg	(revision 3328)
@@ -192,5 +192,5 @@
 	{
 		// the filtered ssao value
-		//OUT.illum_col.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep, convergence, maxConvergence, spatialWeight);
+		OUT.illum_col.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep, convergence, maxConvergence, spatialWeight);
 	}
 
@@ -232,5 +232,5 @@
 	{
 		// the filtered ssao value
-		//ao.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep, convergence, maxConvergence, spatialWeight);
+		ao.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep, convergence, maxConvergence, spatialWeight);
 	}
 
@@ -241,6 +241,6 @@
 	if (depth < DEPTH_THRESHOLD)
 	{
-		//OUT.illum_col.xyz = col.xyz * max(minAO, 1.0f - ao.x);
-		OUT.illum_col.xyz = max(minAO, 1.0f - ao.x);
+		OUT.illum_col.xyz = col.xyz * max(minAO, 1.0f - ao.x);
+		//OUT.illum_col.xyz = max(minAO, 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 3326)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg	(revision 3328)
@@ -253,6 +253,6 @@
 	
 	// retrieve the sample from the last frame
-	const float4 oldPixel = tex2Dlod(myTex, float4(oldTexCoords, .0f, .0f));
-	const float oldDiff = tex2Dlod(oldTex, float4(oldTexCoords, .0f, .0f)).x;
+	const float4 oldPixel = tex2Dlod(oldTex, float4(oldTexCoords, .0f, .0f));
+	const float oldDiff = tex2Dlod(myTex, float4(oldTexCoords, .0f, .0f)).x;
 
 	// calculate eye space position of sample in old frame
@@ -272,6 +272,6 @@
 
 	// check if the pixel belonged to a dynamic object in the last frame
-	const bool newDynamic = (squaredLen > 100000);//DYNAMIC_OBJECTS_THRESHOLD);
-	const bool oldDynamic = (oldDiff > 1000000);//DYNAMIC_OBJECTS_THRESHOLD);
+	const bool newDynamic = (squaredLen > DYNAMIC_OBJECTS_THRESHOLD);
+	const bool oldDynamic = (oldDiff > DYNAMIC_OBJECTS_THRESHOLD);
 
 
@@ -306,5 +306,4 @@
 	}
 	
-	//isPixelValid = 2e20f;
 	return float2(isPixelValid, abs(oldEyeSpaceDepth - projectedEyeSpaceDepth));
 }
