Index: GTP/trunk/Lib/Vis/Preprocessing/scripts/vsposp_typical.sh
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/scripts/vsposp_typical.sh	(revision 1643)
+++ GTP/trunk/Lib/Vis/Preprocessing/scripts/vsposp_typical.sh	(revision 1654)
@@ -11,5 +11,7 @@
 echo "starting $TARGET mode"
 
-SCENE=vsposp_typical
+#SCENE=vsposp_typical
+#SCENE=soda5_vsposp
+SCENE=soda_vsposp
 #SCENE=vsposp_vienna
 #SCENE=soda5
@@ -22,10 +24,9 @@
 ENVIRONMENT=$SCENE.env
 
-
 #######################################################
 
 
-# METHOD=interleaved_full
-# echo "$SCENE $METHOD"
+ METHOD=interleaved_full
+ echo "$SCENE $METHOD"
 
 # $PROGRAM $ENVIRONMENT \
@@ -38,12 +39,10 @@
 # -hierarchy_construction_recompute_split_on_repair=true
 
-# mv debug.log $LOG_PREFIX-$METHOD-debug.log
-# mv view_cells.wrl $LOG_PREFIX-$METHOD-view_cells.wrl
-# mv final_object_partition.wrl $LOG_PREFIX-$METHOD-final_object_partition.wrl
-# mv final_view_cells.wrl $LOG_PREFIX-$METHOD-final_view_cells.wrl
+sh movefiles.sh $LOG_PREFIX-$METHOD
 
+###########################################################################
 
-# METHOD=interleaved
-# echo "$SCENE $METHOD"
+ METHOD=interleaved
+ echo "$SCENE $METHOD"
 
 # $PROGRAM $ENVIRONMENT \
@@ -56,66 +55,9 @@
 # -hierarchy_construction_recompute_split_on_repair=false
 
-# mv debug.log $LOG_PREFIX-$METHOD-debug.log
-# mv view_cells.wrl $LOG_PREFIX-$METHOD-view_cells.wrl
-# mv final_object_partition.wrl $LOG_PREFIX-$METHOD-final_object_partition.wrl
-# mv final_view_cells.wrl $LOG_PREFIX-$METHOD-final_view_cells.wrl
+sh movefiles.sh $LOG_PREFIX-$METHOD
 
+##################################################################################
 
-# METHOD=gradient
-# echo "$SCENE $METHOD"
-
-# $PROGRAM $ENVIRONMENT \
-# -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \
-# -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \
-# -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \
-# -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \
-# -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \
-# -hierarchy_construction_type=2 \
-# -hierarchy_construction_recompute_split_on_repair=true
-
-# mv debug.log $LOG_PREFIX-$METHOD-debug.log
-# mv view_cells.wrl $LOG_PREFIX-$METHOD-view_cells.wrl
-# mv final_object_partition.wrl $LOG_PREFIX-$METHOD-final_object_partition.wrl
-# mv final_view_cells.wrl $LOG_PREFIX-$METHOD-final_view_cells.wrl
-
-#  METHOD=multilevel
-#  echo "$SCENE $METHOD"
-
-#  $PROGRAM $ENVIRONMENT \
-#  -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \
-#  -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \
-#  -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \
-#  -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \
-#  -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \
-#  -hierarchy_construction_type=2 \
-#  -hierarchy_construction_multilevel=true \
-#  -hierarchy_construction_samples=20000 \
-#  -hierarchy_term_max_leaves=500 \
-#  -hierarchy_construction_levels=1 \
-#  -hierarchy_construction_recompute_split_on_repair=true
-
-#  mv debug.log $LOG_PREFIX-$METHOD-debug.log
-#  mv view_cells.wrl $LOG_PREFIX-$METHOD-view_cells.wrl
-#  mv final_object_partition.wrl $LOG_PREFIX-$METHOD-final_object_partition.wrl
-#  mv final_view_cells.wrl $LOG_PREFIX-$METHOD-final_view_cells.wrl
-
-#  METHOD=sequential
-#  echo "$SCENE $METHOD"
-
-#  $PROGRAM $ENVIRONMENT \
-#  -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \
-#  -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \
-#  -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \
-#  -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \
-#  -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \
-#  -hierarchy_construction_type=0 \
-#  -bvh_term_max_leaves=500
-
-#  mv debug.log $LOG_PREFIX-$METHOD-debug.log
-#  mv view_cells.wrl $LOG_PREFIX-$METHOD-view_cells.wrl
-#  mv final_object_partition.wrl $LOG_PREFIX-$METHOD-final_object_partition.wrl
-#  mv final_view_cells.wrl $LOG_PREFIX-$METHOD-final_view_cells.wrl
-
- METHOD=gradient_simplesplit
+ METHOD=gradient
  echo "$SCENE $METHOD"
 
