Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 3369)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 3370)
@@ -8,12 +8,12 @@
 //#define NUM_PRECOMPUTED_SAMPLES 8124
 #define NUM_PRECOMPUTED_SAMPLES 4096
-//#define NUM_PRECOMPUTED_SAMPLES 2048
+#define NUM_PRECOMPUTED_SAMPLES 64
 
 //#define NUM_SAMPLES 16
 //#define NUM_SAMPLES 24
 //#define NUM_SAMPLES 32
-#define NUM_SAMPLES 48
+#define NUM_SAMPLES 64
 
-#define MIN_SAMPLES 8
+#define MIN_SAMPLES 64
 //#define MIN_SAMPLES 48
 
@@ -74,5 +74,5 @@
 #define PERFORMANCE_TEST 1
 
-#define USE_OPTIMIZATION 1
+#define USE_OPTIMIZATION 0
 
 
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3369)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3370)
@@ -459,4 +459,5 @@
 			sampler2D colors,
 			sampler2D noiseTex,
+			float2 dummySamples[NUM_SAMPLES],
 			sampler2D samples,
 			float3 normal,
@@ -486,7 +487,6 @@
 		float2 offset;
 
-		const float2 ssaoOffset = 
-			tex2Dlod(samples, float4((0.5f + i + oldIdx) / NUM_PRECOMPUTED_SAMPLES, .5f, .0f, .0f)).xy;
-
+		//const float2 ssaoOffset = tex2Dlod(samples, float4((0.5f + i + oldIdx) / NUM_PRECOMPUTED_SAMPLES, .5f, .0f, .0f)).xy;
+		const float2 ssaoOffset = dummySamples[i];
 
 		////////////////////
@@ -494,10 +494,9 @@
 		//-- (affects performance for some reason!)
 
-		if (!USE_OPTIMIZATION ||
-			(convergence < SSAO_CONVERGENCE_THRESHOLD))
+		if (0)//!USE_OPTIMIZATION ||
+			//(convergence < SSAO_CONVERGENCE_THRESHOLD))
 		{
 			float2 mynoise = tex2Dlod(noiseTex, float4(IN.texCoord * 4.0f, 0, 0)).xy;
-			//offset = myreflect(samples[i], mynoise);
-			//offset = myrotate(samples[i], mynoise.x);
+			//offset = myreflect(samples[i], mynoise); offset = myrotate(samples[i], mynoise.x);
 			offset = myrotate(ssaoOffset, mynoise.x);
 		}
@@ -557,6 +556,6 @@
 		if ((cosAngle >= 0) && (pixelValid < 90.0f))// || (cosAngle2 >= 0))
 		{
-			//pixelValid = (distanceDiff > 1e-3f) ? 100.0f : .0f;
-			pixelValid = (distanceDiff > 1e-3f) ? 5.0f : .0f;
+			pixelValid = (distanceDiff > 1e-3f) ? 100.0f : .0f;
+			//pixelValid = (distanceDiff > 1e-3f) ? 5.0f : .0f;
 		}
 
@@ -604,4 +603,5 @@
 			uniform sampler2D noiseTex,
 			uniform sampler2D samples,
+			uniform float2 dummySamples[NUM_SAMPLES],
 			uniform sampler2D oldTex,
 			uniform float4x4 modelViewProj,
@@ -685,31 +685,21 @@
 	float3 ao;
 	//$$temp matt
-	//oldIdx = dummyIdx;
+	oldIdx = dummyIdx;
 
 	// cull background note: this should be done with the stencil buffer
 	if (eyeSpaceDepth < DEPTH_THRESHOLD)
 	{
-		if (1)
-		{
 #ifdef TRYOUT
-			ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, 
-				      radiusMult, bl, br, tl, tr, normalize(viewDir),
-					  oldWeight, sampleIntensity, isMovingObject, oldIdx);
+		ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, 
+			      radiusMult, bl, br, tl, tr, normalize(viewDir),
+			      oldWeight, sampleIntensity, isMovingObject, oldIdx);
 #else
 
-			  ao = ssao(IN, colors, noiseTex, samples,
-				      normal, eyeSpacePos.xyz, radiusMult, bl, 
-					  br, tl, tr, normalize(viewDir), 
-					  oldWeight, sampleIntensity, isMovingObject, oldIdx,
-					  attribsTex, mycolor.xyz);
+		ao = ssao(IN, colors, noiseTex, dummySamples, samples,
+			      normal, eyeSpacePos.xyz, radiusMult, bl, 
+			      br, tl, tr, normalize(viewDir), 
+			      oldWeight, sampleIntensity, isMovingObject, oldIdx,
+			      attribsTex, mycolor.xyz);
 #endif				  
