- Timestamp:
- 02/28/06 20:41:21 (19 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/default.env
r664 r666 13 13 #;../data/vienna/vienna-plane.x3d 14 14 # filename ../data/vienna/viewcells-25-sel.x3d 15 filename ../data/atlanta/atlanta2.x3d15 # filename ../data/atlanta/atlanta2.x3d 16 16 # filename ../data/soda/soda.dat 17 #filename ../data/soda/soda5.dat17 filename ../data/soda/soda5.dat 18 18 } 19 19 … … 177 177 # samples used for view cell construction 178 178 Construction { 179 samples 0180 samplesPerPass 50000179 samples 1000000 180 samplesPerPass 200000 181 181 } 182 182 … … 192 192 #type bspTree 193 193 type vspBspTree 194 195 194 #type sceneDependent 196 195 … … 204 203 processOnlyValidViewCells false 205 204 206 stats viewCellStats.log205 #stats viewCellStats.log 207 206 208 207 samplingType directional 208 #samplingType box 209 209 210 210 PostProcess { … … 219 219 refine false 220 220 compress false 221 merge true 222 statsPrefix ../scripts/viewCells 221 merge false 223 222 } 224 223 … … 231 230 colorCode Random 232 231 exportRays false 233 exportGeometry true232 exportGeometry false 234 233 exportMergedViewCells false 235 234 useClipPlane true … … 237 236 } 238 237 239 evaluateViewCells true 238 showVisualization false 239 evaluateViewCells false 240 240 241 241 Evaluation { 242 samplesPerPass 200000 243 samples 2000000 242 samplesPerPass 800000 243 samples 1000000 244 statsPrefix ../scripts/viewCells 244 245 } 245 246 … … 301 302 VspBspTree { 302 303 Construction { 303 samples 300000304 samples 800000 304 305 epsilon 0.0005 305 306 randomize false … … 317 318 318 319 # maximal candidates for split planes 319 maxPolyCandidates 1 00320 maxPolyCandidates 150 320 321 321 322 usePolygonSplitIfAvailable false 323 322 324 # maximal tested rays for split cost heuristics 323 325 maxTests 10000 … … 325 327 maxTotalMemory 50 326 328 maxStaticMemory 50 327 328 simulateOctree false 329 330 subdivisionStats ../subDivisionStats.log 329 330 subdivisionStats ../subdivisionStats.log 331 331 332 332 # factors for evaluating split plane costs … … 350 350 minGlobalCostRatio 0.0000001 351 351 # minGlobalCostRatio 0.0001 352 maxViewCells 40000352 maxViewCells 20000 353 353 354 354 … … 362 362 } 363 363 364 useSplitCostQueue false 365 364 useSplitCostQueue true 366 365 useCostHeuristics true 366 367 367 splitUseOnlyDrivingAxis false 368 simulateOctree false 369 useRandomAxis false 368 370 usePolygonSplitIfAvailable false 371 useBreathFirstSplits false 369 372 370 373 Visualization { … … 376 379 BspTree { 377 380 Construction { 378 samples 50000381 samples 300000 379 382 epsilon 0.005 380 383 } … … 439 442 # parameters used for autopartition 440 443 minRays -1 441 minPolygons 1444 minPolygons 0 442 445 maxDepth 30 443 446 minPvs -1 444 447 minProbability 0.00001 445 448 maxRayContribution 9999 446 maxViewCells 10000449 maxViewCells 20000 447 450 448 451 # used for pvs criterium -
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r664 r666 1209 1209 "box"); 1210 1210 1211 RegisterOption("ViewCells. stats",1211 RegisterOption("ViewCells.mergeStats", 1212 1212 optString, 1213 "view_cells_ stats=",1214 " viewCellsStats.log");1213 "view_cells_merge_stats=", 1214 "mergeStats.log"); 1215 1215 1216 1216 RegisterOption("ViewCells.Evaluation.statsPrefix", … … 1358 1358 RegisterOption("ViewCells.PostProcess.merge", 1359 1359 optBool, 1360 "view_cells_post_ merge=",1360 "view_cells_post_process_merge=", 1361 1361 "true"); 1362 1362 … … 1376 1376 "false"); 1377 1377 1378 RegisterOption("ViewCells.showVisualization", 1379 optBool, 1380 "view_cells_show_visualization=", 1381 "false"); 1382 1378 1383 RegisterOption("ViewCells.Visualization.clipPlaneAxis", 1379 1384 optInt, … … 1417 1422 RegisterOption("BspTree.subdivisionStats", 1418 1423 optString, 1419 " vsp_bsp_subdivision_stats=",1424 "bsp_subdivision_stats=", 1420 1425 "bspSubdivisionStats.log"); 1421 1426 … … 1907 1912 RegisterOption("VspBspTree.Termination.AxisAligned.maxCostRatio", 1908 1913 optFloat, 1909 " -vsp_bsp_term_axis_aligned_max_cost_ratio=",1914 "vsp_bsp_term_axis_aligned_max_cost_ratio=", 1910 1915 "1.5"); 1911 1916 1912 1917 RegisterOption("VspBspTree.useCostHeuristics", 1913 1918 optBool, 1914 " -vsp_bsp_use_cost_heuristics=",1919 "vsp_bsp_use_cost_heuristics=", 1915 1920 "false"); 1916 1921 1917 1922 RegisterOption("VspBspTree.Termination.maxViewCells", 1918 1923 optInt, 1919 " -vsp_bsp_term_max_view_cells=",1924 "vsp_bsp_term_max_view_cells=", 1920 1925 "1000"); 1921 1926 1922 1927 RegisterOption("VspBspTree.Termination.maxCostRatio", 1923 1928 optFloat, 1924 " -vsp_bsp_term_max_cost_ratio=",1929 "vsp_bsp_term_max_cost_ratio=", 1925 1930 "1.5"); 1926 1931 … … 2002 2007 "false"); 2003 2008 2004 RegisterOption("VspBspTree. breathFirstSplits",2009 RegisterOption("VspBspTree.useBreathFirstSplits", 2005 2010 optBool, 2006 2011 "-vsp_bsp_breath_first_splits=", -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
r664 r666 1866 1866 1867 1867 vc->GetPvs().mEntries.clear(); 1868 1868 1869 1869 if (!vc->IsLeaf()) 1870 1870 { 1871 1871 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc); 1872 1872 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); 1873 1873 1874 for (it = interior->mChildren.begin(); it != it_end; ++ it) 1874 1875 { -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.cpp
r660 r666 2087 2087 BspNode *farChild = NULL; 2088 2088 2089 const float thresh = 1 ? 1e-6f : 0.0f; 2090 2089 2091 while (1) 2090 2092 { … … 2095 2097 Plane3 splitPlane = in->GetPlane(); 2096 2098 2097 const int entSide = splitPlane.Side(entp );2098 const int extSide = splitPlane.Side(extp );2099 const int entSide = splitPlane.Side(entp, thresh); 2100 const int extSide = splitPlane.Side(extp, thresh); 2099 2101 2100 2102 if (entSide < 0) -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.h
r656 r666 1013 1013 }; 1014 1014 1015 1015 1016 struct BspIntersection 1016 1017 { -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r664 r666 66 66 environment->GetBoolValue("ViewCells.PostProcess.merge", mMergeViewCells); 67 67 environment->GetBoolValue("ViewCells.evaluateViewCells", mEvaluateViewCells); 68 68 environment->GetBoolValue("ViewCells.showVisualization", mShowVisualization); 69 69 70 char buf[100]; 70 71 environment->GetStringValue("ViewCells.samplingType", buf); … … 75 76 else if (strcmp(buf, "directional") == 0) 76 77 mSamplingType = Preprocessor::DIRECTION_BASED_DISTRIBUTION; 77 78 #if 0 79 environment->GetStringValue("ViewCells.stats", buf);80 mViewCellsStats.open(buf);81 #endif 78 else 79 { 80 Debug << "error! wrong sampling type" << endl; 81 exit(0); 82 } 82 83 83 84 environment->GetStringValue("ViewCells.Visualization.colorCode", buf); … … 116 117 Debug << "evaluate view cells: " << mEvaluateViewCells << endl; 117 118 Debug << "sampling type: " << mSamplingType << endl; 119 Debug << "show visualization: " << mShowVisualization << endl; 118 120 119 121 Debug << endl; … … 208 210 209 211 // rays can be passed or deleted 212 if (0) // remove!! 210 213 disposeRays(initialSamples, outRays); 211 214 … … 236 239 const int n = mConstructionSamples; //+initialSamples; 237 240 238 bool dirSamples = mSamplingType; 241 // should we use directional samples? 242 bool dirSamples = mSamplingType == Preprocessor::DIRECTION_BASED_DISTRIBUTION; 239 243 240 244 while (numSamples < n) … … 243 247 VssRayContainer constructionSamples; 244 248 245 const int samplingType = 246 dirSamples ?249 const int samplingType = mSamplingType; 250 /* dirSamples ? 247 251 Preprocessor::DIRECTION_BASED_DISTRIBUTION : 248 252 Preprocessor::SPATIAL_BOX_BASED_DISTRIBUTION; 249 253 */ 250 254 if (0) 251 dirSamples = !dirSamples; // toggle sampling method255 dirSamples = !dirSamples; // toggle sampling method 252 256 numSamples += CastPassSamples(mSamplesPerPass, 253 mSamplingType,257 samplingType, 254 258 constructionSamples); 255 259 … … 294 298 295 299 296 // store view Cells for postprocessing300 // store view cells for postprocessing 297 301 const bool storeViewCells = true; 298 302 … … 306 310 307 311 //-- visualization 308 VssRayContainer visualizationSamples; 309 310 //-- construction rays => we use uniform samples for this 311 CastPassSamples(mVisualizationSamples, 312 Preprocessor::DIRECTION_BASED_DISTRIBUTION, 313 visualizationSamples); 314 315 if (SAMPLE_AFTER_SUBDIVISION) 316 ComputeSampleContributions(visualizationSamples, true, storeViewCells); 317 318 // different visualizations 319 Visualize(preprocessor->mObjects, visualizationSamples); 320 321 disposeRays(visualizationSamples, outRays); 312 if (mShowVisualization) 313 { 314 VssRayContainer visualizationSamples; 315 316 //-- construction rays => we use uniform samples for this 317 CastPassSamples(mVisualizationSamples, 318 Preprocessor::DIRECTION_BASED_DISTRIBUTION, 319 visualizationSamples); 320 321 if (SAMPLE_AFTER_SUBDIVISION) 322 ComputeSampleContributions(visualizationSamples, true, storeViewCells); 323 324 // different visualizations 325 Visualize(preprocessor->mObjects, visualizationSamples); 326 327 disposeRays(visualizationSamples, outRays); 328 } 322 329 323 330 if (mEvaluateViewCells) 324 331 { 325 Debug << "Evaluatating view cells!!!" << endl; 326 EvalViewCellPartition(preprocessor); 327 } 328 else 329 Debug << "No evaluation!!" << endl; 332 EvalViewCellPartition(preprocessor); 333 } 334 335 ViewCellContainer leaves; 336 mViewCellsTree->CollectLeaves(mViewCellsTree->GetRoot(), leaves); 337 mViewCellsTree->ResetPvs(); 338 VssRayContainer dummyRays; 339 CastPassSamples(mInitialSamples, mSamplingType, dummyRays); 340 341 //ComputeSampleContributions(initialSamples, true, false); 342 ComputeSampleContributions(dummyRays, true, false); 343 344 ViewCellContainer::const_iterator it, it_end = leaves.end(); 345 346 for (it = leaves.begin(); it != it_end; ++ it) 347 { 348 mViewCellsTree->PropagatePvs(*it); 349 } 350 351 mViewCellsTree->ExportStats("dummy.log"); 330 352 331 353 return numSamples; … … 352 374 353 375 //VssRayContainer outRays; 354 355 int dirSamples = mSamplingType; 356 357 if (0) 358 mViewCellsTree->ResetPvs(); 376 // should directional sampling be used? 377 bool dirSamples = mSamplingType == Preprocessor::DIRECTION_BASED_DISTRIBUTION; 359 378 360 379 cout << "Evaluating view cell partition" << endl; … … 363 382 mViewCellsTree->CollectLeaves(mViewCellsTree->GetRoot(), leaves); 364 383 384 bool startFromZero = true; 385 386 // reset pvs and start over from zero 387 if (startFromZero) 388 { 389 mViewCellsTree->ResetPvs(); 390 } 391 else // statistics without addidtional samples 392 { 393 cout << "compute new statistics ... "; 394 sprintf(s, "-%09d-eval.log", castSamples); 395 string fName = string(statsPrefix) + string(s); 396 397 mViewCellsTree->ExportStats(fName); 398 cout << "finished" << endl; 399 } 400 401 365 402 while (castSamples < numSamples) 366 403 { 367 404 VssRayContainer evaluationSamples; 368 405 369 const int samplingType = 370 dirSamples ?406 const int samplingType = mSamplingType; 407 /* dirSamples ? 371 408 Preprocessor::DIRECTION_BASED_DISTRIBUTION : 372 409 Preprocessor::SPATIAL_BOX_BASED_DISTRIBUTION; 373 410 */ 374 411 //-- construction rays => we use uniform samples for this 375 412 CastPassSamples(samplesPerPass, samplingType, evaluationSamples); … … 987 1024 // if ray not outside of view space 988 1025 float contribution; 989 if (viewcell->GetPvs().GetSampleContribution(ray.mTerminationObject, 1026 if (ray.mTerminationObject && 1027 viewcell->GetPvs().GetSampleContribution(ray.mTerminationObject, 990 1028 ray.mPdf, 991 1029 contribution)) … … 994 1032 ray.mRelativePvsContribution += contribution; 995 1033 } 1034 if (ray.mOriginObject && 1035 viewcell->GetPvs().GetSampleContribution(ray.mOriginObject, 1036 ray.mPdf, 1037 contribution)) 1038 { 1039 ++ ray.mPvsContribution; 1040 ray.mRelativePvsContribution += contribution; 1041 } 996 1042 } 997 1043 } … … 1007 1053 { 1008 1054 // if ray not outside of view space 1009 viewcell->GetPvs().AddSample(ray.mTerminationObject, ray.mPdf); 1055 if (ray.mTerminationObject) 1056 viewcell->GetPvs().AddSample(ray.mTerminationObject, ray.mPdf); 1057 if (ray.mOriginObject) 1058 viewcell->GetPvs().AddSample(ray.mOriginObject, ray.mPdf); 1010 1059 } 1011 1060 } … … 1291 1340 1292 1341 // export statistics after merge 1293 if (0) 1294 mViewCellsTree->ExportStats("mergeStats.log"); 1342 if (1) 1343 { 1344 char mstats[100]; 1345 environment->GetStringValue("ViewCells.mergeStats", mstats); 1346 mViewCellsTree->ExportStats(mstats); 1347 } 1295 1348 1296 1349 //-- stats and visualizations … … 2102 2155 } 2103 2156 2157 2104 2158 ViewCell *KdViewCellsManager::GenerateViewCell(Mesh *mesh) const 2105 2159 { … … 2608 2662 mMaxPvsSize = (int)(mMaxPvsRatio * (float)objects.size()); 2609 2663 2664 //TODO: remove 2665 if(0) 2610 2666 mVspBspTree->Construct(constructionRays, &mViewSpaceBox); 2611 2667 else 2668 mVspBspTree->Construct(rays, &mViewSpaceBox); 2612 2669 // collapse invalid regions 2613 2670 cout << "collapsing invalid tree regions ... "; … … 2667 2724 } 2668 2725 2669 if (0) 2670 mViewCellsTree->ExportStats("mergeStats.log"); 2726 if (1) 2727 { 2728 char mstats[100]; 2729 environment->GetStringValue("ViewCells.mergeStats", mstats); 2730 mViewCellsTree->ExportStats(mstats); 2731 } 2671 2732 2672 2733 //-- stats and visualizations -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r664 r666 480 480 481 481 bool mEvaluateViewCells; 482 483 bool mShowVisualization; 482 484 }; 483 485 -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
r665 r666 23 23 //-- static members 24 24 25 /** Evaluates split plane classification with respect to the plane's26 contribution for a minimum number of ray splits.27 */28 const float VspBspTree::sLeastRaySplitsTable[] = {0, 0, 1, 1, 0};29 /** Evaluates split plane classification with respect to the plane's30 contribution for balanced rays.31 */32 const float VspBspTree::sBalancedRaysTable[] = {1, -1, 0, 0, 0};33 34 25 35 26 int VspBspTree::sFrontId = 0; … … 87 78 environment->GetIntValue("VspBspTree.Termination.missTolerance", mTermMissTolerance); 88 79 environment->GetIntValue("VspBspTree.Termination.maxViewCells", mMaxViewCells); 80 89 81 //-- max cost ratio for early tree termination 90 82 environment->GetFloatValue("VspBspTree.Termination.maxCostRatio", mTermMaxCostRatio); … … 96 88 97 89 //-- factors for bsp tree split plane heuristics 98 environment->GetFloatValue("VspBspTree.Factor.balancedRays", mBalancedRaysFactor);99 90 environment->GetFloatValue("VspBspTree.Factor.pvs", mPvsFactor); 100 91 environment->GetFloatValue("VspBspTree.Termination.ct_div_ci", mCtDivCi); … … 124 115 environment->GetBoolValue("VspBspTree.usePolygonSplitIfAvailable", mUsePolygonSplitIfAvailable); 125 116 126 mSubdivisionStats.open("subdivisionStats.log");127 128 117 environment->GetBoolValue("VspBspTree.useCostHeuristics", mUseCostHeuristics); 129 118 environment->GetBoolValue("VspBspTree.useSplitCostQueue", mUseSplitCostQueue); 130 119 environment->GetBoolValue("VspBspTree.simulateOctree", mSimulateOctree); 131 120 environment->GetBoolValue("VspBspTree.useRandomAxis", mUseRandomAxis); 132 environment->GetBoolValue("VspBspTree. breathFirstSplits", mBreathFirstSplits);121 environment->GetBoolValue("VspBspTree.useBreathFirstSplits", mBreathFirstSplits); 133 122 134 123 char subdivisionStatsLog[100]; 135 environment->GetStringValue(" BspTree.subdivisionStats", subdivisionStatsLog);124 environment->GetStringValue("VspBspTree.subdivisionStats", subdivisionStatsLog); 136 125 mSubdivisionStats.open(subdivisionStatsLog); 137 138 126 139 127 //-- debug output … … 603 591 604 592 long startTime = GetTime(); 605 int nLeaves = 0;606 int nViewCells = 0;593 int nLeaves = 500; 594 int nViewCells = 500; 607 595 608 596 // used for intermediate time measurements and progress … … 841 829 842 830 if (!LocalTerminationCriteriaMet(tData) && !GlobalTerminationCriteriaMet(tData)) 843 { 831 { 844 832 PolygonContainer coincident; 845 833 … … 852 840 853 841 newNode = SubdivideNode(splitPlane, tData, tFrontData, tBackData, coincident); 854 842 855 843 const int splitAxis = splitCandidate.mSplitAxis; 856 844 const int maxCostMisses = splitCandidate.mMaxCostMisses; … … 867 855 tBackData.mMaxCostMisses = maxCostMisses; 868 856 857 869 858 if (1) 870 859 { … … 887 876 } 888 877 878 889 879 //-- push the new split candidates on the stack 890 880 VspBspSplitCandidate frontCandidate; … … 896 886 tQueue.push(frontCandidate); 897 887 tQueue.push(backCandidate); 898 888 899 889 // delete old leaf node 900 890 DEL_PTR(tData.mNode); … … 962 952 VspBspTraversalData backData; 963 953 964 int splitAxis = 0;965 966 954 BspLeaf *leaf = dynamic_cast<BspLeaf *>(tData.mNode); 967 955 968 956 // compute locally best split plane 969 957 bool success = SelectPlane(splitData.mSplitPlane, leaf, tData, 970 frontData, backData, split Axis);958 frontData, backData, splitData.mSplitAxis); 971 959 972 960 // TODO: reuse … … 2989 2977 2990 2978 float t; 2979 const float thresh = 1 ? 1e-6f : 0.0f; 2980 2991 2981 while (1) 2992 2982 { … … 2997 2987 Plane3 splitPlane = in->GetPlane(); 2998 2988 2999 const int entSide = splitPlane.Side(entp );3000 const int extSide = splitPlane.Side(extp );2989 const int entSide = splitPlane.Side(entp, thresh); 2990 const int extSide = splitPlane.Side(extp, thresh); 3001 2991 3002 2992 if (entSide < 0) 3003 2993 { 3004 node = in->GetBack(); 3005 // plane does not split ray => no far child 3006 if (extSide <= 0) 3007 continue; 3008 3009 farChild = in->GetFront(); // plane splits ray 2994 node = in->GetBack(); 2995 2996 // plane does not split ray => no far child 2997 if (extSide <= 0) 2998 continue; 2999 3000 farChild = in->GetFront(); // plane splits ray 3010 3001 } 3011 3002 else if (entSide > 0) 3012 3003 { 3013 3014 3015 3016 continue;3004 node = in->GetFront(); 3005 3006 if (extSide >= 0) // plane does not split ray => no far child 3007 continue; 3017 3008 3018 3009 farChild = in->GetBack(); // plane splits ray 3019 3010 } 3020 else // ray end point onplane3011 else // one of the ray end points on the plane 3021 3012 { // NOTE: what to do if ray is coincident with plane? 3022 3013 if (extSide < 0) … … 3038 3029 // reached leaf => intersection with view cell 3039 3030 BspLeaf *leaf = dynamic_cast<BspLeaf *>(node); 3040 3041 ViewCell *viewCell = mViewCellsTree->GetActiveViewCell(leaf->GetViewCell()); 3031 ViewCell *viewCell; 3032 3033 viewCell = mViewCellsTree->GetActiveViewCell(leaf->GetViewCell()); 3034 //viewCell = leaf->GetViewCell(); 3035 3042 3036 if (!viewCell->Mailed()) 3043 3037 { -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.h
r664 r666 799 799 private: 800 800 801 802 static const float sLeastRaySplitsTable[5];803 /** Evaluates split plane classification with respect to the plane's804 contribution for balanced rays.805 */806 static const float sBalancedRaysTable[5];807 808 801 /// Generates unique ids for PVS criterium 809 802 static void GenerateUniqueIdsForPvs();
Note: See TracChangeset
for help on using the changeset viewer.