@@ -125,12 +67,62 @@
  -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \
  -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \
- -bvh_use_sah=true \
- -vsp_use_cost_heuristics=false \
  -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \
  -hierarchy_construction_type=2 \
  -hierarchy_construction_recompute_split_on_repair=true
 
- mv debug.log $LOG_PREFIX-$METHOD-debug.log
- mv view_cells.wrl $LOG_PREFIX-$METHOD-view_cells.wrl
- mv final_object_partition.wrl $LOG_PREFIX-$METHOD-final_object_partition.wrl
- mv final_view_cells.wrl $LOG_PREFIX-$METHOD-final_view_cells.wrl
+sh movefiles.sh $LOG_PREFIX-$METHOD
+
+
+############################################################################
+NODES=1000
+
+  METHOD=sequential-$NODES
+  echo "$SCENE $METHOD"
+
+ $PROGRAM $ENVIRONMENT \
+  -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \
+  -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \
+  -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \
+  -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \
+  -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \
+  -hierarchy_construction_type=0 \
+  -bvh_term_max_leaves=$NODES
+
+sh movefiles.sh $LOG_PREFIX-$METHOD
+
+############################################################################
+
+NODES=10000
+
+  METHOD=sequential-$NODES
+  echo "$SCENE $METHOD"
+
+ $PROGRAM $ENVIRONMENT \
+  -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \
+  -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \
+  -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \
+  -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \
+  -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \
+  -hierarchy_construction_type=0 \
+  -bvh_term_max_leaves=$NODES
+
+sh movefiles.sh $LOG_PREFIX-$METHOD
+
+
+########################################################################
+
+# METHOD=gradient_simplesplit
+# echo "$SCENE $METHOD"
+
+#$PROGRAM $ENVIRONMENT \
+# -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \
+# -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \
+#  -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \
+#  -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \
+#  -bvh_use_sah=true \
+#  -vsp_use_cost_heuristics=false \
+#  -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \
+#  -hierarchy_construction_type=2 \
+#  -hierarchy_construction_recompute_split_on_repair=true
+
+sh movefiles.sh $LOG_PREFIX-$METHOD
Index: GTP/trunk/Lib/Vis/Preprocessing/scripts/vsposp_typical.env
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/scripts/vsposp_typical.env	(revision 1643)
+++ GTP/trunk/Lib/Vis/Preprocessing/scripts/vsposp_typical.env	(revision 1654)
@@ -179,6 +179,9 @@
 }
 
+
 ################################
+#
 # View space partitioning kd tree
+#
 
 VspTree {
@@ -198,6 +201,9 @@
 }
 
+
 ##########################
+#
 # The bounding volume hierarchy
