Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 3251)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 3271)
@@ -6,8 +6,8 @@
 //-- ssao + gi parameters
 
-#define NUM_SAMPLES 8
+//#define NUM_SAMPLES 8
 //#define NUM_SAMPLES 16
 //#define NUM_SAMPLES 24
-//#define NUM_SAMPLES 48
+#define NUM_SAMPLES 48
 
 #define MIN_SAMPLES 8
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg	(revision 3247)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg	(revision 3271)
@@ -162,5 +162,5 @@
 
 		// the filtered ssao value
-		//ao.x = DiscontinuityFilter(IN.texCoord, ao, col, ssaoTex, normalsTex, colorsTex, filterOffs, scale, bl, br, tl, tr);
+		ao.x = DiscontinuityFilter(IN.texCoord, ao, col, ssaoTex, normalsTex, colorsTex, filterOffs, scale, bl, br, tl, tr);
 	}
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3247)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3271)
@@ -322,5 +322,6 @@
 #endif
 
-	return float3(total_ao, validSamples, numSamples);
+	//return float3(total_ao, validSamples, numSamples);
+	return float3(min(1.0f, total_ao), validSamples, numSamples);
 }
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/VisibilitySolutionLoader.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/VisibilitySolutionLoader.cpp	(revision 3259)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/VisibilitySolutionLoader.cpp	(revision 3271)
@@ -136,5 +136,5 @@
 	BvhNodeContainer nodes;
 	CreateIdSortedList(bvh, nodes);
-
+	
 	for (int i = 0; i < number; ++ i) 
 	{
@@ -148,7 +148,6 @@
 			fread(&objectId, sizeof(int), 1, fw);
 			fread(&time, sizeof(float), 1, fw);
-
+	
 			BvhNode *node = nodes[objectId];
-
 			mViewCells[i]->mPvs.AddEntry(bvh, node);
 		}
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntityConverter.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntityConverter.cpp	(revision 3270)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntityConverter.cpp	(revision 3271)
@@ -93,10 +93,10 @@
 
 	tex[0].first = 0; tex[0].second = 0;
-	tex[1].first = 1; tex[1].second = 0;
-	tex[2].first = 1; tex[2].second = 1;
+	tex[1].first = 50; tex[1].second = 0;
+	tex[2].first = 50; tex[2].second = 50;
 
 	tex[3].first = 0; tex[3].second = 0;
-	tex[4].first = 1; tex[4].second = 1;
-	tex[5].first = 0; tex[5].second = 1;
+	tex[4].first = 50; tex[4].second = 50;
+	tex[5].first = 0; tex[5].second = 50;
 
 	for (size_t i = 0; i < triangles.size(); ++ i)
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp	(revision 3261)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp	(revision 3271)
@@ -315,5 +315,4 @@
 
 	deferred->GetFragmentProgramParameters()->SetViewMatrixParam(0);
-	
 	deferred->GetVertexProgramParameters()->SetModelMatrixParam(1);
 	deferred->GetVertexProgramParameters()->SetOldModelMatrixParam(2);
@@ -425,5 +424,4 @@
 
 	cout << "loaded " << numTextures << " textures" << endl;
-
 	cout << "loading shapes (geometry + materials)" << endl;
 
@@ -432,5 +430,4 @@
 
 	cout << "loaded " << (int)mGeometryTable.size() << " shapes" << endl;
-
 	cout << "loading scene entites" << endl;
 	
@@ -438,5 +435,4 @@
 	
 	cout << "loaded " << numEntities << " scene entities" << endl;
-
 	cout << "bin loading finished" << endl;
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SkyPreetham.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SkyPreetham.cpp	(revision 3268)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SkyPreetham.cpp	(revision 3271)
@@ -109,6 +109,6 @@
 
 	// scale the sky dome so no intersection with the scene is visible
-	const float scaleFactor = 80.0f;
-	//const float scaleFactor = 500.0f;
+	//const float scaleFactor = 80.0f;
+	const float scaleFactor = 1000.0f;
 
 	position.z -= 3.0f * scaleFactor;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp	(revision 3270)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp	(revision 3271)
