Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 2886)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 2886)
@@ -0,0 +1,22 @@
+#ifndef __SHADERENV_H
+#define __SHADERENV_H
+
+#define NUM_SAMPLES 8
+//#define NUM_SAMPLES 16
+
+// rule of thumb: approx 1 / NUM_SAMPLES
+//#define SAMPLE_INTENSITY 0.15f
+#define SAMPLE_INTENSITY 0.25f
+
+#define AREA_SIZE 5e-1f
+//#define AREA_SIZE 3e-1f
+
+#define VIEW_CORRECTION_SCALE 0.0f
+//#define VIEW_CORRECTION_SCALE 0.1f
+
+#define DISTANCE_SCALE 1e-6f
+
+#define ILLUM_INTENSITY 5e-1f;
+
+
+#endif // __SHADERENV_H
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 2885)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 2886)
@@ -28,4 +28,5 @@
 	// reflect around plane
 	float2 rpt = pt - d * 2.0f * n;
+
 	return rpt;
 }
@@ -178,4 +179,5 @@
 
 	OUT.illum_col = col * ao.x;
+	//OUT.illum_col = ao;
 	OUT.illum_col.w = ao.w;
 
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.cpp	(revision 2884)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.cpp	(revision 2886)
@@ -6,4 +6,6 @@
 #include "Camera.h"
 #include "shaderenv.h"
+#include "RndGauss.h"
+#include "Halton.h"
 
 
@@ -11,4 +13,5 @@
 
 static GLenum mymrt[] = {GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_COLOR_ATTACHMENT2_EXT, GL_COLOR_ATTACHMENT3_EXT};
+
 
 namespace CHCDemoEngine
@@ -103,6 +106,28 @@
 static void GenerateSamples()
 {
+#if 0
 	static PoissonDiscSampleGenerator poisson(NUM_SAMPLES, 1.0f);
 	poisson.Generate((Sample2 *)samples);
+#else
+	
+	const float radius = 1.0f;
+	const float sigma = ComputeSigmaFromRadius(1.0f);
+	
+	static HaltonSequence halton;
+
+	for (int i = 0; i < NUM_SAMPLES; ++ i)
+	{
+		Sample2 s;
+		Vector3 input;
+
+		halton.GetNext(3, (float *)&input.x);
+
+		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;
+	}
+#endif
 }
 
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.h
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.h	(revision 2853)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.h	(revision 2886)
@@ -8,4 +8,7 @@
 struct Sample2
 {
+	Sample2() {}
+	Sample2(float _x, float _y): x(_x), y(_y) {}
+
 	float x; 
 	float y;
@@ -33,4 +36,5 @@
 {
 public:
+	
 	PoissonDiscSampleGenerator(int numSamples, float radius);
 
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.h
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.h	(revision 2880)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.h	(revision 2886)
@@ -83,3 +83,4 @@
 
 } // namespace 
+
 #endif // _SsaoShader_H__
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RndGauss.h
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RndGauss.h	(revision 2886)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RndGauss.h	(revision 2886)
@@ -0,0 +1,142 @@
+// ===================================================================
+// $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.yy >= 0.f) && (input.yy <= 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 2884)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj	(revision 2886)
@@ -292,4 +292,8 @@
 			</File>
 			<File
+				RelativePath=".\src\RndGauss.h"
+				>
+			</File>
+			<File
 				RelativePath=".\src\SampleGenerator.cpp"
 				>