+#
 
 BvHierarchy {
@@ -216,6 +222,8 @@
 
 
-##########################
+###############################################################
+#
 # Manages the construction of view space and object space partition
+#
 
 Hierarchy {
@@ -240,5 +248,5 @@
 
 		# recompute split plane when "repairing" a candidate
-		recomputeSplitPlaneOnRepair false
+		recomputeSplitPlaneOnRepair true
 
 		###################################################
@@ -251,10 +259,12 @@
 
 		# minimal steps of same type: for interleaved, this is only valid for the first few splits
-		minStepsOfSameType 200
+		minStepsOfSameType 100
 	}
 
 	Termination {
 		# maximal number of leaves
-		maxLeaves 1000
+		maxLeaves 2000000
+		# maximal memory in MB
+		maxMemory 1
 		# minimum ratio of global cost decrease
 		minGlobalCostRatio -1
Index: GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h	(revision 1649)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h	(revision 1654)
@@ -315,5 +315,6 @@
 							 const int totalPvsEntries, 
 							 const float memory,
-							 const float renderCostPerStorage);
+							 const float renderCostPerStorage,
+							 const float vspOspRatio);
 
 	bool AddSampleToPvs(Intersectable *obj, 
@@ -376,5 +377,6 @@
 	/** After the suddivision has ended, do some final tasks.
 	*/
-	void FinishObjectSpaceSubdivision(const ObjectContainer &objects, const bool removeRayRefs = true) const;
+	void FinishObjectSpaceSubdivision(const ObjectContainer &objects, 
+									  const bool removeRayRefs = true) const;
 
 	/** Returns depth of object space subdivision.
Index: GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp	(revision 1649)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp	(revision 1654)
@@ -1069,5 +1069,5 @@
 	const float ratio = newRenderCost / oldRenderCost;
 
-//#ifdef _DEBUG
+#ifdef _DEBUG
 	Debug << "\n§§§§ bvh eval const decrease §§§§" << endl
 		  << "back pvs: " << (int)objectsBack.size() << " front pvs: " << (int)objectsFront.size() << " total pvs: " << nTotalObjects << endl 
@@ -1075,5 +1075,5 @@
 		  << "old rc: " << oldRenderCost / viewSpaceVol << " new rc: " << newRenderCost / viewSpaceVol << endl
 		  << "render cost decrease: " << oldRenderCost / viewSpaceVol - newRenderCost / viewSpaceVol << endl;
-//#endif
+#endif
 
 	return ratio;
Index: GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp	(revision 1653)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp	(revision 1654)
@@ -252,5 +252,6 @@
 						mHierarchyStats.mPvsEntries,
 						memoryCost,
-						1.0f / (mHierarchyStats.mTotalCost * memoryCost)
+						1.0f / (mHierarchyStats.mTotalCost * memoryCost),
+						(float)mVspTree->mVspStats.Leaves() / (float)GetObjectSpaceSubdivisionLeaves()
 						);
 }
@@ -262,5 +263,6 @@
 										   const int pvsEntries,
 										   const float memory,
-										   const float renderCostPerStorage)
+										   const float renderCostPerStorage,
+										   const float vspOspRatio)
 {
 	mSubdivisionStats
@@ -270,5 +272,6 @@
 			<< "#TotalRenderCost\n" << totalRenderCost << endl
 			<< "#Memory\n" << memory << endl
-			<< "#RcPerMb\n" << renderCostPerStorage << endl;
+			<< "#RcPerMb\n" << renderCostPerStorage << endl
+			<< "#VspOspRatio\n" << vspOspRatio << endl;
 }
 
@@ -696,4 +699,12 @@
 	mHierarchyStats.mRenderCostDecrease = sc->GetRenderCostDecrease();
 
+	static float memoryCount = 0;
+
+	if (mHierarchyStats.mMemory > memoryCount)
+	{
+		memoryCount += 100000;
+		cout << "\nstorage cost: " << mHierarchyStats.mMemory / (1024.0f * 1024.0f) << ", steps: " << mHierarchyStats.Leaves() << endl;
+	}
+
 	// output stats
 	EvalSubdivisionStats();
@@ -878,5 +889,5 @@
 			!(steps < minSteps))
 		{
-			cout << "breaking on " << sc->GetRenderCostDecrease() << " smaller than " << minRenderCostDecr << endl;
+			//cout << "breaking on " << sc->GetRenderCostDecrease() << " smaller than " << minRenderCostDecr << endl;
 			break;
 		}
Index: GTP/trunk/Lib/Vis/Preprocessing/src/OspTree.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/OspTree.cpp	(revision 1633)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/OspTree.cpp	(revision 1654)
@@ -715,9 +715,9 @@
 		ratio = minRenderCost / totalRenderCost;
 	}
-
+#if _DEBUG
 	Debug << "\n§§§§ eval local cost §§§§" << endl
 		  << "old rc: " << totalRenderCost / viewSpaceVol << " new rc: " << minRenderCost / viewSpaceVol << endl
 		  << "render cost decrease: " << (totalRenderCost - minRenderCost) / viewSpaceVol  << endl;
-
+#endif
 	return ratio;
 }