@@ -652,4 +652,6 @@
 	CollectNodes(mStaticRoot, nodes);
 	//CollectNodes(mRoot, nodes);
+	// also add root
+	nodes.push_back(mRoot);
 
 	cout << "creating new indices" << endl;
@@ -799,4 +801,6 @@
 
 	CollectNodes(mDynamicRoot, nodes);
+	// also add root
+	nodes.push_back(mRoot);
 
 	const unsigned int bufferSize = 8 * (int)nodes.size();
@@ -813,5 +817,7 @@
 
 		for (int j = 0; j < 8; ++ j)
+		{
 			(static_cast<Vector3 *>(mVertices))[node->GetId() * 8 + j] = node->GetBox().GetVertex(j);
+		}
 	}
 	
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/StopAndWaitTraverser.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/StopAndWaitTraverser.cpp	(revision 3259)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/StopAndWaitTraverser.cpp	(revision 3271)
@@ -22,5 +22,5 @@
 		mDistanceQueue.pop();
 	
-		if (1 && !IsNodeGeometryVisible(node, 10))
+		if (0 && !IsNodeGeometryVisible(node, 10))
 		{
 			node->SetVisible(false);
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3270)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3271)
@@ -132,4 +132,5 @@
 
 string filename("city");
+string bvhname("");
 string visibilitySolution("");
 
@@ -303,4 +304,6 @@
 
 GLuint sunQuery = 0;
+
+string walkThroughSuffix("frames");
 
 
@@ -455,6 +458,8 @@
 
 		env.GetStringParam(string("recordedFramesSuffix"), recordedFramesSuffix);
+		env.GetStringParam(string("walkThroughSuffix"), walkThroughSuffix);
 		env.GetStringParam(string("statsFilename"), statsFilename);
 		env.GetStringParam(string("filename"), filename);
+		env.GetStringParam(string("bvhname"), bvhname);
 		env.GetStringParam(string("visibilitySolution"), visibilitySolution);
 
@@ -472,4 +477,7 @@
 		cout << "max batch size: " << maxBatchSize << endl;
 		cout << "triangles per virtual leaf: " << trianglesPerVirtualLeaf << endl;
+
+		cout << "static scene filename prefix: " << filename << endl;
+		cout << "bvh filename prefix: " << bvhname << endl;
 
 		cout << "key forward motion: " << keyForwardMotion << endl;
@@ -491,6 +499,6 @@
 		cout << "use ssao full resolution: " << ssaoUseFullResolution << endl;
 		cout << "recorded frames suffix: " << recordedFramesSuffix << endl;
+		cout << "walkthrough suffix: " << walkThroughSuffix << endl;
 		cout << "stats filename: " << statsFilename << endl;
-		cout << "static scene filename prefix: " << filename << endl;
 		cout << "use PVSs: " << usePvs << endl;
 		cout << "visibility solution: " << visibilitySolution << endl;
@@ -587,4 +595,8 @@
 	//LoadModel("sibenik.dem", dynamicObjects);
 
+#if 1
+
+	AxisAlignedBox3 pompeiiBox = SceneEntity::ComputeBoundingBox(staticObjects);
+
 	// todo: dispose texture
 	Texture *floorTex = new Texture(model_path + "stairs.c.01.tif");
@@ -594,12 +606,34 @@
 
 	floorTex->Create();
-
-
 	Material *mymat = resourceManager->CreateMaterial();
 
