Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/antialiasing.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/antialiasing.cg	(revision 3168)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/antialiasing.cg	(revision 3175)
@@ -63,9 +63,12 @@
 	float4 dd; // the gradients
 
-	for (int i = 0; i < 4; ++ i)
-	{
-		dd[i] = depthVals[i * 2] + depthVals[i * 2 + 1];
-	}
+	dd[0] = depthVals[0] + depthVals[1];
+	dd[1] = depthVals[2] + depthVals[3];
+	dd[2] = depthVals[4] + depthVals[5];
+	dd[3] = depthVals[6] + depthVals[7];
 
+	//for (int i = 0; i < 4; ++ i)
+	//	dd[i] = depthVals[i * 2] + depthVals[i * 2 + 1];
+	
 	//dd = abs(2.0f * (1.0f - abs(1.0f - centerDepth / dd))) - barrier.y;
 	dd = abs(2.0f * centerDepth - dd) - barrier.y;
@@ -90,6 +93,6 @@
 
 
-	float4 col = (s0 + s1 + s2 + s3 + centerColor) * 0.2f;
-	//float4 col = (s0 + s1 + s2 + s3) * 0.25f;
+	//float4 col = (s0 + s1 + s2 + s3 + centerColor) * 0.2f;
+	float4 col = (s0 + s1 + s2 + s3) * 0.25f;
 	//float4 col = float4(ne.x, ne.x, ne.x, 0);
 	//float4 col = float4(de.x, de.x, de.x, 0);
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3172)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3175)
@@ -281,5 +281,5 @@
 		const float2 offset = samples[i];
 
-#if 0
+#if 1
 		////////////////////
 		//-- add random noise: reflect around random normal vector (rather slow!)
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.h	(revision 3167)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.h	(revision 3175)
@@ -41,4 +41,5 @@
 				DirectionalLight *light,
 				bool useToneMapping,
+				bool useAntiAliasing,
 				ShadowMap *shadowMap = NULL
 				);
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3167)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3175)
@@ -207,4 +207,5 @@
 bool renderLightView = false;
 bool useHDR = true;
+bool useAntiAliasing = true;
 
 PerfTimer frameTimer, algTimer;
@@ -233,5 +234,4 @@
 
 
-
 //DeferredRenderer::SAMPLING_METHOD samplingMethod = DeferredRenderer::SAMPLING_POISSON;
 DeferredRenderer::SAMPLING_METHOD samplingMethod = DeferredRenderer::SAMPLING_QUADRATIC;
@@ -241,5 +241,5 @@
 DeferredRenderer *deferredShader = NULL;
 
-//SceneEntity *cube = NULL;
+
 SceneEntity *buddha = NULL;
 SceneEntity *skyDome = NULL;
@@ -378,5 +378,8 @@
 		env.GetBoolParam(string("useLODs"), useLODs);
 		env.GetBoolParam(string("useHDR"), useHDR);
-
+		env.GetBoolParam(string("useAA"), useAntiAliasing);
+		env.GetBoolParam(string("useAdvancedShading"), useAdvancedShading);
+
+		env.GetIntParam(string("renderMethod"), renderMethod);
 
 		//env.GetStringParam(string("modelPath"), model_path);
@@ -396,4 +399,7 @@
 		cout << "temporal coherence: " << ssaoTempCohFactor << endl;
 		cout << "shadow size: " << shadowSize << endl;
+		cout << "render method: " << renderMethod << endl;
+		cout << "use antialiasing: " << useAntiAliasing << endl;
+		cout << "use advanced shading: " << useAdvancedShading << endl;
 
 		//cout << "model path: " << model_path << endl;
@@ -794,5 +800,5 @@
 	
 
-	const bool useToneMapping = 
+	const bool useHDRValues = 
 		((renderMethod == RENDER_DEPTH_PASS_DEFERRED) || 
 		 (renderMethod == RENDER_DEFERRED)) && useHDR;
@@ -802,5 +808,5 @@
 	Vector3 sunDiffuse;
 
