Changeset 1727 for GTP/trunk/Lib/Vis
- Timestamp:
- 11/09/06 03:35:58 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/vsposp_typical.env
r1692 r1727 198 198 199 199 # maximum number of tests per node 200 maxTests 100000200 maxTests 30000 201 201 } 202 202 … … 219 219 useCostHeuristics true 220 220 splitUseOnlyDrivingAxis false 221 222 maxTests 30000 221 223 } 222 224 … … 260 262 # minimal steps of same type: for interleaved, this is only valid for the first few splits 261 263 minStepsOfSameType 100 264 265 # maximal number of repairs 266 maxRepairs 1000 262 267 } 263 268 -
GTP/trunk/Lib/Vis/Preprocessing/scripts/vsposp_typical.sh
r1703 r1727 20 20 #SCENE=vienna 21 21 22 LOG_PREFIX=../scripts/tests/ i3d/$SCENE-heur22 LOG_PREFIX=../scripts/tests/gi/$SCENE-3 23 23 24 24 ENVIRONMENT=$SCENE.env … … 61 61 echo "$SCENE $METHOD" 62 62 63 #$PROGRAM $ENVIRONMENT \63 # $PROGRAM $ENVIRONMENT \ 64 64 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 65 65 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ … … 78 78 79 79 ############################################################################ 80 OBJ_SPLITS= 300080 OBJ_SPLITS=700 81 81 82 82 METHOD=sequential-$OBJ_SPLITS 83 83 echo "$SCENE $METHOD" 84 84 85 $PROGRAM $ENVIRONMENT \ 85 86 $PROGRAM $ENVIRONMENT \ 86 87 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 87 88 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ … … 100 101 echo "$SCENE $METHOD" 101 102 102 $PROGRAM $ENVIRONMENT \103 # $PROGRAM $ENVIRONMENT \ 103 104 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 104 105 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ … … 112 113 113 114 ############################################################################ 114 OBJ_SPLITS= 1000115 OBJ_SPLITS=4000 115 116 116 117 METHOD=sequential-$OBJ_SPLITS 117 118 echo "$SCENE $METHOD" 118 119 119 $PROGRAM $ENVIRONMENT \120 # $PROGRAM $ENVIRONMENT \ 120 121 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 121 122 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ -
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1723 r1727 287 287 Environment::GetSingleton()->GetFloatValue( 288 288 "BvHierarchy.Construction.renderCostDecreaseWeight", mRenderCostDecreaseWeight); 289 290 289 Environment::GetSingleton()->GetBoolValue( 291 290 "BvHierarchy.Construction.useGlobalSorting", mUseGlobalSorting); 292 293 291 Environment::GetSingleton()->GetIntValue("BvHierarchy.minRaysForVisibility", mMinRaysForVisibility); 294 292 Environment::GetSingleton()->GetIntValue("BvHierarchy.maxTests", mMaxTests); 293 295 294 //mUseBboxAreaForSah = false; 296 295 mUseBboxAreaForSah = true; … … 1183 1182 #endif 1184 1183 1185 /////////////////////// ////////////////////////////1184 /////////////////////// 1186 1185 //-- the sweep heuristics 1187 1186 //-- traverse through events and find best split plane … … 1320 1319 1321 1320 1322 float BvHierarchy::PrepareHeuristics(const BvhTraversalData &tData, const int axis) 1321 float BvHierarchy::PrepareHeuristics(const BvhTraversalData &tData, 1322 const int axis) 1323 1323 { 1324 1324 BvhLeaf *leaf = tData.mNode; … … 1328 1328 PrepareLocalSubdivisionCandidates(tData, axis); 1329 1329 1330 VssRayContainer rays; 1331 rays.reserve(tData.mNumRays); 1332 CollectRays(tData.mNode->mObjects, rays); 1333 1334 const float prop = (float)mMaxTests / (float)tData.mNumRays; 1335 1336 VssRay::NewMail(); 1337 1338 // only use a subset of the rays 1339 VssRayContainer::const_iterator rit, rit_end = rays.end(); 1340 1341 for (rit = rays.begin(); rit != rit_end; ++ rit) 1342 { 1343 if ((mMaxTests >= tData.mNumRays) || (Random(1.0f) < prop)) 1344 { 1345 (*rit)->Mail(); 1346 } 1347 } 1348 1330 1349 // collect and mark the view cells as belonging to front pvs 1331 1350 ViewCellContainer viewCells; 1332 CollectViewCells(tData.mNode->mObjects, viewCells, true );1351 CollectViewCells(tData.mNode->mObjects, viewCells, true, true); 1333 1352 1334 1353 ViewCellContainer::const_iterator vit, vit_end = viewCells.end(); … … 1361 1380 const bool useMailboxing = false; 1362 1381 1363 CollectViewCells(obj, viewCells, useMailboxing );1382 CollectViewCells(obj, viewCells, useMailboxing, true, true); 1364 1383 1365 1384 // classify view cells and compute volume contri accordingly … … 1666 1685 void BvHierarchy::CollectViewCells(const ObjectContainer &objects, 1667 1686 ViewCellContainer &viewCells, 1668 const bool setCounter) const 1669 { 1670 // no view cells yet 1671 if (0 && mHierarchyManager->GetViewSpaceSubdivisionType() == 1672 HierarchyManager::NO_VIEWSPACE_SUBDIV) 1673 return; 1674 1687 const bool setCounter, 1688 const bool onlyMailedRays) const 1689 { 1675 1690 ViewCell::NewMail(); 1676 1691 ObjectContainer::const_iterator oit, oit_end = objects.end(); … … 1679 1694 for (oit = objects.begin(); oit != oit_end; ++ oit) 1680 1695 { 1681 CollectViewCells(*oit, viewCells, true, setCounter); 1696 // always use only mailed objects 1697 CollectViewCells(*oit, viewCells, true, setCounter, onlyMailedRays); 1682 1698 } 1683 1699 } … … 1687 1703 ViewCellContainer &viewCells, 1688 1704 const bool useMailBoxing, 1689 const bool setCounter) const 1705 const bool setCounter, 1706 const bool onlyMailedRays) const 1690 1707 { 1691 1708 VssRayContainer::const_iterator rit, rit_end = obj->GetOrCreateRays()->end(); … … 1694 1711 { 1695 1712 VssRay *ray = (*rit); 1713 1714 if (onlyMailedRays && !ray->Mailed()) 1715 continue; 1716 1717 ray->Mail(); 1718 1696 1719 ViewCellContainer tmpViewCells; 1697 1698 1720 mHierarchyManager->mVspTree->GetViewCells(*ray, tmpViewCells); 1699 1721 … … 1784 1806 ViewCellContainer viewCells; 1785 1807 ViewCell::NewMail(); 1786 CollectViewCells(node->mObjects, viewCells, true );1808 CollectViewCells(node->mObjects, viewCells, true, false); 1787 1809 1788 1810 if (0) cout << "collected " << (int)viewCells.size() << " dirty candidates" << endl; … … 1965 1987 1966 1988 ViewCellContainer viewCells; 1967 CollectViewCells(objects, viewCells); 1989 // here we have to account for all view cells that can 1990 // be seen from the objects 1991 CollectViewCells(objects, viewCells, false, false); 1968 1992 1969 1993 ViewCellContainer::const_iterator vit, vit_end = viewCells.end(); -
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h
r1718 r1727 783 783 void CollectViewCells(const ObjectContainer &objects, 784 784 ViewCellContainer &viewCells, 785 const bool setCounter = false) const; 785 const bool setCounter, 786 const bool onlyMailedRays) const; 786 787 787 788 /** Counts the view cells of this object. note: only … … 799 800 ViewCellContainer &viewCells, 800 801 const bool useMailBoxing, 801 const bool setCounter = false) const; 802 const bool setCounter, 803 const bool onlyMailedRays) const; 802 804 803 805 /** Evaluates increase in pvs size. … … 951 953 952 954 int mMinRaysForVisibility; 955 956 int mMaxTests; 953 957 }; 954 958 -
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r1723 r1727 2458 2458 "bvh_use_cost_heuristics=", 2459 2459 "true"); 2460 2461 2460 2462 2461 RegisterOption("BvHierarchy.useSah", … … 2485 2484 "0"); 2486 2485 2486 RegisterOption("BvHierarchy.maxTests", 2487 optInt, 2488 "bvh_max_tests=", 2489 "50000"); 2490 2487 2491 2488 2492 /*******************************************************************/ … … 2574 2578 "hierarchy_construction_levels=", 2575 2579 "4"); 2576 2580 2581 RegisterOption("Hierarchy.Construction.maxRepairs", 2582 optInt, 2583 "hierarchy_construction_maxRepairs=", 2584 "1000"); 2585 2577 2586 RegisterOption("Hierarchy.Construction.minStepsOfSameType", 2578 2587 optInt, -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r1723 r1727 149 149 "Hierarchy.Termination.maxMemory", mTermMaxMemory); 150 150 151 Environment::GetSingleton()->GetIntValue( 152 "Hierarchy.Construction.maxRepairs", mMaxRepairs); 153 151 154 if (1 && mConsiderMemory2) 152 155 { … … 177 180 Debug << "min steps of same kind: " << mMinStepsOfSameType << endl; 178 181 Debug << "max steps of same kind: " << mMaxStepsOfSameType << endl; 182 Debug << "max repairs: " << mMaxRepairs << endl; 179 183 180 184 switch (mConstructionType) … … 418 422 const int maxSteps = mMaxStepsOfSameType; 419 423 420 SubdivisionCandidate *osc = PrepareObjectSpaceSubdivision(sampleRays, objects); 424 SubdivisionCandidate *osc = 425 PrepareObjectSpaceSubdivision(sampleRays, objects); 421 426 objectSpaceQueue.Push(osc); 422 423 427 424 428 ///////////////////////// … … 430 434 // for first round, use sah splits. Once view space partition 431 435 // has started, use render cost heuristics instead 432 ospSteps = RunConstruction(objectSpaceQueue, dirtyList, NULL, minSteps, maxSteps); 436 ospSteps = RunConstruction(objectSpaceQueue, 437 dirtyList, 438 NULL, 439 minSteps, 440 maxSteps); 441 433 442 cout << "\n" << ospSteps << " object space partition steps taken" << endl; 434 443 … … 474 483 { 475 484 // decide upon next split type 485 if (viewSpaceQueue.Top()->IsDirty()) 486 viewSpaceQueue.Top()->EvalCandidate(); 487 488 if (objectSpaceQueue.Top()->IsDirty()) 489 objectSpaceQueue.Top()->EvalCandidate(); 490 476 491 const float vspPriority = viewSpaceQueue.Top() ? viewSpaceQueue.Top()->GetPriority() : -1e20f; 477 492 const float ospPriority = objectSpaceQueue.Top() ? objectSpaceQueue.Top()->GetPriority() : -1e20f; … … 489 504 SubdivisionCandidateContainer dirtyVspList; 490 505 491 // subdivide object space first 492 // for first round,use sah splits. Once view space partition506 // subdivide object space first for first round, 507 // use sah splits. Once view space partition 493 508 // has started, use render cost heuristics instead 494 const int ospSteps = 495 RunConstruction(objectSpaceQueue, dirtyVspList, viewSpaceQueue.Top(), minSteps, maxSteps); 509 const int ospSteps = RunConstruction(objectSpaceQueue, 510 dirtyVspList, 511 viewSpaceQueue.Top(), 512 minSteps, 513 maxSteps); 496 514 497 515 cout << "\n" << ospSteps << " object space partition steps taken" << endl; … … 501 519 cout << "repairing queue ... " << endl; 502 520 RepairQueue(dirtyVspList, viewSpaceQueue, true); 521 503 522 cout << "\nrepaired " << (int)dirtyVspList.size() << " candidates" << endl; 504 523 } … … 515 534 516 535 // process view space candidates 517 const int vspSteps = 518 RunConstruction(viewSpaceQueue, dirtyOspList, objectSpaceQueue.Top(), minSteps, maxSteps); 536 const int vspSteps = RunConstruction(viewSpaceQueue, 537 dirtyOspList, 538 objectSpaceQueue.Top(), 539 minSteps, 540 maxSteps); 519 541 520 542 cout << "\n" << vspSteps << " view space partition steps taken" << endl; … … 527 549 cout << "repairing queue ... " << endl; 528 550 RepairQueue(dirtyOspList, objectSpaceQueue, true); 551 529 552 cout << "repaired " << (int)dirtyOspList.size() << " candidates" << endl; 530 553 } … … 965 988 while (!splitQueue.Empty()) 966 989 { 990 // reevaluate current candidate 991 if (splitQueue.Top()->IsDirty()) 992 splitQueue.Top()->EvalCandidate(); 993 967 994 const float priority = splitQueue.Top()->GetPriority(); 968 995 const float threshold = oldCandidate ? oldCandidate->GetPriority() : 1e20f; … … 975 1002 } 976 1003 977 SubdivisionCandidate *sc = NextSubdivisionCandidate(splitQueue);978 979 1004 //////// 980 1005 //-- subdivide leaf node of either type 981 1006 1007 SubdivisionCandidate *sc = NextSubdivisionCandidate(splitQueue); 1008 982 1009 const bool repairQueue = false; 983 1010 const bool success = ApplySubdivisionCandidate(sc, splitQueue, repairQueue); … … 1323 1350 const long startTime = GetTime(); 1324 1351 if (0) cout << "repairing " << (int)dirtyList.size() << " candidates ... "; 1325 1352 1353 const float prop = (float)mMaxRepairs / (float)dirtyList.size(); 1326 1354 1327 1355 /////////////////////////// … … 1332 1360 for (sit = dirtyList.begin(); sit != sit_end; ++ sit) 1333 1361 { 1362 // only repair a certain number of candidates 1363 if ((mMaxRepairs < (int)dirtyList.size()) && (Random(1.0f) >= prop)) 1364 continue; 1365 1334 1366 SubdivisionCandidate* sc = *sit; 1335 1367 const float rcd = sc->GetRenderCostDecrease(); -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
r1723 r1727 625 625 bool mConsiderMemory2; 626 626 627 int mMaxRepairs; 628 627 629 int mTimeStamp; 628 630 friend VspTree; -
GTP/trunk/Lib/Vis/Preprocessing/src/SubdivisionCandidate.h
r1695 r1727 93 93 } 94 94 95 inline bool IsDirty() const 96 { 97 return mDirty; 98 } 95 99 96 100 ////////// -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
r1715 r1727 1333 1333 RayInfoContainer usedRays; 1334 1334 1335 if (mMaxTests < rays.size())1335 if (mMaxTests < (int)rays.size()) 1336 1336 { 1337 1337 GetRayInfoSets(rays, mMaxTests, usedRays); -
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp
r1715 r1727 462 462 Environment::GetSingleton()->GetIntValue("VspTree.maxTests", mMaxTests); 463 463 464 Environment::GetSingleton()->GetFloatValue("VspTree.Construction.renderCostDecreaseWeight", mRenderCostDecreaseWeight); 464 Environment::GetSingleton()-> 465 GetFloatValue("VspTree.Construction.renderCostDecreaseWeight", mRenderCostDecreaseWeight); 465 466 466 467 // if only the driving axis is used for axis aligned split … … 1254 1255 { 1255 1256 // get subset of rays 1256 RayInfoContainer usedRays; 1257 RayInfoContainer randomRays; 1258 randomRays.reserve(mMaxTests); 1259 1260 RayInfoContainer *usedRays; 1257 1261 1258 1262 if (mMaxTests < (int)tData.mRays->size()) 1259 1263 { 1260 GetRayInfoSets(*tData.mRays, mMaxTests, usedRays); 1264 GetRayInfoSets(*tData.mRays, mMaxTests, randomRays); 1265 usedRays = &randomRays; 1261 1266 } 1262 1267 else 1263 1268 { 1264 usedRays = *tData.mRays;1269 usedRays = tData.mRays; 1265 1270 } 1266 1271 … … 1273 1278 const float maxBand = minBox + mMaxBand * sizeBox; 1274 1279 1275 SortSubdivisionCandidates( usedRays, axis, minBand, maxBand);1280 SortSubdivisionCandidates(*usedRays, axis, minBand, maxBand); 1276 1281 1277 1282 // prepare the sweep 1278 1283 // note: returns pvs size => no need t give pvs size as function parameter 1279 const int pvsSize = PrepareHeuristics( usedRays);1284 const int pvsSize = PrepareHeuristics(*usedRays); 1280 1285 1281 1286 // go through the lists, count the number of objects left and right
Note: See TracChangeset
for help on using the changeset viewer.