-	mymat->GetTechnique(0)->SetDiffuse(RgbaColor(1, 1, 1, 1));
-	mymat->GetTechnique(0)->SetTexture(floorTex);
-
-	const Vector3 offs(1300.0f, -2500.0f, .0f);
+	Technique *tech = mymat->GetDefaultTechnique();
+	tech->SetDiffuse(RgbaColor(1, 1, 1, 1));
+	tech->SetTexture(floorTex);
+
+	Technique *depthPass = new Technique(*tech);
+	Technique *deferred = new Technique(*tech);
+
+	depthPass->SetColorWriteEnabled(false);
+	depthPass->SetLightingEnabled(false);
+
+	ShaderProgram *defaultFragmentTexProgramMrt = ShaderManager::GetSingleton()->GetShaderProgram("defaultFragmentTexMrt");
+	ShaderProgram *defaultVertexProgramMrt = ShaderManager::GetSingleton()->GetShaderProgram("defaultVertexMrt");
+
+	deferred->SetFragmentProgram(defaultFragmentTexProgramMrt);
+	deferred->SetVertexProgram(defaultVertexProgramMrt);
+
+	deferred->GetFragmentProgramParameters()->SetViewMatrixParam(0);
+	deferred->GetVertexProgramParameters()->SetModelMatrixParam(1);
+	deferred->GetVertexProgramParameters()->SetOldModelMatrixParam(2);
+
+	deferred->SetTexture(floorTex);
+	
+	mymat->AddTechnique(deferred);
+	mymat->AddTechnique(depthPass);
+
+
+	//const Vector3 offs(1300.0f, -2500.0f, .0f);
+	const Vector3 offs(pompeiiBox.Center(0), pompeiiBox.Center(1), 0);
 	Matrix4x4 moffs = TranslationMatrix(offs);
 
