Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/tonemap.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/tonemap.cg	(revision 3103)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/tonemap.cg	(revision 3125)
@@ -19,38 +19,11 @@
 };
 
-
-/*float4 DownSample(frag IN,
-				  uniform sampler2D colors,
-				  uniform float2 downSampleOffs[9]): COLOR
-{    
-    float4 average = .0f;
-
-	const float4 avgColor = tex2Dlod(colors, float4(IN.texCoord, 0, 0));
-
-	float j = 0;
-	float4 color;
-
-    for (int i = 0; i < 9; ++ i)
-    {
-		color = tex2Dlod(colors, float4(IN.texCoord + downSampleOffs[i], 0, 0));
-		if (abs(color.w - avgColor.w) < 1e-3f)
-		{
-			average += color;
-			++ j;
-		}
-    }
-        
-    //average *= 1.0f / 9.0f;
-    average *= 1.0f / j;
-
-    return average;
-}*/
  
 
-// let bilinear filtering do its work
 float4 DownSample(frag IN,
 				  uniform sampler2D colors,
 				  uniform float2 downSampleOffs[NUM_DOWNSAMPLES]): COLOR
 {    
+	// let bilinear filtering do its work
 	return tex2Dlod(colors, float4(IN.texCoord, 0, 0));
 /*
@@ -71,5 +44,4 @@
 	intensity.
 */
-
 float4 GreyScaleDownSample(frag IN,
 						   uniform sampler2D colors,
@@ -148,5 +120,5 @@
 	float logLum = logLumScaled * LOGLUM_RANGE + MINLOGLUM;
 
-	float newImageKey = exp(logLum);
+	float newImageKey = max(exp(logLum), 1e-6f);
 
 	// adjust to middle gray
@@ -184,7 +156,8 @@
 	float logLumScaled = logLum * INV_LOGLUM_RANGE - logLumOffset;
 
+	const float expFactor = 0.1f;
 	// exponential smoothing of tone mapping over time
-	if (oldLogLum > 1e-5f) // loglum from last frame too bright
-		OUT.col.w = lerp(oldLogLum, logLumScaled, 0.1f);
+	if (oldLogLum > 1e-5f) // check if loglum from last frame too small (=> tm too bright)
+		OUT.col.w = lerp(oldLogLum, logLumScaled, expFactor);
 	else
 		OUT.col.w = logLumScaled;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3123)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3125)
@@ -174,6 +174,7 @@
 	// calculate eye space position of sample in old frame
 	const float oldDepth = oldPixel.w;
+	// the depth projected into the old frame
 	const float projectedDepth = projPos.z;
-	// vector from eye pos to old sample 
+	// calculate depth difference 
 	const float depthDif = abs(projectedDepth - oldDepth);
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp	(revision 3124)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp	(revision 3125)
@@ -201,4 +201,6 @@
 		mGeometry[mStaticGeometrySize + i] = dynamicEntities[i];
 	}
+
+	cout << "max depth for testing children" << mMaxDepthForTestingChildren << endl;
 }
 
@@ -227,4 +229,5 @@
 
 	mMaxDepthForTestingChildren = maxDepthForTestingChildren;
+	cout << "max depth for testing children" << mMaxDepthForTestingChildren << endl;
 }
 
@@ -592,24 +595,4 @@
 	return numNodes;
 }
-
-#if TODO
-void Bvh::RenderBoundsImmediate(const BvhNodeContainer &nodes, RenderState *state)
-{
-	/////////
-	//-- Render the tight bounds in immediate mode
-	BvhNodeContainer::const_iterator nit, nit_end = nodes.end();
-
-	for (nit = nodes.begin(); nit != nit_end; ++ nit)
-	{
-		BvhNode *node = *nit;
-
-		for (int size_t i = 0; i < node->mNumTestNodes; ++ i)
-		{
-			BvhNode *testNode = node->mTestNodesIdx
-			RenderBoundingBoxImmediate((*nit)->GetBox());
-		}
-	}
-}
-#endif
 
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3123)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3125)
@@ -472,5 +472,5 @@
 
 	//LoadModel("fisch.dem", dynamicObjects);
-	/*LoadModel("hbuddha.dem", dynamicObjects);
+	LoadModel("hbuddha.dem", dynamicObjects);
 	buddha = dynamicObjects.back();
 	
@@ -497,5 +497,5 @@
 		ent->SetTransform(transform);
 		dynamicObjects.push_back(ent);
-	}*/
+	}
 
 
@@ -913,5 +913,5 @@
 void MainLoop() 
 {	
-#if 0
+#if 1
 	GPUProgramParameters *vtxParams = 
 		buddha->GetShape(0)->GetMaterial()->GetTechnique(1)->GetVertexProgramParameters();
@@ -930,5 +930,5 @@
 		if (GetOrCreateSceneQuery()->CalcIntersection(newPos))
 		{
-			Matrix4x4 mat = TranslationMatrix(newPos - ent->GetCenter());// + Vector3(0, 0, ent->GetBoundingBox().Size(2) * 0.5f));
+			Matrix4x4 mat = TranslationMatrix(newPos - ent->GetCenter());
 			ent->GetTransform()->SetMatrix(mat);
 		}
@@ -937,4 +937,11 @@
 	Matrix4x4 rotMatrix = RotationZMatrix(M_PI * 1e-3f);
 	dynamicObjects[1]->GetTransform()->MultMatrix(rotMatrix);
+
+
+	/////////////////////////
+	//-- update animations
+	
+	motionPath->Move(0.01f);
+
 #endif
 
@@ -1164,9 +1171,4 @@
 
 	glutSwapBuffers();
-
-
-	/////////////////////////
-	//-- update animations
-	motionPath->Move(0.01f);
 }
 
