Index: /GTP/trunk/Lib/Vis/Preprocessing/scripts/power_plant.env
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/scripts/power_plant.env	(revision 886)
+++ /GTP/trunk/Lib/Vis/Preprocessing/scripts/power_plant.env	(revision 886)
@@ -0,0 +1,489 @@
+#############################################################################
+# ERS default configuration file
+# Jiri Bittner 2003
+#############################################################################
+
+Scene {
+
+#	filename glasgow1.x3d
+#	filename vienna.x3d
+#	filename ../data/vienna/vienna-simple.x3d
+#	filename ../data/vienna/vienna-buildings.x3d
+#filename ../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d
+#;../data/vienna/vienna-plane.x3d
+#	filename ../data/vienna/viewcells-25-sel.x3d
+#	filename ../data/atlanta/atlanta2.x3d
+#	filename ../data/soda/soda.dat
+#	filename ../data/soda/soda5.dat
+
+#filename ../data/PowerPlant/ppsection1/part_a/g0.ply
+#filename ../data/PowerPlant/ppsection1/part_b/g0.ply
+#filename ../data/PowerPlant/ppsection1.plb
+#filename ../data/PowerPlant/all.plb
+filename ../data/PowerPlant/selection2.plb
+#filename ../data/PowerPlant/comps/ppsection1/comps.plb
+
+}
+
+Preprocessor {
+	# stored sample rays
+	samplesFilename rays.out
+	useGlRenderer false
+#	type sampling
+	type vss
+#	type rss
+	detectEmptyViewSpace true
+	loadPolygonsAsMeshes false
+}
+
+VssPreprocessor {
+	samplesPerPass  100000
+	initialSamples 0
+	vssSamples 0
+	vssSamplesPerPass 500000
+	useImportanceSampling true
+	loadInitialSamples  false
+	storeInitialSamples false
+	useViewSpaceBox false
+#	testBeamSampling true
+}
+
+
+SamplingPreprocessor {
+	totalSamples 500000
+	samplesPerPass  3
+}
+
+
+VssTree {
+	useRss    false
+	epsilon		1e-6
+	
+	maxDepth 	40
+	minPvs		30
+	minRays		800
+	minSize		0.001
+ 	maxCostRatio	1.5
+	maxRayContribution 0.5
+		
+	maxTotalMemory	50
+	maxStaticMemory	20
+	
+	splitType regular
+	#	splitType heuristic
+	#	splitType hybrid
+	splitUseOnlyDrivingAxis true
+	
+	interleaveDirSplits	true
+    dirSplitDepth 0
+	
+	numberOfEndPointDomains	10000
+	ct_div_ci	0.0
+	randomize	false
+	
+	refDirBoxMaxSize	0.1
+}
+
+RssPreprocessor {
+	samplesPerPass  100000
+	#initialSamples 500000
+	#vssSamples 10000000
+	#for view cell construction
+	initialSamples 0
+	vssSamples 0
+	vssSamplesPerPass 500000
+	useImportanceSampling true
+
+	directionalSampling true
+	objectBasedSampling false
+
+	Export {
+		pvs false
+		rssTree false
+		rays true
+		numRays 5000
+	}
+
+	useViewcells true
+	updateSubdivision true
+	loadInitialSamples false
+	storeInitialSamples false
+}
+
+
+RssTree {
+
+	epsilon		1e-6
+
+	maxDepth 	40
+	minPvs		3
+	minRays		30
+	minSize		0.001
+ 	maxCostRatio 1.0
+	maxRayContribution 0.5
+	maxRays		1000000
+	maxTotalMemory	200
+	maxStaticMemory	100
+
+#	splitType regular
+#	splitType heuristic
+	splitType hybrid
+	splitUseOnlyDrivingAxis true
+	importanceBasedCost false
+
+	interleaveDirSplits	true
+    dirSplitDepth 0
+
+	numberOfEndPointDomains	10000
+	ct_div_ci	0.0
+	randomize	false
+
+	refDirBoxMaxSize	0.1
+}
+
+Limits {
+
+       threshold	1e-6
+       small		1e-6
+       infinity		1e9
+}
+
+Unigraphics {
+		meshGrouping 1
+}
+
+KdTree {
+	sahUseFaces true
+	Termination {
+		minCost 1
+		maxDepth 20
+		maxCostRatio 1.0
+		ct_div_ci 0.5
+		maxNodes 200000
+	}
+
+#	splitMethod spatialMedian
+	splitMethod SAH
+	splitBorder 0.01
+}
+
+MeshKdTree {
+	Termination {
+		minCost 40
+		maxDepth 18
+		maxCostRatio 0.9
+		ct_div_ci 0.5
+	}
+
+#	splitMethod spatialMedian
+	splitMethod SAH
+	splitBorder 0.01
+}
+
+
+
+ViewCells {
+	# samples used for view cell construction
+	Construction {
+		samples 0
+		#samples 2500000
+		samplesPerPass 500000
+	}
+
+	#number of active view cells
+	active 1024
+	maxStaticMemory	40
+
+	exportToFile true
+	loadFromFile false
+
+	#type kdTree
+	#type vspKdTree
+	#type bspTree
+	type vspBspTree
+	#type sceneDependent
+	
+	height 5.0
+	maxViewCells 3000
+
+	#percentage of total visible objects where pvs is considered invalid
+	maxPvsRatio 1.0
+		
+	pruneEmptyViewCells false
+	processOnlyValidViewCells false
+
+	#stats viewCellStats.log
+
+	#samplingType directional
+	samplingType box
+
+	PostProcess {
+		# how much samples are used for post processing
+		samples 0
+		renderCostWeight 1.0
+		maxCostRatio 0.1
+		minViewCells 1
+		avgCostMaxDeviation 0.01
+		maxMergesPerPass 5000
+		useRaysForMerge false
+		refine false
+		compress false
+		merge false
+	}
+
+	Visualization {
+		# how much samples we use for visualization
+		samples 0
+		#colorCode PVS
+		#colorCode MergedLeaves
+		#colorCode MergedTreeDiff
+		colorCode Random
+		exportRays false
+		exportGeometry false
+		exportMergedViewCells false
+		useClipPlane true
+		clipPlaneAxis 1
+	}
+
+	showVisualization false	
+	evaluateViewCells true
+	
+	Evaluation {
+		samplesPerPass 2000000
+		samples 4000000
+		statsPrefix ../scripts/viewCells
+		#samplingType directional
+		samplingType box
+		histogram true
+		histoPasses 5000
+	}
+
+#	filename ../data/atlanta/atlanta_viewcells_large.x3d
+#	filename ../data/vienna/viewcells-25-sel.x3d
+#	filename ../data/vienna/viewcells-25.x3d
+#	filename ../data/vienna/viewcells-large-sel.x3d
+#	filename ../scripts/viewcells_vienna.xml
+	filename ../scripts/viewcells_soda.xml
+}
+
+
+Simulation {
+	objRenderCost 1.0
+	vcOverhead 1.0
+	# always between 0 and 1
+	moveSpeed 0.0001
+}
+
+
+VspKdTree {
+	epsilon		1e-6
+
+	Construction {
+		samples 1000000
+	}
+	
+	Termination {
+		maxDepth	 	40
+		minPvs			0
+		minRays			1
+		minSize			0.001
+		maxCostRatio		5.9
+		maxViewCells		169
+		missTolerance		4
+		maxRayContribution 	2.5
+	}
+	
+	maxTotalMemory	100
+	maxStaticMemory	40
+
+	splitType 	regular
+	#splitType 	heuristics
+	splitUseOnlyDrivingAxis true
+	ct_div_ci	0.0
+	
+	# maximal cost for merging a view cell
+	PostProcess {
+		maxCostRatio 0.005
+		minViewCells 10000
+		maxPvsSize   5000
+	}
+	
+	
+	Visualization {
+	}
+}
+
+
+VspBspTree {
+	Construction {
+		samples 1000000
+		epsilon 0.0000001
+		randomize false
+		renderCostWeight 1.0
+	}
+
+
+	# random polygon       = 1
+	# axis aligned         = 2
+	# least ray splits     = 256
+	# balanced rays        = 512
+	# pvs                  = 1024
+	
+	splitPlaneStrategy 1026
+	
+	# maximal candidates for split planes
+	maxPolyCandidates 100
+
+	usePolygonSplitIfAvailable false
+
+	# maximal tested rays for split cost heuristics
+	maxTests 50000
+	
+	maxTotalMemory	50
+	maxStaticMemory	50
+
+	subdivisionStats ../subdivisionStats.log
+
+	# factors for evaluating split plane costs
+	Factor {
+		leastRaySplits 1.0
+	  	balancedRays 1.0
+	  	pvs 1.0
+	}
+	
+	Termination {
+		# parameters used for autopartition
+		minRays 		-15
+		minPolygons 		-1
+		maxDepth		25
+		minPvs 			-15
+		minProbability		0.00000001
+		maxRayContribution	1.8
+		maxCostRatio		1.8
+		missTolerance		6
+		globalCostMissTolerance 4
+		minGlobalCostRatio      0.0000001
+#		minGlobalCostRatio      0.0001
+		maxViewCells		25000
+	
+
+		# used for pvs criterium
+		ct_div_ci 0.0
+		
+		AxisAligned {
+			minRays 		50000
+			maxRayContribution	9.9
+		}
+	}
+	
+	useSplitCostQueue true
+	useCostHeuristics true
+
+	splitUseOnlyDrivingAxis false
+	simulateOctree false
+	useRandomAxis false
+	usePolygonSplitIfAvailable false
+	nodePriorityQueueType 0
+
+	Visualization {
+		# x3d visualization of the split planes
+		exportSplits false
+	}
+}
+
+BspTree {
+	Construction {
+		samples 100000
+		epsilon 0.005
+	}
+
+
+	# random polygon       = 1
+	# axis aligned         = 2
+	# least splits         = 4
+	# balanced polygons    = 8
+	# balanced view cells  = 16
+	# largest polygon area = 32
+	# vertical axis        = 64
+	# blocked rays         = 128
+	# least ray splits     = 256
+	# balanced rays        = 512
+	# pvs                  = 1024
+
+	# least splits + balanced polygons
+	#splitPlaneStrategy 12
+	
+	#axis aligned + vertical axis
+	#splitPlaneStrategy 66
+	
+	# axis aligned + balanced view cells
+	# splitPlaneStrategy 18
+	
+	# largest polygon area
+	#splitPlaneStrategy 32
+	
+	# axus aligned + balanced polygons
+	#splitPlaneStrategy 72
+	
+	# axis aligned + blocked rays
+	#splitPlaneStrategy 130
+	
+	#splitPlaneStrategy 384
+	#splitPlaneStrategy 130
+	
+	splitPlaneStrategy 32
+	
+	maxPolyCandidates 100
+	maxRayCandidates 0
+	
+	maxTests 10000
+	
+	subdivisionStats ../subDivisionStats.log
+
+	# factors for evaluating split plane costs
+	Factor {
+		verticalSplits 1.0
+	  	largestPolyArea 1.0
+	  	blockedRays 1.0
+	  	leastRaySplits 1.0
+	  	balancedRays 1.0
+	  	pvs 1.0
+	  	leastSplits 1.0
+	  	balancedPolys 1.0
+	  	balancedViewCells 1.0
+	}
+	
+	Termination {
+		# parameters used for autopartition
+		minRays -1
+		minPolygons 0
+		maxDepth 30
+		minPvs -1
+		minProbability 0.00001
+		maxRayContribution 9999
+		maxViewCells 20000
+
+		# used for pvs criterium
+		ct_div_ci 0.0
+	
+		maxCostRatio 0.9
+		
+		# axis aligned splits
+		AxisAligned {
+			minPolys 5000
+			minRays 500
+			minObjects 10
+			ct_div_ci 0.5
+		}
+	}
+	
+	AxisAligned {
+		splitBorder 0.01
+	}
+	
+	
+	Visualization {
+		# x3d visualization of the split planes
+		exportSplits false
+	}
+}
Index: /GTP/trunk/Lib/Vis/Preprocessing/scripts/preprocess_visibility.env
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/scripts/preprocess_visibility.env	(revision 886)
+++ /GTP/trunk/Lib/Vis/Preprocessing/scripts/preprocess_visibility.env	(revision 886)
@@ -0,0 +1,279 @@
+############################################################################
+# ERS default configuration file
+# Jiri Bittner 2003
+#############################################################################
+
+Scene {
+
+# filename ../data/glasgow/glasgow1.x3d
+#	filename vienna.x3d
+# filename ../data/vienna/vienna-simple.x3d
+#filename ../data/vienna/vienna-buildings.x3d
+#filename ../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-plane.x3d;../data/vienna/vienna-roads.x3d
+# filename ../data/vienna/viewcells-25-sel.x3d
+#filename ../data/atlanta/atlanta2.x3d
+filename ../data/soda/soda.dat
+#filename ../data/soda/soda5.dat
+#filename ../data/PowerPlant/ppsection1/part_a/g0.ply
+#filename ../data/PowerPlant/ppsection1/part_b/g0.ply
+#filename ../data/PowerPlant/ppsection1.plb
+#filename ../data/PowerPlant/all.plb
+#filename ../data/PowerPlant/selection3.plb
+#filename ../data/PowerPlant/section10.plb;../data/PowerPlant/section14.plb
+#filename ../data/PowerPlant/selection.plb
+#filename ../data/PowerPlant/comps/ppsection1/comps.plb
+}
+
+Preprocessor {
+	# stored sample rays
+	samplesFilename rays.out
+	useGlRenderer false
+	useGlDebugger false
+#	type sampling
+#	type vss
+	type rss
+#	type render
+	detectEmptyViewSpace false
+	pvsRenderErrorSamples 0
+#	pvsRenderErrorSamples 1000
+	quitOnFinish true
+	computeVisibility true
+	applyVisibilityFilter	true
+	visibilityFilterWidth	0.01
+	visibilityFile visibility.xml
+}
+
+
+RssPreprocessor {
+	samplesPerPass 1000000
+	initialSamples 1000000
+	vssSamples 5000000
+	vssSamplesPerPass 1000000
+	useImportanceSampling true
+
+	directionalSampling false
+	objectBasedSampling false
+
+	Export {
+		pvs false
+		rssTree false
+		rays false
+		numRays 20000
+	}
+
+	useViewcells true
+	updateSubdivision true
+	loadInitialSamples false
+	storeInitialSamples false
+}
+
+
+RssTree {
+	epsilon		1e-6
+	perObjectTree false
+
+	maxDepth 	40
+	minPvs		3
+# before vienna test it was:
+#	minRays	50
+#	splitType heuristic
+
+	minRays		100
+	minSize		0.001
+ 	maxCostRatio 1.0
+	maxRayContribution 0.5
+	maxRays		2000000
+	maxTotalMemory	200
+	maxStaticMemory	100
+
+	splitType regular
+#	splitType heuristic
+#	splitType hybrid
+	splitUseOnlyDrivingAxis false
+	importanceBasedCost false
+
+	interleaveDirSplits	true
+    dirSplitDepth 0
+
+	ct_div_ci	0.0
+}
+
+Limits {
+
+       threshold	1e-6
+       small		1e-6
+       infinity		1e9
+}
+
+Unigraphics {
+		meshGrouping 1
+}
+
+KdTree {
+	sahUseFaces false
+	Termination {
+		minCost 1
+		maxDepth 30
+		maxCostRatio 1.0
+		ct_div_ci 0.5
+		maxNodes 500000	
+	}
+
+#	splitMethod spatialMedian
+	splitMethod SAH
+	splitBorder 0.01
+}
+
+MeshKdTree {
+	Termination {
+		minCost 8
+		maxDepth 18
+		maxCostRatio 0.9
+		ct_div_ci 0.5
+	}
+
+#	splitMethod spatialMedian
+	splitMethod SAH
+	splitBorder 0.01
+}
+
+
+
+ViewCells {
+	# samples used for view cell construction
+	Construction {
+		samples 100000
+		samplesPerPass 100000
+	}
+
+	Filter {
+		maxSize 5
+		width  0.05
+	}
+
+	#number of active view cells
+	active 5000
+	maxStaticMemory	40
+
+	exportToFile false
+	loadFromFile true
+
+	#type kdTree
+	#type vspKdTree
+	#type bspTree
+	type vspBspTree
+	#type sceneDependent
+	
+	height 5.0
+	maxViewCells 5000
+
+	#percentage of total visible objects where pvs is considered invalid
+	maxPvsRatio 1.0
+		
+	pruneEmptyViewCells false
+	processOnlyValidViewCells false
+
+	#stats viewCellStats.log
+
+	samplingType directional
+	#samplingType box
+
+	PostProcess {
+		# how much samples are used for post processing
+		samples 100000
+		renderCostWeight 1.0
+		maxCostRatio 0.1
+		minViewCells 1
+		avgCostMaxDeviation 0.01
+		maxMergesPerPass 5000
+		useRaysForMerge false
+		refine false
+		compress false
+		merge false
+	}
+
+	Visualization {
+		# how much samples we use for visualization
+		samples 100000
+		#colorCode PVS
+		#colorCode MergedLeaves
+		#colorCode MergedTreeDiff
+		colorCode Random
+		exportRays false
+		exportGeometry false
+		exportMergedViewCells false
+		useClipPlane true
+		clipPlaneAxis 1
+	}
+
+	showVisualization false	
+	evaluateViewCells false
+	
+	Evaluation {
+		samplesPerPass 500
+		samples 1000
+		statsPrefix ../scripts/viewCells
+	}
+
+#	filename ../data/atlanta/atlanta_viewcells_large.x3d
+#	filename ../data/vienna/viewcells-25-sel.x3d
+#	filename ../data/vienna/viewcells-25.x3d
+#	filename ../data/vienna/viewcells-large-sel.x3d
+#	filename ../scripts/viewcells_vienna.xml
+#	filename ../scripts/viewcells_atlanta.xml
+#	filename ../scripts/viewcells_soda5-2.xml
+#	filename ../data/soda/soda5-viewcells.xml
+#	filename ../scripts/viewcells_atlanta.xml
+#	filename ../data/soda/soda5-viewcells2.xml
+	filename ../data/atlanta/viewcells_atlanta3.xml
+#	filename ../data/vienna/viewcells_vienna.xml
+#	filename ../data/PowerPlant/power_plant_viewcells_all3.xml
+}
+
+
+Simulation {
+	objRenderCost 1.0
+	vcOverhead 1.0
+	# always between 0 and 1
+	moveSpeed 0.0001
+}
+
+
+VspKdTree {
+	epsilon		1e-6
+
+	Construction {
+		samples 500000
+	}
+	
+	Termination {
+		maxDepth	 	40
+		minPvs			0
+		minRays			1
+		minSize			0.001
+		maxCostRatio		5.9
+		maxViewCells		169
+		missTolerance		4
+		maxRayContribution 	2.5
+	}
+	
+	maxTotalMemory	100
+	maxStaticMemory	40
+
+	splitType 	regular
+	#splitType 	heuristics
+	splitUseOnlyDrivingAxis true
+	ct_div_ci	0.0
+	
+	# maximal cost for merging a view cell
+	PostProcess {
+		maxCostRatio 0.005
+		minViewCells 10000
+		maxPvsSize   5000
+	}
+	
+	
+	Visualization {
+	}
+}
+
Index: /GTP/trunk/Lib/Vis/Preprocessing/scripts/script_power_plant_vsp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/scripts/script_power_plant_vsp	(revision 886)
+++ /GTP/trunk/Lib/Vis/Preprocessing/scripts/script_power_plant_vsp	(revision 886)
@@ -0,0 +1,44 @@
+#!/bin/sh
+PROGRAM=../src/release/Preprocessor.exe
+
+#SCENE=soda5
+SCENE=power_plant
+#SCENE=atlanta
+#SCENE=vienna
+
+LOG_PREFIX=../scripts/tests/egsr06/$SCENE-1204
+
+ENVIRONMENT=$SCENE.env
+
+
+################################################################
+#           vspbsptree (only subdivision)                      #
+################################################################
+
+#
+# only view space subdivision, no merge
+#
+
+
+METHOD=onlysubdiv
+
+echo "$SCENE $METHOD"
+
+$PROGRAM $ENVIRONMENT \
+-view_cells_type=vspBspTree \
+-view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \
+-view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \
+-vsp_bsp_subdivision_stats=$LOG_PREFIX-$METHOD-subdivisionStats.log \
+-view_cells_post_process_merge=false \
+-vsp_bsp_split_only_driving_axis=false \
+-vsp_bsp_use_cost_heuristics=true \
+-vsp_bsp_max_poly_candidates=0 \
+-vsp_bsp_use_split_cost_queue=false \
+-vsp_bsp_node_queue_type=0 \
+-view_cells_prune_empty=true \
+-vsp_bsp_term_min_pvs=0 \
+-vsp_bsp_construction_samples=1000000 \
+-vsp_bsp_term_max_view_cells=50000 \
+-view_cells_filename=$LOG_PREFIX-$METHOD-viewCells.xml
+
+mv debug.log $LOG_PREFIX-$METHOD-debug.log
Index: /GTP/trunk/Lib/Vis/Preprocessing/scripts/preprocess_visibility
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/scripts/preprocess_visibility	(revision 886)
+++ /GTP/trunk/Lib/Vis/Preprocessing/scripts/preprocess_visibility	(revision 886)
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+PREPROCESSOR=../bin/preprocessor.exe
+
+if [ $# -ne 3 ]
+then
+    echo "Usage:"
+	echo "preprocess_visibility scene_file.x3d viewcells_file.xml output_file.xml"
+    exit
+fi
+
+
+NUM_SAMPLE_RAYS=5000000
+
+$PREPROCESSOR -rss_vss_samples=$NUM_SAMPLE_RAYS \
+-scene_filename=$1 -view_cells_filename=$2 -preprocessor_visibility_file=$3 preprocess_visibility.env 
Index: /GTP/trunk/Lib/Vis/Preprocessing/scripts/script_power_plant
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/scripts/script_power_plant	(revision 886)
+++ /GTP/trunk/Lib/Vis/Preprocessing/scripts/script_power_plant	(revision 886)
@@ -0,0 +1,42 @@
+#!/bin/sh
+PROGRAM=../src/release/Preprocessor.exe
+
+#SCENE=soda5
+SCENE=power_plant
+#SCENE=atlanta
+#SCENE=vienna
+
+LOG_PREFIX=../scripts/tests/egsr06/$SCENE-1204
+
+ENVIRONMENT=$SCENE.env
+
+################################################################
+#                          kdtree                              #
+################################################################
+
+#
+# only driving axis and breath-first split (similar to grid)
+#
+
+METHOD=kd
+
+echo "$SCENE $METHOD"
+
+$PROGRAM $ENVIRONMENT \
+-view_cells_type=vspBspTree \
+-view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \
+-view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \
+-vsp_bsp_subdivision_stats=$LOG_PREFIX-$METHOD-subdivisionStats.log \
+-view_cells_construction_samples=0 \
+-view_cells_post_process_merge=false \
+-vsp_bsp_split_only_driving_axis=true \
+-vsp_bsp_use_cost_heuristics=false \
+-vsp_bsp_max_poly_candidates=0 \
+-vsp_bsp_use_split_cost_queue=false \
+-vsp_bsp_node_queue_type=0 \
+-vsp_bsp_construction_samples=100 \
+-vsp_bsp_term_max_view_cells=50000 \
+-view_cells_prune_empty=true \
+-view_cells_filename=$LOG_PREFIX-$METHOD-viewCells.xml
+
+ mv debug.log $LOG_PREFIX-$METHOD-debug.log
