Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 3120)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 3122)
@@ -6,11 +6,11 @@
 //-- ssao + gi parameters
 
-#define NUM_SAMPLES 8
-//#define NUM_SAMPLES 16
+//#define NUM_SAMPLES 8
+#define NUM_SAMPLES 16
 
 // for quadratic falloff
 //#define SAMPLE_INTENSITY 0.1f
-#define SAMPLE_INTENSITY 0.07f
-//#define SAMPLE_INTENSITY 0.03f
+//#define SAMPLE_INTENSITY 0.07f
+#define SAMPLE_INTENSITY 0.03f
 
 #define SAMPLE_RADIUS 8e-1f
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg	(revision 3120)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg	(revision 3122)
@@ -86,5 +86,5 @@
 		//sampleNorm = tex2Dlod(normalsTex, offs).xyz;
 
-		w = filterWeights[i] * max(dot(sampleNorm, norm), .0f) * depthFactor;
+		w = filterWeights[i] * max(dot(sampleNorm, norm), 1e-3f) * depthFactor;
 
 		average += aoSample.x * w;
@@ -113,5 +113,5 @@
 	if ((ao.y < 60.0f) && (col.w < 1e10f))
 	{
-		const static float scaleFactor = 10.0f;
+		const static float scaleFactor = 20.0f;
 
 		//ao.x = Filter(IN.texCoord, ssaoTex, filterOffs, filterWeights);
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3121)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3122)
@@ -185,4 +185,5 @@
 	//float overallDepth = 0;
 	const float squaredLen = diffVec.x * diffVec.x + diffVec.y * diffVec.y + diffVec.z * diffVec.z;
+
 #if 1
 	if (squaredLen < 1e-8f) // object not dynamic
@@ -208,6 +209,6 @@
 #endif
 
-	//const float oldWeight = clamp(oldPixel.y, .0f, temporalCoherence);
-	float oldWeight = oldPixel.y;
+	//const float clampedOldWeight = clamp(oldPixel.y, .0f, temporalCoherence);
+	const float oldWeight = oldPixel.y;
 
 	float newWeight;
@@ -219,10 +220,10 @@
 		// if visibility changed in the surrounding area we have to recompute
 		//&& (oldNumSamples > 0.8f * newNumSamples)
-		//&& (notValid < 1.0f)
+		&& (notValid < 1.0f)
 		)
 	{
 		// increase the weight for convergence
 		newWeight = oldWeight + 1.0f;
-		if (notValid > 1.0f) newWeight = 2.0f;
+		//if (notValid > 1.0f) newWeight = 2.0f;
 	}
 	else
@@ -231,6 +232,7 @@
 	}
 
-	if (oldPixel.y >= temporalCoherence)
-		newWeight = min(temporalCoherence+1, max(oldPixel.y - 70, 50));
+	//if (oldPixel.y >= 2000)
+	//	newWeight = min(temporalCoherence + 1, max(oldPixel.y - 70, 50));
+	if (newWeight >= 2000) newWeight = 1000;
 
 	return float3(oldPixel.x, newWeight, eyeSpaceDepth);
@@ -379,7 +381,9 @@
 	const float newWeight = temporalVals.y;
 
-	float2 noiseOffs = float2(newWeight / 256.0f, (newWeight - 256.0f) / 192.0f);
+	//float2 noiseOffs = float2(newWeight / 139.0f, newWeight / 141.0f);
+	float2 noiseOffs = float2(.0f);
 
 	float2 ao;
+
 	// note: this should be done with the stencil buffer
 	if (eyeSpaceDepth < 1e10f)
@@ -393,6 +397,7 @@
 	}
 
-
-	OUT.illum_col.x = (ao.x + oldSsao * (newWeight - 1.0f)) / newWeight;
+	const float clampedWeight = clamp(newWeight, 1, temporalCoherence);
+
+	OUT.illum_col.x = (ao.x + oldSsao * (clampedWeight - 1.0f)) / clampedWeight;
 	OUT.illum_col.y = newWeight;
 	OUT.illum_col.z = invw;
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 3121)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 3122)
@@ -535,6 +535,5 @@
 	sCgSsaoProgram->SetValue1f(i ++, (mUseTemporalCoherence && !mRegenerateSamples) ? tempCohFactor : 0);
 	
-	if (//mUseTemporalCoherence || 
-		mRegenerateSamples)
+	if (mUseTemporalCoherence || mRegenerateSamples)
 	{
 		mRegenerateSamples = false;
