Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 3139)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 3142)
@@ -7,5 +7,5 @@
 
 #define NUM_SAMPLES 8
-//#define NUM_SAMPLES 16
+//#define NUM_SAMPLES 8
 
 // for quadratic falloff
@@ -29,5 +29,4 @@
 //-- reprojection
 
-//#define MIN_DEPTH_DIFF 2e-2f
 #define MIN_DEPTH_DIFF 5e-3f
 #define PRECISION_SCALE 1e-1f
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg	(revision 3141)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg	(revision 3142)
@@ -84,6 +84,6 @@
 	const float3 centerPos = ReconstructSamplePos(ssaoTex, texCoord, bl, br, tl, tr);
 #else
-	//const float eyeSpaceDepth = color.w;
-	const float eyeSpaceDepth = ao.w;
+	const float eyeSpaceDepth = color.w;
+	//const float eyeSpaceDepth = ao.w;
 #endif
 
@@ -114,14 +114,18 @@
 		depthFactor = max(step(1.0f - 5e-1f, 1.0f - length(samplePos - centerPos)), 1e-3f);
 #else // use depth
-		//sampleDepth = tex2Dlod(colorsTex, sampleTexCoord).w;
-		sampleDepth = aoSample.w;
-		depthFactor = max(step(5e-1f, 1.0f - abs(1.0f - eyeSpaceDepth / sampleDepth)), 1e-3f);
+		sampleDepth = tex2Dlod(colorsTex, sampleTexCoord).w;
+		//sampleDepth = aoSample.w;
+		//depthFactor = max(step(1e-1f, 1.0f - abs(1.0f - eyeSpaceDepth / sampleDepth)), 1e-3f);
+		depthFactor = max(1.0f - abs(1.0f - eyeSpaceDepth / sampleDepth), 1e-3f);
 #endif
-		normalFactor = max(step(0.6f, dot(sampleNorm, centerNormal)), 1e-3f);
-		convergenceFactor = min(100.0f, aoSample.y) * 0.01f;//max(step(18.5f, aoSample.y), 1e-3f);
-
-		w = filterWeights[i] * normalFactor * depthFactor * convergenceFactor;
+		//normalFactor = max(step(0.9f, dot(sampleNorm, centerNormal)), 1e-3f);
+		normalFactor = max(dot(sampleNorm, centerNormal), 1e-3f);
+		convergenceFactor = min(1000.0f, aoSample.y) * 0.01f;//max(step(18.5f, aoSample.y), 1e-3f);
+
+		//w = filterWeights[i] * normalFactor * depthFactor * convergenceFactor;
+		w = normalFactor * depthFactor * convergenceFactor;
 		//w = filterWeights[i] * normalFactor * converganceFactor;
 		//w = filterWeights[i] * normalFactor * depthFactor;
+		//w = convergenceFactor;
 
 		average += aoSample.x * w;
@@ -129,7 +133,7 @@
 	}
 
-	average *= 1.0f / max(total_w, 1e-6f);
-
-	return average;
+	average *= 1.0f / max(total_w, 1e-1f);
+
+	return saturate(average);
 }
 
@@ -195,6 +199,6 @@
 						  uniform float2 filterOffs[NUM_SSAO_FILTERSAMPLES],
 						  uniform float filterWeights[NUM_SSAO_FILTERSAMPLES],
-						  float scale,
-						  int index)
+						  float scale
+						  )
 {
 	float average = .0f;
@@ -219,10 +223,10 @@
 
 		//depthFactor = clamp(1.0f - abs(1.0f - eyeSpaceDepth / aoSample.w), 1e-3f, 1.0f);
-		depthFactor = max(step(5e-1f, 1.0f - abs(1.0f - eyeSpaceDepth / aoSample.w)), 1e-3f);
+		//depthFactor = max(step(5e-1f, 1.0f - abs(1.0f - eyeSpaceDepth / aoSample.w)), 1e-3f);
 		//normalFactor = max(step(0.6f, dot(sampleNorm, norm)), 1e-3f);
-
+		w = filterWeights[i];
 		//w = filterWeights[i] * normalFactor * depthFactor;
 		//w = normalFactor * depthFactor;
-		w = depthFactor;
+		//w = depthFactor;
 
 		average += aoSample.y * w;
@@ -245,9 +249,5 @@
 
 	float4 ao = tex2Dlod(ssaoTex, float4(IN.texCoord, 0, 0));
-
-	//const static float scaleFactor = 20.0f;
-	const static float scaleFactor = 10.0f;
-	//ao.y = DiscontinuityFilter2(IN.texCoord, ao, ssaoTex, normalsTex, filterOffs, filterWeights, 0.5f, 1);
-	//ao.y = DiscontinuityFilter2(IN.texCoord, ao, ssaoTex, normalsTex, filterOffs, filterWeights, scaleFactor, 1);
+	//ao.y = DiscontinuityFilter2(IN.texCoord, ao, ssaoTex, normalsTex, filterOffs, filterWeights, 0.1f);
 	
 	OUT.illum_col = ao;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3138)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3142)
@@ -185,7 +185,7 @@
 	float overallDepth = 0;
 
+#if 1
 	const float squaredLen = diffVec.x * diffVec.x + diffVec.y * diffVec.y + diffVec.z * diffVec.z;
 
-#if 1
 	if (squaredLen < 1e-8f) // object not dynamic
 	{
@@ -226,5 +226,5 @@
 		// increase the weight for convergence
 		newWeight = oldWeight + 1.0f;
-		if (notValid > 1.0f) newWeight = 10.0f;
+		if (notValid > 1.0f) newWeight = 4.0f;
 		//if (notValid > 1.0f) newWeight = max(15.0f - notValid * 2.0f, 1.0f);
 	}
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 3140)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 3142)
@@ -292,6 +292,6 @@
 	//-- the flip-flop fbos
 
-	//const int dsw = w / 2; const int dsh = h / 2;
-	const int dsw = w; const int dsh = h;
+	const int dsw = w / 2; const int dsh = h / 2;
+	//const int dsw = w; const int dsh = h;
 
 	mIllumFbo = new FrameBufferObject(dsw, dsh, FrameBufferObject::DEPTH_NONE);
@@ -545,7 +545,10 @@
 	}
 
+	// as multisampling is difficult / costly with deferred shading, 
+	// at least do some antialiasing
 	AntiAliasing(fbo, light);
 
-	Output(fbo);
+	// just output the latest buffer
+	//Output(fbo);
 
 	glEnable(GL_LIGHTING);
@@ -668,8 +671,7 @@
 	GLuint normalsTex = fbo->GetColorBuffer(1)->GetTexture();
 
-	//FrameBufferObject::Release();
-
+	FrameBufferObject::Release();
 	// read the second buffer, write to the first buffer
-	FlipFbos(fbo);
+	//FlipFbos(fbo);
 
 	// the neighbouring texels