@@ -609,6 +643,6 @@
 	SceneEntity *myplane = 
 		SceneEntityConverter().ConvertPlane(plane, 
-		                                    500, 
-											500,
+		                                    pompeiiBox.Size(0),
+											pompeiiBox.Size(1),
 											5, 
 											5,
@@ -618,14 +652,6 @@
 	resourceManager->AddSceneEntity(myplane);
 	staticObjects.push_back(myplane);
-	/*const float side = 400.0f;
-	AxisAlignedBox3 mybox(Vector3(-side, -side, -side), Vector3(side, side, side));
-
-	Transform3 *mytrafo2 = resourceManager->CreateTransform(moffs);
-
-	SceneEntity *myboxEnt = 
-		SceneEntityConverter().ConvertBox(mybox, mymat, mytrafo2);
-
-	staticObjects.push_back(myboxEnt);
-	resourceManager->AddSceneEntity(myboxEnt);*/
+
+#endif
 
 #if 0
@@ -667,18 +693,23 @@
 	//-- load the associated static bvh
 
-	const string bvh_filename = string(model_path + filename + ".bvh");
-
 	BvhFactory bvhFactory;
-#if 1
-	bvh = bvhFactory.Create(staticObjects, dynamicObjects, maxDepthForTestingChildren);
-#else
-	bvh = bvhFactory.Create(bvh_filename, staticObjects, dynamicObjects, maxDepthForTestingChildren);
-#endif
-
-	if (!bvh)
-	{
-		cerr << "loading bvh " << bvh_filename << " failed" << endl;
-		CleanUp();
-		exit(0);
+
+	if (bvhname != "")
+	{
+		cout << "loading bvh from disc" << endl;
+		const string bvh_fullpath = string(model_path + bvhname + ".bvh");
+		bvh = bvhFactory.Create(bvh_fullpath, staticObjects, dynamicObjects, maxDepthForTestingChildren);
+
+		if (!bvh)
+		{
+			cerr << "loading bvh " << bvh_fullpath << " failed" << endl;
+			CleanUp();
+			exit(0);
+		}
+	}
+	else
+	{
+		cout << "creating new bvh" << endl;
+		bvh = bvhFactory.Create(staticObjects, dynamicObjects, maxDepthForTestingChildren);
 	}
 
@@ -1198,5 +1229,5 @@
 	{
 		if (!walkThroughPlayer)
-			walkThroughPlayer = new WalkThroughPlayer("frames.log");
+			walkThroughPlayer = new WalkThroughPlayer(walkThroughSuffix + ".log");
 		
 		++ currentReplayFrame;
@@ -1229,5 +1260,5 @@
 	{
 		if (!walkThroughRecorder)
-			walkThroughRecorder = new WalkThroughRecorder("frames.log");
+			walkThroughRecorder = new WalkThroughRecorder(walkThroughSuffix + ".log");
 		
 		if ((Distance(oldPos, camera->GetPosition()) > 1e-6f) ||
@@ -2560,5 +2591,4 @@
 {
 	const string filename = string(model_path + model);
-
 	int numEntities = 0;
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/CHCPlusPlusTraverser.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/CHCPlusPlusTraverser.cpp	(revision 3259)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/CHCPlusPlusTraverser.cpp	(revision 3271)
@@ -119,6 +119,7 @@
 			mDistanceQueue.pop();
 	
-			if (!IsNodeGeometryVisible(node, 10))
-			{
+			if (0 && !IsNodeGeometryVisible(node, 10))
+			{
+				// todo: find out why it is jumping
 				node->SetLastVisitedFrame(mFrameId);
 				node->SetVisible(false);
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrustumCullingTraverser.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrustumCullingTraverser.cpp	(revision 3258)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrustumCullingTraverser.cpp	(revision 3271)
@@ -17,5 +17,5 @@
 		mDistanceQueue.pop();
 	
-		if (1 && !IsNodeGeometryVisible(node, 10))
+		if (0 && !IsNodeGeometryVisible(node, 10))
 		{
 			node->SetVisible(false);
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/ps_memory_plot2
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/ps_memory_plot2	(revision 3250)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/ps_memory_plot2	(revision 3271)
@@ -23,5 +23,6 @@
 #echo set xrange \[100:20000\] >> $FILE
 #echo set xrange \[4200:4600\] >> $FILE
-echo set xrange \[100:400\] >> $FILE
+#echo set xrange \[100:400\] >> $FILE
+echo set xrange \[1:1000\] >> $FILE
 #echo set xrange \[1600:2000\] >> $FILE
 # echo set boxwidth 0.4 >> $FILE
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/plot_friendly
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/plot_friendly	(revision 3250)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/plot_friendly	(revision 3271)
@@ -13,4 +13,5 @@
 #FILES="$PREFIX-vfc.log $PREFIX-vfc_pvs.log $PREFIX-chc++.log $PREFIX-chc++_pvs.log"
 #FILES="$PREFIX-chc++.log $PREFIX-chc++_b20.log"
+FILES="$PREFIX-chc.log $PREFIX-vfc_pvs.log $PREFIX-vfc_pvs_smaller.log $PREFIX-chc++.log $PREFIX-chc++_pvs.log $PREFIX-chc++_pvs_smaller.log"
 
 echo $FILES
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env	(revision 3270)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env	(revision 3271)
@@ -9,5 +9,5 @@
 #filename=vienna_full_hp
 #filename=procedural_pompeii_area6_hires/pompeii_full
-filename=procedural_pompeii_area6_hires/pompeii_part1
+filename=procedural_pompeii_area6_hires/pompeii_part
 #filename=city
 useLODs=1
@@ -18,4 +18,5 @@
 # the filename for the statistics
 statsFilename=mystats.log
+walkThroughSuffix=path_pp
 
 # use potentially visible sets?
@@ -25,5 +26,5 @@
 visibilitySolution=vienna_full-8x3-pgv
 viewCellsScaleFactor=1.0f
-useSkylightForIllum=0
+useSkylightForIllum=1
 
 
@@ -120,9 +121,16 @@
 ## powerplant options
 
-#filename=PowerPlantM
-#keyForwardMotion=500.0f
-#mouseMotion=3.0f
+# static geometry
+filename=PowerPlantM
+bvhname=PowerPlantM
+keyForwardMotion=500.0f
+mouseMotion=3.0f
 #visibilitySolution=power-plant-2c-xx-1000b-pgv2
-#camPosition=-1320.57 -6306.34 3603
-#camDirection=0.292156 0.9556 0.0383878
-#viewCellsScaleFactor=0.05f
+visibilitySolution=power-plant-2c-xx-1000d-pgv
+camPosition=-1320.57 -6306.34 3603
+camDirection=0.292156 0.9556 0.0383878
+viewCellsScaleFactor=0.05f
+
+camPosition=763.554 -10254.5 2604
+camDirection=-0.0975121 0.994494 0.0383878
+useSkylightForIllum=1
