Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 2892)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 2898)
@@ -8,6 +8,7 @@
 //#define SAMPLE_INTENSITY 0.14f
 #define SAMPLE_INTENSITY 0.28f
+//#define SAMPLE_INTENSITY 0.9f
 
-//#define AREA_SIZE 50e-1f
+//#define AREA_SIZE 20e-1f
 #define AREA_SIZE 5e-1f
 
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 2897)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 2898)
@@ -194,7 +194,6 @@
 
 	OUT.illum_col = col * ao.x;
-	//OUT.illum_col = ao;
-
-	//OUT.illum_col.z = ao.z;
+	//OUT.illum_col = (float4)ao.x;
+
 	OUT.illum_col.w = ao.w;
 
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.cpp	(revision 2873)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.cpp	(revision 2898)
@@ -87,2 +87,33 @@
 	//cout << "minDist after= " << minDist << endl;
 }
+
+
+
+GaussianSampleGenerator::GaussianSampleGenerator(int numSamples, float radius):
+SampleGenerator(numSamples, radius)
+{}
+
+
+void GaussianSampleGenerator::Generate(Sample2 *samples) const
+{
+	static HaltonSequence halton;
+	float r[2];
+
+	const float sigma = mRadius;
+
+	const float p0 = 1.0f / (sigma * sqrt(2.0f * M_PI));
+	const float p1 = 1.0f / (sigma * sqrt(2.0f * M_PI));
+
+	for (int i = 0; i < mNumSamples; ++ i)
+	{
+		halton.GetNext(2, r);
+
+		float exp_x = -(r[0] * r[0]) / (2.0f * sigma * sigma);
+		float exp_y = -(r[1] * r[1]) / (2.0f * sigma * sigma);
+
+		samples[i].x = p0 * pow(M_E, exp_x);
+		samples[i].y = p1 * pow(M_E, exp_y);
+	}
+
+	//cout << "minDist after= " << minDist << endl;
+}
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.h
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.h	(revision 2886)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.h	(revision 2898)
@@ -42,3 +42,14 @@
 };
 
+
+class GaussianSampleGenerator: public SampleGenerator
+{
+public:
+	
+	GaussianSampleGenerator(int numSamples, float radius);
+
+	virtual void Generate(Sample2 *samples) const;
+};
+
+
 #endif
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 2897)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 2898)
@@ -130,26 +130,6 @@
 	case DeferredRenderer::GAUSS:
 		{
-			const float radius = 1.0f;
-			const float sigma = 0.25f;//ComputeSigmaFromRadius(1.0f);
-
-			static HaltonSequence halton;
-
-			for (int i = 0; i < NUM_SAMPLES; ++ i)
-			{
-				Sample2 s;
-				Vector3 input;
-
-				halton.GetNext(3, (float *)&input.x);
-
-				//GaussianOn2D(cinput, // input (RND in interval [0-1)x[0-1))
-				//	         sigma,            // standard deviation of gaussian distribution
-				//			 outputVec)   // resulting vector according to gaussian distr.
-
-				PolarGaussianOnDisk(input,  // input (RND in interval [0-1)x[0-1))
-					sigma,  // standard deviation of gaussian distribution
-					radius, // standard deviation of gaussian distribution
-					s);     // result
-				samples[i] = s;
-			}
+			static GaussianSampleGenerator gauss(NUM_SAMPLES, 0.5f);
+			gauss.Generate((Sample2 *)samples);
 		}
 		break;
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/common.h
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/common.h	(revision 2879)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/common.h	(revision 2898)
@@ -61,6 +61,7 @@
 #include <values.h>
 #else // __WATCOMC__
-#define M_PI        3.14159265358979323846F
-#define MAXFLOAT    3.40282347e+37F
+#define M_PI 3.14159265358979323846F
+#define M_E 2.71828182845904523536F
+#define MAXFLOAT 3.40282347e+37F
 #endif // __WATCOMC__
 
