Index: GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp	(revision 2360)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp	(revision 2524)
@@ -1133,4 +1133,10 @@
 				 "spatialMedian");
 
+  
+  RegisterOption("KdTree.pvsArea",
+				 optFloat,
+				 "kd_pvs_area=",
+				 "1e-4");
+
   RegisterOption("KdTree.splitBorder",
 		 optFloat,
Index: GTP/trunk/Lib/Vis/Preprocessing/src/demo1.env
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/demo1.env	(revision 2521)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/demo1.env	(revision 2524)
@@ -40,5 +40,5 @@
 	totalSamples 250000000
 #	totalSamples 2000000
-	samplesPerPass 1000000
+	samplesPerPass 500000
 	samplesPerEvaluation 5000000
 
@@ -169,4 +169,5 @@
 
 KdTree {
+	pvsArea   5e-4
 	sahUseFaces false
 	Termination {
@@ -202,4 +203,5 @@
 
 	useKdPvs true
+	
 	useKdPvsAfterFiltering true
 	# samples used for view cell construction
Index: GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp	(revision 2332)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp	(revision 2524)
@@ -14,5 +14,5 @@
 
 // $$JB HACK
-#define KD_PVS_AREA (1e-5f)
+//#define KD_PVS_AREA (1e-4f)
 
 #define TYPE_INTERIOR -2
@@ -67,4 +67,5 @@
   Environment::GetSingleton()->GetFloatValue("KdTree.Termination.ct_div_ci", mCt_div_ci);
   Environment::GetSingleton()->GetFloatValue("KdTree.splitBorder", mSplitBorder);
+  Environment::GetSingleton()->GetFloatValue("KdTree.pvsArea", mKdPvsArea);
 
   Environment::GetSingleton()->GetBoolValue("KdTree.sahUseFaces", mSahUseFaces);
@@ -125,5 +126,5 @@
   delete splitCandidates;
 
-  float area = GetBox().SurfaceArea()*KD_PVS_AREA;
+  float area = GetBox().SurfaceArea()*mKdPvsArea;
 
   SetPvsTerminationNodes(area);
@@ -1404,5 +1405,5 @@
 	}
 
-	float area = GetBox().SurfaceArea()*KD_PVS_AREA;
+	float area = GetBox().SurfaceArea()*mKdPvsArea;
 	
 	SetPvsTerminationNodes(area);
Index: GTP/trunk/Lib/Vis/Preprocessing/src/run_demo1
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/run_demo1	(revision 2521)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/run_demo1	(revision 2524)
@@ -3,5 +3,5 @@
 
 #COMMAND="./release/preprocessor.exe -preprocessor_quit_on_finish+"
-COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish+ -preprocessor_use_gl_renderer+ -preprocessor_evaluate_filter- -samples_per_evaluation=5000000 -samples_per_pass=1000000 -total_samples=100000000"
+COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish- -preprocessor_use_gl_renderer+ -preprocessor_evaluate_filter- -samples_per_evaluation=5000000 -samples_per_pass=500000 -total_samples=100000000"
 
 
@@ -49,4 +49,5 @@
 -preprocessor_visibility_file=$PREFIX-i-mixed-b1-n4a.xml \
 -preprocessor_stats=$PREFIX-i-mixed-b1-n4a.log \
--preprocessor_histogram_file=$PREFIX-i-mixed-b1-n4a.hlog
+-preprocessor_histogram_file=$PREFIX-i-mixed-b1-n4a.hlog \
+demo1.env
 
Index: GTP/trunk/Lib/Vis/Preprocessing/src/run_demo2
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/run_demo2	(revision 2524)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/run_demo2	(revision 2524)
@@ -0,0 +1,55 @@
+#!sh
+
+
+#COMMAND="./release/preprocessor.exe -preprocessor_quit_on_finish+"
+COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish- -preprocessor_use_gl_renderer+ -preprocessor_evaluate_filter- -samples_per_evaluation=5000000 -samples_per_pass=500000 -total_samples=100000000"
+
+
+#SCENE="../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d"
+#VIEWCELLS=../data/vienna/vienna-viewcells-5000.xml
+
+
+#SCENE=../data/soda/soda.obj
+#VIEWCELLS=../data/soda/soda5-viewcells-1000.xml
+#VIEWCELLS=../data/soda/soda5-viewcells-single.xml
+
+#SCENE=../data/PowerPlant/selection.plb
+#VIEWCELLS=../data/PowerPlant/power_plant_viewcells1.xml
+
+#SCENE=../data/soda/soda5.dat
+#VIEWCELLS=../data/soda/soda-viewcells-5000.xml
+#VIEWCELLS=../data/soda/soda5-viewcells.xml
+#VIEWCELLS=../data/soda/soda5-viewcells-single.xml
+
+#SCENE=../data/artificial/city.x3d
+#VIEWCELLS=../data/soda/soda5-viewcells2.xml
+#VIEWCELLS=../data/artificial/city-viewcells-1000.xml
+
+#SCENE=../data/test1/test2.x3d
+#VIEWCELLS=../data/test1/test-viewcells.xml
+
+
+#SCENE=../data/vienna/vienna_cropped.obj
+#VIEWCELLS=../data/vienna/vienna_cropped-gradient-viewcells.xml.gz
+#VIEWCELLS=../data/vienna/vienna-seq-viewcells-20000.xml.gz
+
+SCENE=../data/Arena/arena-high-lods.obj
+VIEWCELLS=../data/Arena/viewcells-5000.xml.gz
+
+# SCENE=../data/Pompeii/PompeiiTen.obj
+# VIEWCELLS=../data/Pompeii/pompeii_big-seq-viewcells.xml.gz
+
+PREFIX=../work/plots/osp-TEST
+
+#SCENE=../data/atlanta/atlanta2.x3d
+#PREFIX=../work/plots/atlanta2-rss9
+
+
+$COMMAND -preprocessor=combined -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \
+-rss_distributions=mutation+object_direction+spatial \
+-view_cells_use_kd_pvs+ -af_use_kd_pvs+ \
+-preprocessor_visibility_file=$PREFIX-i-mixed-b1-n4a.xml \
+-preprocessor_stats=$PREFIX-i-mixed-b1-n4a.log \
+-preprocessor_histogram_file=$PREFIX-i-mixed-b1-n4a.hlog \
+demo1.env
+
Index: GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.h	(revision 2332)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.h	(revision 2524)
@@ -614,4 +614,5 @@
   int mSplitMethod;
   bool mSahUseFaces;
+  float mKdPvsArea;
   /// root of the tree
   KdNode *mRoot;
