Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 2982)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 2985)
@@ -28,5 +28,5 @@
 //#define ILLUM_INTENSITY 9e-1f;
 
-#define SSAO_MIPMAP_LEVEL 1
+#define SSAO_MIPMAP_LEVEL 0//1
 #define GI_MIPMAP_LEVEL 0//2
 
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg	(revision 2984)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg	(revision 2985)
@@ -82,9 +82,11 @@
 	
 	OUT.color = col;
-	
+
+OUT.color.w = color.w;
+
 
 	////////////
 	//-- write out logaritmic luminance for tone mapping
-
+/*
 	float4 oldColor = tex2Dlod(colors, float4(IN.texCoord.xy, 0, MAX_LOD_LEVEL));
 
@@ -101,5 +103,5 @@
 	else
 		OUT.color.w = logLumScaled;
-
+*/
 	return OUT;
 }
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 2982)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 2985)
@@ -36,11 +36,12 @@
 */
 float2 ssao(fragment IN,
-		   uniform sampler2D positions,
+		   uniform sampler2D colors,
 		   uniform sampler2D noiseTexture,
 		   uniform float2 samples[NUM_SAMPLES],
 		   uniform float3 currentNormal,
 		   uniform float4 centerPosition,
-		   uniform float scaleFactor
-		   //,uniform float3 currentViewDir
+		   uniform float scaleFactor,
+		   uniform float3 viewDir,
+		   uniform float3 eyePos
 		   )
 {
@@ -59,4 +60,5 @@
 		////////////////////
 		// add random noise: reflect around random normal vector (warning: slow!)
+
 		float2 mynoise = tex2D(noiseTexture, IN.texCoord.xy).xy;
 		const float2 offsetTransformed = myreflect(offset, mynoise);
@@ -71,6 +73,8 @@
 
 		// sample downsampled texture in order to speed up texture accesses
-		float3 sample_position = tex2Dlod(positions, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).xyz;
-		//float3 sample_position = tex2D(positions, texcoord).xyz;
+		float eyeSpaceDepth = tex2Dlod(colors, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).w;
+
+		float3 sample_position = eyePos - viewDir * eyeSpaceDepth; 
+		
 
 		float3 vector_to_sample = sample_position - centerPosition.xyz;
@@ -112,5 +116,6 @@
 		   const uniform float4x4 oldModelViewProj,
 		   uniform float maxDepth,
-		   uniform float temporalCoherence
+		   uniform float temporalCoherence,
+		   uniform float3 eyePos
 		   )
 {
@@ -129,5 +134,8 @@
 	const float currentDepth = centerPosition.w;
 
-	const float2 ao = ssao(IN, positions, noiseTexture, samples, normal, centerPosition, w);//, viewDir);
+	/// the current view direction
+	float3 viewDir = normalize(IN.view);
+
+	const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition, w, viewDir, eyePos);
 		
 
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 2984)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 2985)
@@ -963,4 +963,5 @@
 		glDrawBuffers(3, mrt2);
 	}
+
 	sCurrentMrtSet = 1 - sCurrentMrtSet;
 }
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 2984)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 2985)
@@ -53,4 +53,5 @@
 static CGparameter sModelViewProjMatrixParam;
 static CGparameter sMaxDepthParam;
+static CGparameter sEyePosParam;
 static CGparameter sSamplesParam; 
 static CGparameter sOldTexParam;
@@ -340,4 +341,5 @@
 		sPositionsTexParam = cgGetNamedParameter(sCgSsaoProgram, "positions");  
 		sColorsTexParam = cgGetNamedParameter(sCgSsaoProgram, "colors");  
+		sEyePosParam = cgGetNamedParameter(sCgSsaoProgram, "eyePos");
 		sNormalsTexParam = cgGetNamedParameter(sCgSsaoProgram, "normals");  
 		sNoiseTexParam = cgGetNamedParameter(sCgSsaoProgram, "noiseTexture");
@@ -664,4 +666,7 @@
 	
 	cgGLSetParameter1f(sMaxDepthParam, mScaleFactor);
+
+	Vector3 pos = mCamera->GetPosition();
+	cgGLSetParameter3f(sEyePosParam, pos.x, pos.y, pos.z);
 	
 	cgGLSetParameter1f(sTemporalCoherenceParam, (mUseTemporalCoherence && !mRegenerateSamples) ? tempCohFactor : 0);
