Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 3346)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 3347)
@@ -8,8 +8,8 @@
 #define NUM_PRECOMPUTED_SAMPLES 4096
 
-#define NUM_SAMPLES 8
+//#define NUM_SAMPLES 8
 //#define NUM_SAMPLES 16
 //#define NUM_SAMPLES 24
-//#define NUM_SAMPLES 48
+#define NUM_SAMPLES 32
 
 //#define MIN_SAMPLES 48
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3346)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3347)
@@ -154,9 +154,9 @@
 	else
 	{	
-		w = .0f;
+		w   = .0f;
 		idx = .0f;
 	}
 
-	return float3(ssao, w, idx);
+	return float3(ssao, idx, w);
 }
 
@@ -201,4 +201,5 @@
 			tex2Dlod(samples, float4((0.5f + i + idx) / NUM_PRECOMPUTED_SAMPLES, 0.5f, .0f, .0f)).xy;
 
+
 		////////////////////
 		//-- add random noise: reflect around random normal vector 
@@ -207,5 +208,5 @@
 		if (convergence < SSAO_CONVERGENCE_THRESHOLD)
 		{
-			float2 mynoise = tex2Dlod(noiseTex, float4(IN.texCoord * 4.0f, 0, 0)).xy;
+			float2 mynoise = tex2Dlod(noiseTex, float4(IN.texCoord * 4.0f, .0f, .0f)).xy;
 			//offset = myreflect(samples[i], mynoise);
 			//offset = myrotate(samples[i], mynoise.x);
@@ -584,6 +585,7 @@
 		else if (ao.y > partlyResetThres)
 		{
+			if (oldIdx > 4.0f * NUM_SAMPLES) oldIdx = 0;
 			//oldWeight = min(oldWeight, 4.0f * NUM_SAMPLES); oldIdx = oldWeight;
-			//oldWeight = .0f; oldIdx = .0f;
+			oldWeight = oldIdx;//.0f; oldIdx = .0f;
 		}
 	}
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg	(revision 3343)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg	(revision 3347)
@@ -250,5 +250,5 @@
 
 	//OUT.illum_col.xyz = float3(ao.w * 5e-1f, 0, 0);
-	//OUT.illum_col.xyz = float3(ao.z * 1e-1f);
+	//OUT.illum_col.xyz = float3(ao.y * 1e-2f);
 	//OUT.illum_col.xyz = float3(ao.y * 1e-1f);//, 0, 0);
 	//OUT.illum_col.xyz = ao.xyz;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg	(revision 3345)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg	(revision 3347)
@@ -255,5 +255,5 @@
 	const float4 oldPixel = tex2Dlod(oldTex, float4(oldTexCoords, .0f, .0f));
 	//const float oldDiff = tex2Dlod(myTex, float4(oldTexCoords, .0f, .0f)).x;
-	const float oldDiff = tex2Dlod(myTex, float4(oldTexCoords, .0f, .0f)).z;
+	const float oldDiff = oldPixel.z;//tex2Dlod(myTex, float4(oldTexCoords, .0f, .0f)).z;
 
 	// calculate eye space position of sample in old frame
@@ -306,4 +306,5 @@
 		isPixelValid = pixelIsValid;
 	}
+	//isPixelValid = pixelIsValid;
 	
 	return float2(isPixelValid, abs(oldEyeSpaceDepth - projectedEyeSpaceDepth));
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 3345)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 3347)
@@ -432,4 +432,5 @@
 	mDownSampleFbo->AddColorBuffer(ColorBufferObject::RGB_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR);
 
+
 	for (int i = 0; i < 2; ++ i)
 	{
@@ -928,6 +929,6 @@
 
 	// the neighbouring texels
-	float xOffs = 1.0f / fbo->GetWidth();
-	float yOffs = 1.0f / fbo->GetHeight();
+	const float xOffs = 1.0f / fbo->GetWidth();
+	const float yOffs = 1.0f / fbo->GetHeight();
 
 	sCgAntiAliasingProgram->SetTexture(0, colorsTex);
@@ -1382,9 +1383,7 @@
 	gluOrtho2D(0, 1, 0, 1);
 
-
 	glMatrixMode(GL_MODELVIEW);
 	glPushMatrix();
 	glLoadIdentity();
-
 	
 	glPushAttrib(GL_VIEWPORT_BIT);