Index: P/trunk/App/Demos/Vis/FriendlyCulling/src/RndGauss.h
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RndGauss.h	(revision 2892)
+++ 	(revision )
@@ -1,142 +1,0 @@
-// ===================================================================
-// $Id:$
-//
-// rndgauss.h:
-//     A set of functions to generate random numbers according to
-//     bivariate normal (=Gaussian) distribution + special distribution
-//     on disk combining it with bivariate normal distribution
-//
-// Initial coding by Vlastimil Havran, January 2007
-
-#ifndef __RNDGAUSS_H__
-#define __RNDGAUSS_H__
-
-#include "SampleGenerator.h"
-#include "Vector3.h"
-
-#include <assert.h>
-
-
-namespace CHCDemoEngine 
-{ 
-// Function: GaussianOn2D
-// Here we generate the Gaussian distribution on the 2D domain
-// (=bivariate normal distribution) given the uniformly distributed random
-// numbers in the range [0-1)x[0-1) (bivariate uniform distribution).
-// We specify also standard deviation (sigma) of the normal distribution.
-// The result has a mean value <0.0f, 0.0f>. We use Box-Muller transform
-// in polar form.
-// Please note that in the distance from mean value this is true:
-// the distance = 1 x sigma ... we have 68.25% of generated points
-//              = 2 x sigma ... we have 95.45% of generated points
-//              = 3 x sigma ... we have 99.73% of generated points
-//              = 4 x sigma ... we have 99.99% of generated points
-
-inline void
-GaussianOn2D(const Sample2 &input, // input (RND in interval [0-1)x[0-1))
-			 float sigma,            // standard deviation of gaussian distribution
-			 Sample2 &outputVec)   // resulting vector according to gaussian distr.
-{
-  // Handling zero
-  float xf = input.x;
-  if (xf < 1e-20f)
-    xf = 1e-20f;
-  assert( xf <= 1.0f);
-  assert( (input.y >= 0.f) && (input.y <= 1.0f));
-
-  // Here we have to use natural logarithm function !
-  float t = -2.0f * log(xf);
-  assert(t > 0.f);
-  t = sigma * sqrt(t);
-  float phi = 2.0f * M_PI * input.y;
-  outputVec.x = t * cos(phi);
-  outputVec.y = t * sin(phi);
-
-  return;
-}
-
-// Function: PolarGaussianOnDisk
-// Here we generate the Gaussian distribution on the 2D domain on the part
-// of 2D disk. The input of the function is tuple of random
-// numbers in the range [0-1)x[0-1) (bivariate uniform distribution).
-// The result of this function 'outputVec' (in general in the range
-// [-infinity,+infinity]x[-infinity,+infinity], so the point generated
-// according to proposed distribution. The algorithm does not use rejection
-// sampling. We have to specify the radius of 2D circle
-// where the distribution mean value is zero for one variable !!!!
-// Sigma is specified independently, but if you want to have small probability
-// of generating the original point, then consider:
-// the radius = 1 x sigma ... 68.25% points in the distance from sigma from the circle
-//            = 2 x sigma ... 95.45% points in the distance from sigma from the circle
-//            = 3 x sigma ... 99.73% points in the distance from sigma from the circle
-//            = 4 x sigma ... 99.99% points in the distance from sigma from the circle
-// Recommendation: use sigma = radius/3.3f or so (according to visualization)
-
-// This is only helper function
-inline float
-ComputeSigmaFromRadius(float radius)
-{
-  // For standard deviation = 3 we have achieve probability 0.4% that the proximity
-  // of the center of the circle will be covered again by a generated point.
-  return radius / 3.3f;
-}
-
-inline void
-PolarGaussianOnDisk(const Vector3 &input, // input (RND in interval [0-1)x[0-1))
-					float sigma,    // standard deviation of gaussian distribution
-					float radius,   // standard deviation of gaussian distribution
-					Sample2 &outputVec) // result
-{
-  // Handling zero
-  float xf = input.x;
-  if (xf < 1e-20f)
-    xf = 1e-20f;
-  assert( xf <= 1.0f);
-  assert( (input.y >= 0.f) && (input.y <= 1.0f));
-
-  // Here we have to use natural logarithm function !
-  float t = -2.0f * log(xf);
-  assert(t > 0.f);
-  t = sigma * sqrt(t);
-  float phi = 2.0f * M_PI * input.y;
-
-#if 1
-  // This is what Jiri Bittner wanted originally,
-  // another idea how to implement this distribution
-  // First, we generate point as for standard polar
-  // inmplementation
-  outputVec.x = t * cos(phi);
-  outputVec.y = t * sin(phi);
-
-  // Then we generate a point on 2D circle at the distance
-  // of radius
-  float r = input.z; //RND::rand01f();
-  float phi2 = 2.0f * M_PI * r;
-
-  Sample2 c(cos(phi2),sin(phi2));
-  
-  outputVec.x += radius * c.x;
-  outputVec.y += radius * c.y;
-
-#endif
-#if 0
-  // This is what Jiri Bittner wanted originally
-  // however, I cannot make it running correctly !!!
-  // Do not use it at the moment !!! VH 11/1/2007
-  float r = RND::rand01f();  
-  if (r < 0.5f) {
-    outputVec.x = (radius + t) * cos(phi);
-    outputVec.y = (radius + t) * sin(phi);
-  }
-  else {
-    // going inside the cirle
-    outputVec.x = (radius - t) * cos(phi);
-    outputVec.y = (radius - t) * sin(phi);    
-  }
-#endif
-  
-  return;
-}
-
-}
-#endif // __RND_H__
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj	(revision 2896)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj	(revision 2898)
@@ -284,8 +284,4 @@
 			</File>
 			<File
-				RelativePath=".\src\RndGauss.h"
-				>
-			</File>
-			<File
 				RelativePath=".\src\SampleGenerator.cpp"
 				>
