Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg	(revision 3196)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg	(revision 3197)
@@ -296,5 +296,4 @@
 	pixel pix;
 
-	const float3 normal = normalize(tex2Dlod(normalsTex, float4(IN.texCoord, 0 ,0)).xyz);
 	const float3 difVec = tex2Dlod(diffVals, float4(IN.texCoord, 0 ,0)).xyz;
 
@@ -303,7 +302,7 @@
 
 	
-	float4 dummy;
-	//const float xoffs = .5f / 1024.0f; const float yoffs = .5f / 768.0f;
-	const float xoffs = 1.0f / 1024.0f; const float yoffs = 1.0f / 768.0f;
+	/*float4 dummy;
+	const float xoffs = .5f / 1024.0f; const float yoffs = .5f / 768.0f;
+	//const float xoffs = 1.0f / 1024.0f; const float yoffs = 1.0f / 768.0f;
 
 	dummy.x = tex2Dlod(colorsTex, float4(IN.texCoord + float2(xoffs, yoffs), 0, 0)).w;
@@ -311,7 +310,26 @@
 	dummy.z = tex2Dlod(colorsTex, float4(IN.texCoord + float2(-xoffs, yoffs), 0, 0)).w;
 	dummy.w = tex2Dlod(colorsTex, float4(IN.texCoord + float2(-yoffs, -yoffs), 0, 0)).w;
-	//color.w = min(min(dummy.x, dummy.y), min(dummy.z, dummy.w));
+	color.w = min(min(dummy.x, dummy.y), min(dummy.z, dummy.w));
 	//color.w = max(max(dummy.x, dummy.y), max(dummy.z, dummy.w));
-	
+	*/
+	
+	//const float3 normal = normalize(tex2Dlod(normalsTex, float4(IN.texCoord, 0 ,0)).xyz);
+
+	float3 dummy[4];
+	const float xoffs = .5f / 1024.0f; const float yoffs = .5f / 768.0f;
+	//const float xoffs = 1.0f / 1024.0f; const float yoffs = 1.0f / 768.0f;
+
+	dummy[0] = tex2Dlod(normalsTex, float4(IN.texCoord + float2(xoffs, yoffs), 0, 0)).xyz;
+	dummy[1] = tex2Dlod(normalsTex, float4(IN.texCoord + float2(xoffs, -yoffs), 0, 0)).xyz;
+	dummy[2] = tex2Dlod(normalsTex, float4(IN.texCoord + float2(-xoffs, yoffs), 0, 0)).xyz;
+	dummy[3] = tex2Dlod(normalsTex, float4(IN.texCoord + float2(-yoffs, -yoffs), 0, 0)).xyz;
+	
+	float dot1 = dot(dummy[0], dummy[3]);
+	float dot2 = dot(dummy[1], dummy[2]);
+
+	float isEdge = step(.0f, dot1) * step(.0f, dot2);
+
+	const float3 normal = isEdge * normalize(dummy[0] + dummy[1] + dummy[2] + dummy[3]);
+
 	// store scaled view vector so wie don't have to normalize for e.g., ssao
 	color.w /= length(IN.view);
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg	(revision 3196)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg	(revision 3197)
@@ -213,5 +213,5 @@
 
 		// the filtered ssao value
-		ao.x = DiscontinuityFilter2(IN.texCoord, ao, col, ssaoTex, normalsTex, colorsTex, filterOffs, scale, bl, br, tl, tr);
+		//ao.x = DiscontinuityFilter2(IN.texCoord, ao, col, ssaoTex, normalsTex, colorsTex, filterOffs, scale, bl, br, tl, tr);
 	}
 
@@ -221,4 +221,6 @@
 		OUT.illum_col.xyz = col.xyz;
 
+	//OUT.illum_col.xyz = float3(0, clamp(1.0f - ao.y * 1e-3f, 0, 1), 1);
+	//const float mydummy = ao.w * 1e-3f;
 	OUT.illum_col.xyz = float3(ao.x, ao.x, ao.x);
 	//OUT.illum_col.xyz = float3(0, clamp(1.0f - ao.y * 1e-3f, 0, 1), 1);
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3196)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3197)
@@ -283,5 +283,5 @@
 		const float2 texcoord = IN.texCoord.xy + offsetTransformed * scaleFactor;
 
-		float4 sampleColor = tex2Dlod(colors, float4(texcoord, 0, 0));
+		const float4 sampleColor = tex2Dlod(colors, float4(texcoord, 0, 0));
 		const float3 samplePos = ReconstructSamplePos(sampleColor.w, texcoord, bl, br, tl, tr);
 		
@@ -291,5 +291,8 @@
 
 		float3 dirSample = samplePos - centerPosition;
-		const float lengthToSample = max(length(dirSample), 1e-6f);
+
+		const float sqrLen = max(SqrLen(dirSample), 1e-3f);
+		//const float lengthToSample = max(length(dirSample), 1e-2f);
+		const float lengthToSample = sqrt(sqrLen);
 
 		dirSample /= lengthToSample; // normalize
@@ -301,5 +304,5 @@
 		// the distance to a sample approaches zero
 		//const float aoContrib = SAMPLE_INTENSITY / (DISTANCE_SCALE + lengthToSample * lengthToSample);
-		const float aoContrib = SAMPLE_INTENSITY / max(1e-1f, lengthToSample * lengthToSample);
+		const float aoContrib = SAMPLE_INTENSITY / sqrLen;
 		//const float aoContrib = (1.0f > lengthToSample) ? occlusionPower(9e-2f, DISTANCE_SCALE + lengthToSample): .0f;
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3194)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3197)
@@ -591,5 +591,6 @@
 	fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR, ColorBufferObject::FILTER_NEAREST);
 	// the normals buffer
-	fbo->AddColorBuffer(ColorBufferObject::RGB_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST);
+	//fbo->AddColorBuffer(ColorBufferObject::RGB_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST);
+	fbo->AddColorBuffer(ColorBufferObject::RGB_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR);
 	// a rgb buffer which could hold material properties
 	//fbo->AddColorBuffer(ColorBufferObject::RGB_UBYTE, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST);
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 3195)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 3197)
@@ -315,7 +315,9 @@
 	mDownSampleFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR);
 	// downsample buffer for the normal texture
-	mDownSampleFbo->AddColorBuffer(ColorBufferObject::RGB_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR);
+	//mDownSampleFbo->AddColorBuffer(ColorBufferObject::RGB_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR);
+	mDownSampleFbo->AddColorBuffer(ColorBufferObject::RGB_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST);
 	// downsample buffer for the offset texture
-	mDownSampleFbo->AddColorBuffer(ColorBufferObject::RGB_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR);
+	//mDownSampleFbo->AddColorBuffer(ColorBufferObject::RGB_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR);
+	mDownSampleFbo->AddColorBuffer(ColorBufferObject::RGB_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST);
 
 	for (int i = 0; i < 3; ++ i)
