Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/default.env
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/default.env	(revision 2829)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/default.env	(revision 2830)
@@ -10,5 +10,5 @@
 winHeight=768
 camPosition=483.398f 242.364f 186.078f
-useFullScreen=false
+useFullScreen=0
 numSsaoSamples=8
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 2829)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 2830)
@@ -291,4 +291,6 @@
 	int returnCode = 0;
 
+	cout << "=== reading environment file === " << endl;
+
 	env.Read("src/default.env");
 
@@ -304,5 +306,4 @@
 
 	env.GetBoolParam(string("useFullScreen"), useFullScreen);
-
 	//env.GetIntParam(string("numSssaoSamples"), numSsaoSamples);
 
@@ -310,5 +311,4 @@
 	env.GetVectorParam(string("camPosition"), camPos);
 
-	cout << "read values: " << endl;
 	cout << "assumedVisibleFrames: " << assumedVisibleFrames << endl; 
 	cout << "maxBatchSize: " << maxBatchSize << endl;
@@ -1972,6 +1972,45 @@
 }
 
-
+#if 0
+// kustls magic sample positions
 void GenerateSamples()
+{
+	static const float mysamples[] =
+	{ 
+		-0.326212f, -0.405805f,
+		-0.840144f, -0.07358f,
+		-0.695914f, 0.457137f,
+		-0.203345f, 0.620716,
+		0.96234f, -0.194983f,
+		0.473434f, -0.480026f,
+		0.519456, 0.767022f,
+		0.185461f, -0.893124f,
+		0.507431f, 0.064425f,
+		0.89642f, 0.412458f,
+		-0.32194f, -0.932615f,
+		-0.791559f, -0.597705f,
+		0.326212f, 0.405805f,
+		0.840144f, 0.07358f,
+		0.695914f, -0.457137f,
+		0.203345f, -0.620716,
+		-0.96234f, 0.194983f,
+		-0.473434f, 0.480026f,
+		-0.519456, -0.767022f,
+		-0.185461f, 0.893124f,
+		-0.507431f, -0.064425f,
+		-0.89642f, -0.412458f,
+		0.32194f, 0.932615f,
+		0.791559f, 0.597705f
+	};
+
+	for (int i = 0; i < NUM_SAMPLES; ++ i)
+	{
+		samples[i] = mysamples[i];
+	}
+}
+
+#else
+
+/*void GenerateSamples()
 {
 	float scale = 1.0f / (float)NUM_SAMPLES;
@@ -2002,5 +2041,65 @@
 		//cout << samples[i] << " " << samples[i + 1] << endl;
 	}
-}
+}*/
+
+void GenerateSamples()
+{
+	// generates poisson distribution on disc
+	float factor = 1.0f;
+	float minDist = factor * sqrt((float)NUM_SAMPLES) / 2;
+
+	cout << "minDist= " << minDist << endl;
+
+	for (int i = 0; i < NUM_SAMPLES; i += 2)
+	{
+		int tries = 0;
+
+		// repeat until valid sample was found
+		while (1)
+		{
+
+			++ tries;
+
+			const float rx = RandomValue(-1, 1);
+			const float ry = RandomValue(-1, 1);
+
+			// check if in disk, else exit early
+			if (rx * rx + ry * ry > 1)
+				continue;
+
+			bool sampleValid = true;
+
+			// check poisson property
+			for (int j = 0; ((j < i) && sampleValid); j += 2)
+			{
+				const float dist = 
+					sqrt((samples[j] - rx) * (samples[j] - rx) +
+					     (samples[j + 1] - ry) * (samples[j + 1] - ry));
+			
+				if (dist < minDist)
+					sampleValid = false;
+			}
+
+			if (sampleValid)
+			{
+				samples[i] = rx;
+				samples[i + 1]= ry;
+				break;
+			}
+
+			if (tries > 1000)
+			{
+				minDist *= 0.9f;
+				tries = 0;
+			}
+		}
+		cout << "sample: " << samples[i] << " " << samples[i + 1] << " r: " << sqrt(samples[i] * samples[i]  + samples[i + 1] * samples[i + 1]) << " tries: " << tries << endl;
+	}
+
+	cout << "minDist= " << minDist << endl;
+}
+
+
+#endif
 
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg	(revision 2829)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg	(revision 2830)
@@ -4,36 +4,8 @@
 
 #define NUM_SAMPLES 8
-#define SAMPLE_INTENSITY 0.5f
-//#define SAMPLE_INTENSITY 0.7f
+//#define SAMPLE_INTENSITY 0.5f
+//#define SAMPLE_INTENSITY 1.1f
+#define SAMPLE_INTENSITY 0.7f
 #define AREA_SIZE 5e-1f
-
-// kustls magic sample positions
-/*static const float2 samples[NUM_SAMPLES] =
-{
-  {-0.326212f, -0.405805f},
-  {-0.840144f, -0.07358f},
-  {-0.695914f, 0.457137f},
-  {-0.203345f, 0.620716},
-  {0.96234f, -0.194983f},
-  {0.473434f, -0.480026f},
-  {0.519456, 0.767022f},
-  {0.185461f, -0.893124f},
-  {0.507431f, 0.064425f},
-  {0.89642f, 0.412458f},
-  {-0.32194f, -0.932615f},
-  {-0.791559f, -0.597705f},
-  {0.326212f, 0.405805f},
-  {0.840144f, 0.07358f},
-  {0.695914f, -0.457137f},
-  {0.203345f, -0.620716},
-  {-0.96234f, 0.194983f},
-  {-0.473434f, 0.480026f},
-  {-0.519456, -0.767022f},
-  {-0.185461f, 0.893124f},
-  {-0.507431f, -0.064425f},
-  {-0.89642f, -0.412458f},
-  {0.32194f, 0.932615f},
-  {0.791559f, 0.597705f}
-};*/
 
 
@@ -119,5 +91,6 @@
     float cos_angle = dot(direction_to_sample, currentNormal);
     cos_angle = max(cos_angle, 0.0f);
-    cos_angle *= cos_angle;
+    // take quadratic influence to sharpen contrast
+    //cos_angle *= cos_angle;
 
     // distance between current position and sample position controls AO intensity.