-		}
-		else
-		{
-			/*ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, radiusMult, 
-			           bl, br, tl, tr, normalize(viewDir), oldWeight, sampleIntensity, 
-					   isMovingObject, normals, oldIdx);
-			*/
-		}
 	}
 	else
@@ -752,5 +742,9 @@
 
 		oldWeight = min(oldWeight, factor * NUM_SAMPLES);
-		if (newIdx >= factor * NUM_SAMPLES) {newIdx = 0; /*oldWeight = .0f;*/ }
+		if (newIdx >= factor * NUM_SAMPLES) 
+		{
+			newIdx = .0f; 
+			//oldWeight = .0f;
+		}
 
 		//combinedWeight = oldWeight;
@@ -764,8 +758,6 @@
 	//-- blend ao between old and new samples (and avoid division by zero)
 
-	OUT.illum_col.x = ao.x * newWeight + oldSsao * oldWeight;
-	OUT.illum_col.x /= (newWeight + oldWeight);
-	//OUT.illum_col.x = clamp(OUT.illum_col.x, 0, 1);
-	//OUT.illum_col.x = ao.y;
+	OUT.illum_col.x = ao.x;// * newWeight + oldSsao * oldWeight;
+	//OUT.illum_col.x /= (newWeight + oldWeight);
 
 	OUT.illum_col.y = combinedWeight;
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.cpp	(revision 3355)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.cpp	(revision 3370)
@@ -181,6 +181,6 @@
 	for (int i = 0; i < mNumSamples; ++ i)
 	{
-		//x[0] = RandomValue(0, 1); x[1] = RandomValue(0, 1);
-		mHalton->GetNext(x);
+		x[0] = RandomValue(0, 1); x[1] = RandomValue(0, 1);
+		//mHalton->GetNext(x);
 		
 		const float a = 2.0f * M_PI * x[0];
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 3367)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 3370)
@@ -516,10 +516,11 @@
 	string ssaoParams[] = 
 		{"colors", "normals", "oldTex", "noiseTex", "temporalCoherence", 
-		 "samples", "bl", "br", "tl", "tr", 
+		 "dummySamples", "samples", "bl", "br", "tl", "tr", 
 		 "modelViewProj", "oldModelViewProj", "oldEyePos", "oldbl", "oldbr", 
 		 "oldtl", "oldtr", "attribsTex", "kernelRadius", "sampleIntensity",
 	     "dummyIdx"};
 	
-	sCgSsaoProgram->AddParameters(ssaoParams, 0, 21);
+	//sCgSsaoProgram->AddParameters(ssaoParams, 0, 21);
+	sCgSsaoProgram->AddParameters(ssaoParams, 0, 22);
 	
 	string giParams[] = 
@@ -843,5 +844,6 @@
 	
 
-	if (/*mUseTemporalCoherence || */mRegenerateSamples)
+	//if (mRegenerateSamples)
+	if (1)//mUseTemporalCoherence || mRegenerateSamples)
 	{
 		mRegenerateSamples = false;
@@ -858,11 +860,19 @@
 		else
 		{
-			UpdateSampleTex(samples2, NUM_PRECOMPUTED_SAMPLES);
+			//UpdateSampleTex(samples2, NUM_PRECOMPUTED_SAMPLES);
 		}
 
+		static int dummy = 0;
+
 		//if (mSortSamples) { SortSamples(); }
-		//sCgSsaoProgram->SetArray2f(i, (float *)samples2, NUM_SAMPLES);
+		sCgSsaoProgram->SetArray2f(i, (float *)samples2 + dummy, NUM_SAMPLES);
+
+		cout << "d " << dummy << " ";
+
+		dummy = (dummy + NUM_SAMPLES) % NUM_PRECOMPUTED_SAMPLES;
 		//sCgSsaoProgram->SetArray2f(i, (float *)samples2, NUM_PRECOMPUTED_SAMPLES);
 	}
+
+	++ i;
 
 	sCgSsaoProgram->SetTexture(i, sampleTex2D);
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/MainApp.vcproj
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/MainApp.vcproj	(revision 3364)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/MainApp.vcproj	(revision 3370)
@@ -156,5 +156,5 @@
 				IgnoreAllDefaultLibraries="false"
 				IgnoreDefaultLibraryNames="LIBCMT"
-				GenerateDebugInformation="false"
+				GenerateDebugInformation="true"
 				SubSystem="1"
 				LargeAddressAware="2"
