Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/depthOfField.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/depthOfField.cg	(revision 3235)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/depthOfField.cg	(revision 3364)
@@ -20,5 +20,6 @@
 
 	const float dist = abs(zFocus - color.w);
-	const float blur = scale * m * focalLen * dist / (sceneRange * (1e-6f + abs(color.w + dist * step(0, zFocus - color.w))));
+	const float blur = scale * m * focalLen * 
+		dist / (sceneRange * (1e-6f + abs(color.w + dist * step(0, zFocus - color.w))));
 	
 	//float blur = saturate(blur * scale / maxCoC);
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3362)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3364)
@@ -538,5 +538,4 @@
 
 		total_ao += max(cosAngle, .0f) * aoContrib;
-
 		++ numSamples;
 
@@ -548,5 +547,5 @@
 		// they possibly have any influence on the ao
 
-		if (cosAngle > 0)
+		if (1)//cosAngle > 0)
 		{
 			float pixelValid = sampleColor.x;
@@ -555,5 +554,6 @@
 			{
 				const float3 sampleDiffVec = tex2Dlod(attribsTex, float4(texcoord, .0f, .0f)).xyz;
-				pixelValid = max(pixelValid, length(sampleDiffVec - diffVec) < 5e-3f ? .0f : 10.0f);
+				//pixelValid = max(pixelValid, length(sampleDiffVec - diffVec) < 5e-3f ? .0f : 100.0f);
+				//pixelValid = max(pixelValid, length(sampleDiffVec - diffVec) < 5e-3f ? .0f : 4.0f);
 				//pixelValid = length(sampleDiffVec - diffVec) < 1e-3f ? .0f : 10.0f;
 			}
@@ -755,5 +755,5 @@
 			//if (oldIdx >= factor * newWeight) oldIdx = 0;
 			oldWeight = min(oldWeight, factor * newWeight);
-			oldWeight = oldIdx = .0f; 
+			//oldWeight = oldIdx = .0f; 
 		}
 	}
@@ -771,5 +771,5 @@
 	const float combinedWeight = clamp(newWeight + oldWeight, .0f, temporalCoherence);
 
-	OUT.illum_col.y = combinedWeight;
+	OUT.illum_col.y = ao.y;//combinedWeight;
 	OUT.illum_col.z = oldIdx + newWeight; // the new index
 	OUT.illum_col.w = eyeSpaceDepth;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg	(revision 3363)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg	(revision 3364)
@@ -235,6 +235,6 @@
 	pixel OUT;
 
-	float4 col = tex2Dlod(colorsTex, float4(IN.texCoord, 0, 0));
-	float4 ao = tex2Dlod(ssaoTex, float4(IN.texCoord, 0, 0));
+	float4 col = tex2Dlod(colorsTex, float4(IN.texCoord, .0f, .0f));
+	float4 ao = tex2Dlod(ssaoTex, float4(IN.texCoord, .0f, .0f));
 
 	const float depth = col.w;
@@ -252,5 +252,7 @@
 	{
 		// 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);
 	}
 
@@ -274,4 +276,5 @@
 	//OUT.illum_col.xyz = float3(ao.z * 1e-3f);
 	//OUT.illum_col.xyz = float3(ao.y * 1e-3f);
+	OUT.illum_col.xyz = float3(ao.y);
 	//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 3362)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg	(revision 3364)
@@ -39,6 +39,6 @@
 	float4 outColor;
 
+#if 0
 	// hack: prevent to shade the sky
-#if 0
 	if (color.w > DEPTH_THRESHOLD)
 	{
@@ -47,5 +47,5 @@
 	else 
 	{
-		if (useAO > 0.5f)
+		if (useAO > .5f)
 			outColor = (ambient * ao + diffuse) * color;
 		else
@@ -250,5 +250,5 @@
 
 	// compute position from old frame for dynamic objects + translational portion
-	const float3 translatedPos = difVec - oldEyePos + worldPos.xyz;
+	const float3 translatedPos = -oldEyePos + worldPos.xyz + difVec;
 	// don't use difVec here: want to detect if the actual pixel has changed => ssao changed
 	//const float3 translatedPos = -oldEyePos + worldPos.xyz;
@@ -293,5 +293,6 @@
 	// means that we only use slight temporal coherence over some frames
 	// so that there is no noticeable drag
-	const float pixelCouldBeValid = 4.0f;
+	//const float pixelCouldBeValid = 4.0f;
+	const float pixelCouldBeValid = 100.0f;
 	// this pixel information has to be discarded in order to not create artifacts
 	const float pixelIsNotValid = 100.0f;
@@ -305,5 +306,5 @@
 		isPixelValid = pixelIsNotValid;
 	}
-	else if ( // check if changed from dynamic to not dynamic object
+	else if (// check if changed from dynamic to not dynamic object
    	         (
 			 // (oldDynamic && !newDynamic) || (!oldDynamic && newDynamic) ||
@@ -321,10 +322,11 @@
 	}
 	
+	isPixelValid = depthDif;
+
 	return float2(isPixelValid, abs(oldEyeSpaceDepth - projectedEyeSpaceDepth));
 }
 
 
-/** This function is called during downsampling of the buffers
-	for ssao.
+/** This function is called during downsampling of the buffers for ssao.
 */
 pixel PrepareSsao(fragment IN,
@@ -349,5 +351,5 @@
 	color.w /= length(IN.view);
 
-	const float4 difVec = tex2Dlod(diffVals, float4(IN.texCoord, 0, 0));
+	const float4 difVec = tex2Dlod(diffVals, float4(IN.texCoord, .0f, .0f));
 	// normalize normal once more because of bilinear interpolation
 	const float3 normal = normalize(tex2Dlod(normalsTex, float4(IN.texCoord, 0, 0)).xyz);
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp	(revision 3359)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp	(revision 3364)
@@ -234,4 +234,6 @@
 	for (int i = 0; i < numShapes; ++ i)
 	{
+		if (i && (i % 1000 == 0)) cout << "loaded " << i << " shapes" << endl;
+
 		Geometry *geom = LoadGeometry(str);
 		Material *mat = LoadMaterial(str);
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/MainApp.vcproj
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/MainApp.vcproj	(revision 3361)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/MainApp.vcproj	(revision 3364)
@@ -156,5 +156,5 @@
 				IgnoreAllDefaultLibraries="false"
 				IgnoreDefaultLibraryNames="LIBCMT"
-				GenerateDebugInformation="true"
+				GenerateDebugInformation="false"
 				SubSystem="1"
 				LargeAddressAware="2"
