Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 3225)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 3226)
@@ -7,6 +7,6 @@
 
 //#define NUM_SAMPLES 8
-//#define NUM_SAMPLES 16
-#define NUM_SAMPLES 24
+#define NUM_SAMPLES 16
+//#define NUM_SAMPLES 24
 //#define NUM_SAMPLES 48
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg	(revision 3225)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg	(revision 3226)
@@ -124,5 +124,5 @@
 
 	// get position exactly between old texel centers
-	float2 center;
+	/*float2 center;
 	center.x = (floor(IN.texCoord.x * w - .5f) + 1.0f) / w;
 	center.y = (floor(IN.texCoord.y * h - .5f) + 1.0f) / h;
@@ -137,6 +137,5 @@
 
 	const float minConvergence = min(m1, m2);
-
-	//const float convergence = minConvergence;
+	const float convergence = minConvergence;*/
 	//const float convergence = 0;
 	const float convergence = ao.y;
@@ -161,5 +160,6 @@
 	// just apply ssao if we are not in the sky
 	if (col.w < 1e10f)
-		OUT.illum_col.xyz = col.xyz * max(1e-1f, 1.0f - ao.x);
+		OUT.illum_col.xyz = col.xyz * max(2e-2f, 1.0f - ao.x);
+		//OUT.illum_col.xyz = col.xyz * ao.x;
 	else
 		OUT.illum_col.xyz = col.xyz;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3225)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3226)
@@ -225,13 +225,14 @@
 	total_ao /= numSamples;
 
-#if 1
+#if 0
 	// if surface normal perpenticular to view dir, approx. half of the samples will not count
 	// => compensate for this (on the other hand, projected sampling area could be larger!)
 	const float viewCorrection = 1.0f + VIEW_CORRECTION_SCALE * max(dot(viewDir, normal), 0.0f);
-	total_ao += cosAngle * aoContrib * viewCorrection;
+	total_ao *= viewCorrection;
 
 #endif
 
-	return float3(max(0.0f, 1.0f - total_ao), validSamples, numSamples);
+	//return float3(max(0.0f, 1.0f - total_ao), validSamples, numSamples);
+	return float3(total_ao, validSamples, numSamples);
 }
 
@@ -260,5 +261,6 @@
 			float newWeight,
 			float sampleIntensity,
-			bool isMovingObject
+			bool isMovingObject,
+			sampler2D normalTex
 			)
 {
@@ -288,4 +290,9 @@
 		
 
+		// the normal of the current sample
+		//const float3 sampleNormal = tex2Dlod(normalTex, float4(texcoord, 0, 0)).xyz;
+		// angle between current normal and direction to sample controls AO intensity.
+		//float cosAngle2 = .5f + dot(sampleNormal, -normal) * 0.5f;
+
 		////////////////
 		//-- compute contribution of sample using the direction and angle
@@ -303,4 +310,5 @@
 		//const float aoContrib = (1.0f > lengthToSample) ? occlusionPower(9e-2f, DISTANCE_SCALE + lengthToSample): .0f;
 
+		//total_ao += cosAngle2 * cosAngle * aoContrib;
 		total_ao += cosAngle * aoContrib;
 
@@ -318,5 +326,5 @@
 		validSamples = max(validSamples, (1.0f - tooFarAway) * pixelValid);
 
-#ifdef USE_GTX
+#if 1//#ifdef U//USE_GTX
 		// we can bail out early and use a minimal #samples)
 		// if some conditions are met as long as the hardware supports it
@@ -343,4 +351,5 @@
 
 	return float3(total_ao, validSamples, numSamples);
+	//return float3(max(0.0f, 1.0f - total_ao), validSamples, numSamples);
 }
 
@@ -417,5 +426,5 @@
 	if (eyeSpaceDepth < 1e10f)
 	{
-		ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), oldWeight, sampleIntensity, isMovingObject);
+		ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), oldWeight, sampleIntensity, isMovingObject, normals);
 		//ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), normals, sampleIntensity);
 	}
