Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg	(revision 3299)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg	(revision 3301)
@@ -184,6 +184,5 @@
 
 /** Function combining image and indirect illumination buffer using a 
-	depth and normal aware discontinuity filter. We assume that 
-	we are using half resolution ssao for this version of the combineSsao
+	depth and normal aware discontinuity filter.
 */
 pixel CombineSsaoFullRes(fragment IN, 
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.h
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.h	(revision 3296)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.h	(revision 3301)
@@ -168,5 +168,5 @@
 	void DepthOfField(FrameBufferObject *fbo);
 
-	void CombineSsao2(FrameBufferObject *fbo);
+	void FilterSsao(FrameBufferObject *fbo);
 
 
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 3300)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 3301)
@@ -57,4 +57,5 @@
 
 static ShaderProgram *sCgCombineSsaoProgram = NULL;
+static ShaderProgram *sCgFilterSsaoProgram = NULL;
 static ShaderProgram *sCgCombineIllumProgram = NULL;
 static ShaderProgram *sCgLogLumProgram = NULL;
@@ -326,6 +327,8 @@
 	}
 
+	///////
+	//-- the illumination fbo is either half size or full size
+
 	mIllumFbo = new FrameBufferObject(downSampledWidth, downSampledHeight, FrameBufferObject::DEPTH_NONE);
-	//mIllumFbo = new FrameBufferObject(w, h, FrameBufferObject::DEPTH_NONE);
 
 	mFBOs.push_back(mIllumFbo);
@@ -359,6 +362,5 @@
 	// for performance reasons we use a smaller texture and repeat it over the screen
 	CreateNoiseTex2D(mIllumFbo->GetWidth() / 4, mIllumFbo->GetWidth() / 4);
-	//CreateNoiseTex2D(mIllumFbo->GetWidth(), mIllumFbo->GetWidth());
-	
+		
 	mProjViewMatrix = IdentityMatrix();
 	mOldProjViewMatrix = IdentityMatrix();
@@ -397,4 +399,5 @@
 	//sCgCombineSsaoProgram = sm->CreateFragmentProgram("combineSsao", "CombineSsaoHalfRes", "CombineSsao");
 	sCgCombineSsaoProgram = sm->CreateFragmentProgram("combineSsaoSep", "CombineSsaoFullRes", "CombineSsao");
+	sCgFilterSsaoProgram = sm->CreateFragmentProgram("combineSsaoSep", "FilterSsaoFullRes", "FilterSsao");
 	sCgAntiAliasingProgram = sm->CreateFragmentProgram("antialiasing", "main", "AntiAliasing");
 	sCgToneProgram = sm->CreateFragmentProgram("tonemap", "ToneMap", "ToneMap");
@@ -454,4 +457,12 @@
 	sCgCombineSsaoProgram->AddParameters(combineSsaoParams, 0, 7);
 
+	
+	////////////////
+
+	string filterSsaoParams[] = 
+		{"colorsTex", "ssaoTex", "bl", "br", "tl", "tr", "xyStep"};
+
+	sCgFilterSsaoProgram->AddParameters(filterSsaoParams, 0, 7);
+
 
 	//////////////
@@ -572,4 +583,5 @@
 	case SSAO:
 		ComputeSsao(fbo, mTempCohFactor);
+		FilterSsao(fbo);
 		CombineSsao(fbo);
 		break;
@@ -1027,9 +1039,37 @@
 
 
-void DeferredRenderer::CombineSsao(FrameBufferObject *fbo)
+void DeferredRenderer::FilterSsao(FrameBufferObject *fbo)
 {
 	GLuint colorsTex = fbo->GetColorBuffer(colorBufferIdx)->GetTexture();
 	GLuint normalsTex = fbo->GetColorBuffer(1)->GetTexture();
 	GLuint ssaoTex = mIllumFbo->GetColorBuffer(mIllumFboIndex)->GetTexture();
+	
+	mIllumFbo->Bind();
+	glDrawBuffers(1, mrt + mIllumFboIndex + 1);
+	
+
+	int i = 0;
+
+	sCgFilterSsaoProgram->SetTexture(i ++, colorsTex);
+	sCgFilterSsaoProgram->SetTexture(i ++, ssaoTex);
+
+	for (int j = 0; j < 4; ++ j, ++ i)
+	{
+		sCgFilterSsaoProgram->SetValue3f(i, mCornersView[j].x, mCornersView[j].y, mCornersView[j].z);
+	}
+
+	sCgFilterSsaoProgram->SetValue2f(i ++, 1.0f / (float)mWidth, 0);
+
+	DrawQuad(sCgFilterSsaoProgram);
+	
+	PrintGLerror("combine ssao");
+}
+
+
+void DeferredRenderer::CombineSsao(FrameBufferObject *fbo)
+{
+	GLuint colorsTex = fbo->GetColorBuffer(colorBufferIdx)->GetTexture();
+	GLuint normalsTex = fbo->GetColorBuffer(1)->GetTexture();
+	GLuint ssaoTex = mIllumFbo->GetColorBuffer(mIllumFboIndex + 1)->GetTexture();
 	
 	FlipFbos(fbo);
@@ -1053,39 +1093,5 @@
 
 	//sCgCombineSsaoProgram->SetValue2f(i ++, 1.0f / (float)mWidth, 1.0f / (float)mHeight);
-	sCgCombineSsaoProgram->SetValue2f(i ++, 1.0f / (float)mWidth, 0);
-
-	DrawQuad(sCgCombineSsaoProgram);
-	
-	PrintGLerror("combine ssao");
-}
-
-
-void DeferredRenderer::CombineSsao2(FrameBufferObject *fbo)
-{
-	GLuint colorsTex = fbo->GetColorBuffer(colorBufferIdx)->GetTexture();
-	GLuint normalsTex = fbo->GetColorBuffer(1)->GetTexture();
-	GLuint ssaoTex = mIllumFbo->GetColorBuffer(mIllumFboIndex)->GetTexture();
-	
-	FlipFbos(fbo);
-
-	int i = 0;
-
-	sCgCombineSsaoProgram->SetTexture(i ++, colorsTex);
-	sCgCombineSsaoProgram->SetTexture(i ++, normalsTex);
-	sCgCombineSsaoProgram->SetTexture(i ++, ssaoTex);
-
-	sCgCombineSsaoProgram->SetArray2f(i ++, (float *)ssaoFilterOffsets, NUM_SSAO_FILTER_SAMPLES);
-	sCgCombineSsaoProgram->SetArray1f(i ++, (float *)ssaoFilterWeights, NUM_SSAO_FILTER_SAMPLES);
-	sCgCombineSsaoProgram->SetValue1f(i ++, mSsaoFilterRadius);
-
-	sCgCombineSsaoProgram->SetMatrix(i++, mProjViewMatrix);
-
-	for (int j = 0; j < 4; ++ j, ++ i)
-	{
-		sCgCombineSsaoProgram->SetValue3f(i, mCornersView[j].x, mCornersView[j].y, mCornersView[j].z);
-	}
-
-	sCgCombineSsaoProgram->SetValue1f(i ++, mIllumFbo->GetColorBuffer(mIllumFboIndex)->GetWidth());
-	sCgCombineSsaoProgram->SetValue1f(i ++, mIllumFbo->GetColorBuffer(mIllumFboIndex)->GetHeight());
+	sCgCombineSsaoProgram->SetValue2f(i ++, 0, 1.0f / (float)mHeight);
 
 	DrawQuad(sCgCombineSsaoProgram);
