Index: GTP/trunk/Lib/Vis/Preprocessing/scripts/gi_final.env
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/scripts/gi_final.env	(revision 2381)
+++ GTP/trunk/Lib/Vis/Preprocessing/scripts/gi_final.env	(revision 2394)
@@ -266,5 +266,5 @@
 	Construction {
 
-		samples 5000000
+		samples 6000000
 
 		# type 0 = sequential computation, 1 = interleaved, 2 = gradient
@@ -288,8 +288,8 @@
 	Termination {
 		# maximal number of leaves
-		maxLeaves 100000
+		maxLeaves 200000
 		# maximal memory in MB
 #		maxMemory 4
-		maxMemory 20
+		maxMemory 35
 		# minimum ratio of global cost decrease
 		minGlobalCostRatio -1
Index: GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h	(revision 2353)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h	(revision 2394)
@@ -655,5 +655,5 @@
 									   const bool exportRays,
 									   const int maxRays,
-									   const string prefix,
+									   const string &prefix,
 									   VssRayContainer *visRays = NULL) = NULL;
 
@@ -756,5 +756,5 @@
 	virtual void ExportColor(Exporter *exporter, 
 							 ViewCell *vc, 
-							 const bool colorCode) const;
+							 const int colorCode) const;
 
 	/** Creates meshes from the view cells.
@@ -985,5 +985,5 @@
 							   const bool exportRays,
 							   const int maxRays,
-							   const string prefix,
+							   const string &prefix,
 							   VssRayContainer *visRays = NULL);
 
@@ -1070,5 +1070,5 @@
 							   const bool exportRays,
 							   const int maxRays,
-							   const string prefix,
+							   const string &prefix,
 							   VssRayContainer *visRays = NULL);
 
@@ -1159,5 +1159,5 @@
 							   const bool exportRays,		
 							   const int maxRays,
-							   const string prefix,
+							   const string &prefix,
 							   VssRayContainer *visRays = NULL);
 
@@ -1292,5 +1292,5 @@
 							   const bool exportRays,
 							   const int maxRays,
-							   const string prefix,
+							   const string &prefix,
 							   VssRayContainer *visRays = NULL);
 	
Index: GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 2387)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 2394)
@@ -3569,5 +3569,5 @@
 void ViewCellsManager::ExportColor(Exporter *exporter, 
 								   ViewCell *vc, 
-								   bool colorCode) const
+								   int colorCode) const
 {
 	const bool vcValid = CheckValidity(vc, mMinPvsSize, mMaxPvsSize);
@@ -3576,5 +3576,6 @@
 	static Material m;
 	//cout << "color code: " << colorCode << endl;
-	switch (mColorCode)
+		
+	switch (colorCode)
 	{
 	case 0: // Random
@@ -3601,6 +3602,6 @@
 			if (mCurrentViewCellsStats.maxPvs)
 			{
-				importance = (float)mViewCellsTree->GetTrianglesInPvs(vc) / 700;
-							 //(float)mCurrentViewCellsStats.maxPvs;
+				importance = //(float)mViewCellsTree->GetTrianglesInPvs(vc) / 700;
+							 (float)mCurrentViewCellsStats.maxPvs;
 			}
 		}
@@ -3996,5 +3997,5 @@
 	if (1) // export final view cells
 	{
-		mColorCode = 1; // hack color code
+		mColorCode = 1; // 0 = pvs, 1 = random
 		Exporter *exporter = Exporter::GetExporter("final_view_cells.wrl");
 	
@@ -4073,5 +4074,5 @@
 												const bool exportRays,
 												const int maxRays,
-												const string prefix,
+												const string &prefix,
 												VssRayContainer *visRays)
 {
@@ -4589,5 +4590,5 @@
 											   const bool exportRays,
 											   const int maxRays,
-											   const string prefix,
+											   const string &prefix,
 											   VssRayContainer *visRays)
 {
@@ -5395,5 +5396,5 @@
 												   const bool exportRays,
 												   const int maxRays,
-												   const string prefix,
+												   const string &prefix,
 												   VssRayContainer *visRays)
 {	
@@ -6328,11 +6329,8 @@
 	if (exporter)
 	{
+		// clamp to a scene boudning box
 		if (CLAMP_TO_BOX)
-		{	
 			exporter->mClampToBox = true; 	
-		}
-
-		EvaluateViewCellsStats();
-
+		
 		const long starttime = GetTime();
 		cout << "exporting final view cells (after initial construction + post process) ... " << endl;
@@ -6350,50 +6348,11 @@
 		const int savedColorCode = mColorCode;
 
-		const float maxRenderCost = UpdateObjectCosts();
-		cout << "maxRenderCost: " << maxRenderCost << endl;
-		mColorCode = 0; // 0 = random, 1 = export pvs
-
-		if (1)
-		mHierarchyManager->ExportObjectSpaceHierarchy(exporter, objects, 
-													  CLAMP_TO_BOX ? &bbox : NULL, maxRenderCost, false);
-		
-
-		if (1)
-		{
-			//ExportViewCellsForViz(exporter, CLAMP_TO_BOX ? &bbox : NULL, mColorCode, GetClipPlane());
-			ExportViewCellsForViz(exporter, NULL, mColorCode, GetClipPlane());
-		}
-
-		delete exporter;
-
-		cout << "finished in " << TimeDiff(starttime, GetTime()) * 1e-3f << " secs" << endl;
-		mColorCode = savedColorCode;
-	}
-
-	exporter = Exporter::GetExporter("final_object_partition.wrl");
-
-	if (exporter)
-	{
-		if (CLAMP_TO_BOX)
-		{	
-			exporter->mClampToBox = true; 	
-		}
-
 		EvaluateViewCellsStats();
-
-		const long starttime = GetTime();
-		cout << "exporting final objects (after initial construction + post process) ... ";
-
-		// matt: hack for clamping scene
-		AxisAlignedBox3 bbox = mViewSpaceBox;
-		bbox.Scale(scale);
-
-		// hack color code (show pvs size)
-		const int savedColorCode = mColorCode;
-
-		mColorCode = 1; // 0 = random, 1 = export pvs
-		// don't visualize render cost
-		const float maxRenderCost = -1;
-
+		const int colorCode = 0;
+
+		const float maxRenderCost = -1;//UpdateObjectCosts();
+		const bool exportBounds = false;
+
+		//cout << "maxRenderCost: " << maxRenderCost << endl;
 		if (1)
 		mHierarchyManager->ExportObjectSpaceHierarchy(exporter, 
@@ -6401,23 +6360,56 @@
 													  CLAMP_TO_BOX ? &bbox : NULL, 
 													  maxRenderCost, 
-													  false);
+													  exportBounds);
 		
-
-		if (1)
-		{
-			ExportViewCellsForViz(exporter, NULL, mColorCode, GetClipPlane());
-			//ExportViewCellsForViz(exporter, CLAMP_TO_BOX ? &bbox : NULL, mColorCode, GetClipPlane());
-		}
-
+		//ExportViewCellsForViz(exporter, CLAMP_TO_BOX ? &bbox : NULL, mColorCode, GetClipPlane());
+		ExportViewCellsForViz(exporter, NULL, colorCode, GetClipPlane());
+		
 		delete exporter;
 
 		cout << "finished in " << TimeDiff(starttime, GetTime()) * 1e-3f << " secs" << endl;
-		mColorCode = savedColorCode;
-	}
-
-	// visualization of the merged view cells
-    if (0) 
-	{	
-		ExportMergedViewCells(objects);
+	}
+
+	if (1)
+	{
+		exporter = Exporter::GetExporter("final_object_partition.wrl");
+
+		if (exporter)
+		{
+			if (CLAMP_TO_BOX)
+			{	
+				exporter->mClampToBox = true; 	
+			}
+
+			const long starttime = GetTime();
+			cout << "exporting final objects (after initial construction + post process) ... ";
+
+			// matt: hack for clamping scene
+			AxisAlignedBox3 bbox = mViewSpaceBox;
+			bbox.Scale(scale);
+
+			// hack color code (show pvs size)
+			const int savedColorCode = mColorCode;
+
+			EvaluateViewCellsStats();
+			mColorCode = 1; // 0 = random, 1 = export pvs
+
+			// don't visualize render cost
+			const float maxRenderCost = -1;
+			//const bool exportBounds = true;
+			const bool exportBounds = false;
+
+			if (1)
+			mHierarchyManager->ExportObjectSpaceHierarchy(exporter, 
+			                                              objects, 
+														  CLAMP_TO_BOX ? &bbox : NULL, 
+														  maxRenderCost, 
+														  exportBounds);
+
+
+			delete exporter;
+
+			cout << "finished in " << TimeDiff(starttime, GetTime()) * 1e-3f << " secs" << endl;
+			mColorCode = savedColorCode;
+		}
 	}
 
@@ -6447,5 +6439,5 @@
 												   const bool exportRays,
 												   const int maxRays,
-												   const string prefix,
+												   const string &prefix,
 												   VssRayContainer *visRays)
 {
Index: GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.cpp	(revision 2231)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.cpp	(revision 2394)
@@ -153,8 +153,5 @@
 		SetFilled();
 		
-		if (1)
-			ExportGeometry(leaf->mObjects, true, box);
-		else
-			ExportBox(leaf->GetBoundingBox());
+		ExportGeometry(leaf->mObjects, true, box);
 	}
 