@@ -446,6 +455,6 @@
 		else if (ao.y > partlyResetThres)
 		{
-			//oldWeight = min(oldWeight, 4.0f * newWeight);
-			oldWeight = .0f; 
+			oldWeight = min(oldWeight, 4.0f * newWeight);
+			//oldWeight = .0f; 
 		}
 	}
@@ -458,5 +467,6 @@
 	//-- blend ao between old and new samples (and avoid division by zero)
 
-	OUT.illum_col.x = (ao.x * newWeight + oldSsao * oldWeight) / max(1e-6f, newWeight + oldWeight);
+	//OUT.illum_col.x = (ao.x * newWeight + oldSsao * oldWeight) / max(1e-6f, newWeight + oldWeight);
+	OUT.illum_col.x = (ao.x * newWeight + oldSsao * oldWeight) / (newWeight + oldWeight);
 
 	OUT.illum_col.y = combinedWeight;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg	(revision 3212)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg	(revision 3226)
@@ -315,4 +315,5 @@
 
 	const float4 difVec = tex2Dlod(diffVals, float4(IN.texCoord, 0, 0));
+	// 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 3215)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp	(revision 3226)
@@ -40,4 +40,5 @@
 { 
 	mUseNormalMapping = false;
+	mUseSpecialColors = false;
 }
 
@@ -278,4 +279,10 @@
 	}
 
+	if (mUseSpecialColors)
+	{
+		tech->mAmbientColor.r = tech->mAmbientColor.g = tech->mAmbientColor.b = 0.2f;
+		tech->mDiffuseColor.r = 0.7f; tech->mDiffuseColor.g = 0.5f; tech->mDiffuseColor.b = 0.2f;
+	}
+
 
 	///////////////
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.h	(revision 3216)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.h	(revision 3226)
@@ -62,4 +62,5 @@
 	/// giant hack: set this to true if the geometry to load has tangent data for normal mapping
 	bool mUseNormalMapping;
+	bool mUseSpecialColors;
 
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3225)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3226)
@@ -536,4 +536,6 @@
 	//resourceManager->mUseNormalMapping = false;
 
+	resourceManager->mUseSpecialColors = true;
+
 	//LoadModel("fisch.dem", dynamicObjects);
 	LoadModel("hbuddha.dem", dynamicObjects);
@@ -544,4 +546,5 @@
 
 	resourceManager->mUseNormalMapping = false;
+	resourceManager->mUseSpecialColors = false;
 
 	buddha = dynamicObjects.back();
@@ -1285,5 +1288,5 @@
 			deferredShader->SetSaveFrame("", -1);		
 
-		if (makeSnapShot) makeSnapShot = false;
+		//if (makeSnapShot) makeSnapShot = false;
 
 		ShadowMap *sm = showShadowMap ? shadowMap : NULL;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env	(revision 3225)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env	(revision 3226)
@@ -41,6 +41,12 @@
 #camDirection=1 0 0
 
-camPosition=468.025 267.591 182.478
-camDirection=0.937282 0.348573 -0
+#camPosition=468.025 267.591 182.478
+#camDirection=0.937282 0.348573 -0
+
+#camPosition=470.548 265.479 181.578
+#camDirection=-0.0383892 0.999263 -0
+
+camPosition=470.541 267.286 181.978
+camDirection=-0.100954 0.993856 -0.045363
 
 #lightDirection=-0.8f 1.0f -0.7f
@@ -51,9 +57,11 @@
 ## window options
 
-#winWidth=800
-#winHeight=600
+winWidth=800
+winHeight=600
 
-winWidth=1024
-winHeight=768
+#winWidth=1024
+#winHeight=768
+#winWidth=512
+#winHeight=384
 
 useFullScreen=0
@@ -92,5 +100,5 @@
 ssaoKernelRadius=8e-1f
 # ssao sample intensity
-ssaoSampleIntensity=0.2f
+ssaoSampleIntensity=0.1f
 # ssao temporal coherence factor
 tempCohFactor=1000.0f
