Index: GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp	(revision 1715)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp	(revision 1717)
@@ -293,6 +293,6 @@
 	Environment::GetSingleton()->GetIntValue("BvHierarchy.minRaysForVisibility", mMinRaysForVisibility);
 	
+	//mUseBboxAreaForSah = false;
 	mUseBboxAreaForSah = true;
-
 
 	/////////////
@@ -862,5 +862,6 @@
 
 		SortableEntryContainer::reverse_iterator rcit = 
-			mSubdivisionCandidates->rbegin(), rcit_end = mSubdivisionCandidates->rend();
+			mSubdivisionCandidates->rbegin(), rcit_end = 
+			mSubdivisionCandidates->rend();
 	
 		vector<float>::reverse_iterator rbit = bordersRight.rbegin();
@@ -892,6 +893,5 @@
 
 		const float renderCost = mViewCellsManager->EvalRenderCost(obj);
-		//const int renderCost = 1;
-
+		
 		objectsLeft += renderCost;
 		objectsRight -= renderCost;
@@ -921,5 +921,5 @@
 		{
 			// just add up areas of the objects itself
-			// (as we are not sampling volumetric visibility,
+			// As we are not sampling volumetric visibility,
 			// this should provide better heuristics
 			const float area = obj->GetArea();//obox.SurfaceArea();
@@ -936,9 +936,8 @@
 			 << lbox.SurfaceArea() << "," << rbox.SurfaceArea() << ")" << endl;
 		cout << "minborder: " << minBorder << " maxborder: " << maxBorder << endl;
-	    cout << "cost= " << sum << endl;
-*/
+	    cout << "cost= " << sum << endl;*/
 	
 		if (sum < minSum) 
-		{	//cout <<" sum: " << sum;
+		{	
 			minSum = sum;
 			areaLeft = al;
@@ -950,5 +949,5 @@
 	}
 
-	////////////////////////////////////////////
+	////////////
 	//-- assign object to front and back volume
 
@@ -964,5 +963,5 @@
 	float ratio = newCost / totalRenderCost;
   
-#ifdef _DEBUG
+#ifdef GTP_DEBUG
 	cout << "\n\nobjects=(" << (int)objectsBack.size() << "," << (int)objectsFront.size() << " of " 
 		 << (int)tData.mNode->mObjects.size() << ")\t area=(" 
@@ -973,4 +972,5 @@
 	return ratio;
 }
+
 #else
 
@@ -1006,30 +1006,28 @@
 	vector<Vector3> bordersRight;
 
-	if (mUseBboxAreaForSah)
-	{
-		// we keep track of both borders of the bounding boxes =>
-		// store the events in descending order
-		bordersRight.resize(mSubdivisionCandidates->size());
-
-		SortableEntryContainer::reverse_iterator rcit = 
-			mSubdivisionCandidates->rbegin(), rcit_end = mSubdivisionCandidates->rend();
-	
-		vector<Vector3>::reverse_iterator rbit = bordersRight.rbegin();
-	
-		for (; rcit != rcit_end; ++ rcit, ++ rbit) 
-		{
-			Intersectable *obj = (*rcit).mObject;
-			const AxisAlignedBox3 obox = obj->GetBox();
-
-			for (int i = 0; i < 3; ++ i)
+	// we keep track of both borders of the bounding boxes =>
+	// store the events in descending order
+	bordersRight.resize(mSubdivisionCandidates->size());
+
+	SortableEntryContainer::reverse_iterator rcit = 
+		mSubdivisionCandidates->rbegin(), rcit_end = 
+		mSubdivisionCandidates->rend();
+
+	vector<Vector3>::reverse_iterator rbit = bordersRight.rbegin();
+
+	for (; rcit != rcit_end; ++ rcit, ++ rbit) 
+	{
+		Intersectable *obj = (*rcit).mObject;
+		const AxisAlignedBox3 obox = obj->GetBox();
+
+		for (int i = 0; i < 3; ++ i)
+		{
+			if (obox.Min(i) < minBorder[i])
 			{
-				if (obox.Min(i) < minBorder[i])
-				{
-					minBorder[i] = obox.Min(i);
-				}
+				minBorder[i] = obox.Min(i);
 			}
-
-			(*rbit) = minBorder;
-		}
+		}
+
+		(*rbit) = minBorder;
 	}
 
@@ -1039,5 +1037,6 @@
 
 	vector<Vector3>::const_iterator bit = bordersRight.begin();
-	SortableEntryContainer::const_iterator cit, cit_end = mSubdivisionCandidates->end();
+	SortableEntryContainer::const_iterator cit, cit_end =
+		mSubdivisionCandidates->end();
 
 	for (cit = mSubdivisionCandidates->begin(); cit != cit_end; ++ cit, ++ bit) 
@@ -1052,37 +1051,24 @@
 		const AxisAlignedBox3 obox = obj->GetBox();
 
-		if (mUseBboxAreaForSah)
-		{
-			AxisAlignedBox3 lbox = nodeBbox;
-			AxisAlignedBox3 rbox = nodeBbox;
-	
-			// the borders of the bounding boxes have changed
-			for (int i = 0; i < 3; ++ i)
+		AxisAlignedBox3 lbox = nodeBbox;
+		AxisAlignedBox3 rbox = nodeBbox;
+	
+		// the borders of the bounding boxes have changed
+		for (int i = 0; i < 3; ++ i)
+		{
+			if (obox.Max(i) > maxBorder[i])
 			{
-				if (obox.Max(i) > maxBorder[i])
-				{
-					maxBorder[i] = obox.Max(i);
-				}
+				maxBorder[i] = obox.Max(i);
 			}
-
-			minBorder = (*bit);
-
-			lbox.SetMax(maxBorder);
-			rbox.SetMin(minBorder);
-	
-			al = lbox.SurfaceArea();
-			ar = rbox.SurfaceArea();
-		}
-		else
-		{
-			// just add up areas of the objects itself
-			// (as we are not sampling volumetric visibility,
-			// this should provide better heuristics
-			const float area = obj->GetArea();//obox.SurfaceArea();
-
-			al += area;
-			ar -= area;
-		}
-
+		}
+
+		minBorder = (*bit);
+
+		lbox.SetMax(maxBorder);
+		rbox.SetMin(minBorder);
+
+		al = lbox.SurfaceArea();
+		ar = rbox.SurfaceArea();
+	
 		const bool noValidSplit = ((objectsLeft <= Limits::Small) || (objectsRight <= Limits::Small));
 		const float sum =  noValidSplit ? 1e25 : objectsLeft * al + objectsRight * ar;
@@ -1091,9 +1077,8 @@
 			 << lbox.SurfaceArea() << "," << rbox.SurfaceArea() << ")" << endl;
 		cout << "minborder: " << minBorder << " maxborder: " << maxBorder << endl;
-	    cout << "cost= " << sum << endl;
-*/
+	    cout << "cost= " << sum << endl;*/
 	
 		if (sum < minSum) 
-		{	//cout <<" sum: " << sum;
+		{	
 			minSum = sum;
 			areaLeft = al;
@@ -1105,5 +1090,5 @@
 	}
 
-	////////////////////////////////////////////
+	/////////////
 	//-- assign object to front and back volume
 
@@ -1120,5 +1105,4 @@
   
 #ifdef GTP_DEBUG
-//	if (objectsBack.empty() ||objectsFront.empty())
 	cout << "\n\nobjects=(" << (int)objectsBack.size() << "," << (int)objectsFront.size() << " of " 
 		 << (int)tData.mNode->mObjects.size() << ")\t area=(" 
@@ -1153,5 +1137,5 @@
 
 
-static void PrintHeuristics(const int objectsRight,
+static void PrintHeuristics(const float objectsRight,
 							const float sum,
 							const float volLeft,
@@ -1183,5 +1167,5 @@
 {
 	///////////////////////////////////////////////////////
-	// -- go through the lists, count the number of objects left 
+	//-- go through the lists, count the number of objects left 
 	//-- and right and evaluate the cost funcion
 
Index: GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 1716)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 1717)
@@ -5826,4 +5826,5 @@
 	Debug << "view cell evaluation samples: " << numSamples << endl;
 	Debug << "view cell stats prefix: " << statsPrefix << endl;
+	Debug << "step size: " << splitsStepSize << endl;
 
 	cout << "reseting pvs ... ";
Index: GTP/trunk/Lib/Vis/Preprocessing/src/common.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/common.h	(revision 1715)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/common.h	(revision 1717)
@@ -485,5 +485,5 @@
 FileExists(char *filename);
 
-#define GTP_DEBUG 0
+//#define GTP_DEBUG 1
 
 #define DEBUG_LEVEL 5