-	preetham->ComputeSunColor(lightDir, sunAmbient, sunDiffuse, !useToneMapping);
+	preetham->ComputeSunColor(lightDir, sunAmbient, sunDiffuse, !useHDRValues);
 
 	ambient[0] = sunAmbient.x;
@@ -895,6 +901,5 @@
 
 
-	// draw to 3 color buffers
-	// a color, normal, and positions buffer
+	// draw to 3 render targets
 	if (sCurrentMrtSet == 0)
 	{
@@ -1024,5 +1029,6 @@
 		renderState.SetRenderTechnique(DEPTH_PASS);
 
-		if (!fbo) InitFBO(); fbo->Bind();
+		if (!fbo) InitFBO(); 
+		fbo->Bind();
 
 		glDrawBuffers(1, mrt);
@@ -1134,5 +1140,5 @@
 
 		ShadowMap *sm = showShadowMap ? shadowMap : NULL;
-		deferredShader->Render(fbo, ssaoTempCohFactor, light, useHDR, sm);
+		deferredShader->Render(fbo, ssaoTempCohFactor, light, useHDR, useAntiAliasing, sm);
 	}
 
@@ -1250,5 +1256,6 @@
 		//if (ssaoTempCohFactor > 1.0f) ssaoExpFactor = 1.0f;
 		break;
-	case '9':
+	case 'l':
+	case 'L':
 		useLODs = !useLODs;
 		SceneEntity::SetUseLODs(useLODs);
@@ -1311,6 +1318,6 @@
 		traverser->SetUseTightBounds(useTightBounds);
 		break;
-	case 'l':
-	case 'L':
+	case 'v':
+	case 'V':
 		renderLightView = !renderLightView;
 		break;
@@ -1318,4 +1325,8 @@
 	case 'H':
 		useHDR = !useHDR;
+		break;
+	case 'i':
+	case 'I':
+		useAntiAliasing = !useAntiAliasing;
 		break;
 	default:
@@ -1991,6 +2002,4 @@
 			RenderShadowMap(maxVisibleDist);
 		}
-
-		//glViewport(0, 0, texWidth, texHeight);
 		// initialize deferred rendering
 		InitDeferredRendering();
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 3168)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 3175)
@@ -498,4 +498,5 @@
 							  DirectionalLight *light,
 							  bool useToneMapping,
+							  bool useAntiAliasing,
 							  ShadowMap *shadowMap
 							  )
@@ -511,9 +512,5 @@
 	{
 		// downsample fbo buffers
-		// colors
-		//DownSample(fbo, colorBufferIdx, mDownSampleFbo, 0, sCgScaleDepthProgram);
 		PrepareSsao(fbo);
-		//DownSample(fbo, 1, mDownSampleFbo, 1, sCgDownSampleProgram); // normals
-		//DownSample(fbo, 2, mDownSampleFbo, 2, sCgDownSampleProgram); // offsets
 	}
 
@@ -544,10 +541,11 @@
 	}
 
-	// as multisampling is difficult / costly with deferred shading, 
-	// at least do some antialiasing
-	//AntiAliasing(fbo, light);
-
-	// just output the latest buffer
-	Output(fbo);
+	// multisampling is difficult / costly with deferred shading
+	// at least do some edge blurring 
+
+	if (useAntiAliasing)
+		AntiAliasing(fbo, light);
+	else
+		Output(fbo); // just output the latest buffer
 
 	glEnable(GL_LIGHTING);
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env	(revision 3169)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env	(revision 3175)
@@ -53,4 +53,6 @@
 useFullScreen=0
 
+# the used render method (forward, forward + depth pass, deferred, deferred + depth pass
+renderMethod=2
 
 #modelPath=data/city/model/
@@ -58,5 +60,5 @@
 
 ############
-# shader options
+# shader options for deferred rendering
 
 # ssao temporal coherence factor
@@ -64,2 +66,6 @@
 # tone mapping
 useHDR=0
+# use antialiasing
+useAA=1
+# use ssao / color bleeding
+useAdvancedShading=1
