- Timestamp:
- 02/08/06 18:25:17 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env
r605 r607 176 176 # samples used for view cell construction 177 177 Construction { 178 samples 2 500000178 samples 2000000 179 179 samplesPerPass 500000 180 180 } 181 181 182 182 #number of active view cells 183 active 2 56183 active 2048 184 184 maxStaticMemory 40 185 185 … … 188 188 189 189 #type kdTree 190 type vspKdTree190 #type vspKdTree 191 191 #type bspTree 192 192 type vspBspTree … … 214 214 refine false 215 215 compress false 216 merge false216 merge true 217 217 } 218 218 … … 304 304 305 305 # maximal candidates for split planes 306 maxPolyCandidates 0306 maxPolyCandidates 200 307 307 308 308 309 309 # maximal tested rays for split cost heuristics 310 maxTests 20000310 maxTests 10000 311 311 312 312 maxTotalMemory 50 … … 320 320 } 321 321 322 usePolygonSplitIfAvailable 0 323 322 324 Termination { 323 325 # parameters used for autopartition 324 minRays -1326 minRays 500 325 327 minPolygons -1 326 maxDepth 40328 maxDepth 25 327 329 minPvs -1 328 330 minProbability 0.0000001 329 maxRayContribution 100000000.2330 maxCostRatio 9.85331 missTolerance 2332 333 maxViewCells 2048331 maxRayContribution 0.3 332 maxCostRatio 0.9 333 missTolerance 3 334 335 maxViewCells 30000 334 336 335 337 # used for pvs criterium … … 337 339 338 340 AxisAligned { 339 minRays 1341 minRays 900000 340 342 maxRayContribution 9.9 341 343 } 342 344 } 343 345 344 splitUseOnlyDrivingAxis true346 splitUseOnlyDrivingAxis false 345 347 346 348 Visualization { -
trunk/VUT/GtpVisibilityPreprocessor/src/Environment.cpp
r599 r607 1909 1909 "false"); 1910 1910 1911 RegisterOption("VspBspTree.usePolygonSplitIfAvailable", 1912 optBool, 1913 "vsp_bsp_usePolygonSplitIfAvailable=", 1914 "true"); 1915 1911 1916 RegisterOption("VspBspTree.Termination.AxisAligned.minRays", 1912 1917 optInt, -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.cpp
r605 r607 497 497 cout << "actual merge starts now ... " << endl; 498 498 499 500 499 mStats << "#Pass\n" << pass << endl 501 500 << "#Merged\n" << mergeStats.merged << endl 502 << "#View cells\n" << realNumActiveViewCells << endl501 << "#ViewCells\n" << realNumActiveViewCells << endl 503 502 << "#RenderCostIncrease\n" << 0 << endl 504 503 << "#TotalRenderCost\n" << totalRenderCost << endl … … 508 507 << "#Deviation\n" << mDeviation << endl 509 508 << "#TotalPvs\n" << totalPvs << endl 510 << "#PvsSizeDecrease\n" << 0 << endl 511 << "#Volume\n" << endl; 509 << "#PvsSizeDecrease\n0" << endl 510 << "#Volume\n" << endl 511 << "#Siblings\n" << mergeStats.siblings << endl; 512 512 513 513 //-- use priority queue to merge leaf pairs … … 604 604 mergedVc->SetMergeCost(totalRenderCost); 605 605 606 #if VC_HISTORY 607 if (mc.mLeftViewCell->IsSibling(mc.mRightViewCell)) 606 if (mViewCellsManager->EqualToSpatialNode(mergedVc)) 608 607 ++ mergeStats.siblings; 609 #endif 608 610 609 if (((mergeStats.merged % statsOut) == 0) || 611 610 (realNumActiveViewCells == mMergeMinViewCells)) -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp
r605 r607 113 113 114 114 115 115 116 /// helper function which destroys rays or copies them into the output ray container 116 117 inline void addOutRays(VssRayContainer &rays, VssRayContainer *outRays) … … 2612 2613 2613 2614 2615 bool VspBspViewCellsManager::EqualToSpatialNode(ViewCell *viewCell) 2616 { 2617 BspNode *node; 2618 return EqualToSpatialNode(viewCell, &node); 2619 } 2620 2621 2622 bool VspBspViewCellsManager::EqualToSpatialNode(ViewCell *viewCell, BspNode **node) 2623 { 2624 if (!viewCell->IsLeaf()) 2625 { 2626 BspViewCell *bspVc = dynamic_cast<BspViewCell *>(viewCell); 2627 2628 *node = bspVc->mLeaf; 2629 return true; 2630 } 2631 else 2632 { 2633 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(viewCell); 2634 2635 // cannot be node of binary tree 2636 if (interior->mChildren.size() != 2) 2637 return false; 2638 2639 ViewCell *left = interior->mChildren[0]; 2640 ViewCell *right = interior->mChildren[1]; 2641 2642 BspNode *leftNode; 2643 BspNode *rightNode; 2644 2645 if (EqualToSpatialNode(left, &leftNode) && EqualToSpatialNode(right, &rightNode)) 2646 { 2647 *node = leftNode->GetParent(); 2648 return leftNode->IsSibling(rightNode); 2649 } 2650 2651 *node = NULL; 2652 2653 return false; 2654 } 2655 } 2656 2657 2614 2658 void VspBspViewCellsManager::RefineViewCells(const VssRayContainer &rays, 2615 2659 const ObjectContainer &objects) -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h
r605 r607 352 352 vector<MergeCandidate> &candidates) = 0; 353 353 354 355 356 void CollectViewCells(const int n) { 357 mNumActiveViewCells = n; 358 mViewCells.clear(); 359 CollectViewCells(); 360 } 354 355 void CollectViewCells(const int n) 356 { 357 mNumActiveViewCells = n; 358 mViewCells.clear(); 359 CollectViewCells(); 360 } 361 362 bool EqualToSpatialNode(ViewCell *viewCell) { return false;} // implemented in subclasses 363 361 364 362 365 363 366 protected: 364 367 365 368 366 369 /** … … 753 756 void CollectMergeCandidates(const VssRayContainer &rays, vector<MergeCandidate> &candidates); 754 757 758 bool EqualToSpatialNode(ViewCell *viewCell); 759 755 760 protected: 761 762 bool EqualToSpatialNode(ViewCell *viewCell, BspNode **node); 756 763 757 764 /** HACK -
trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp
r605 r607 116 116 environment->GetFloatValue("VspBspTree.Construction.renderCostWeight", mRenderCostWeight); 117 117 118 environment->GetBoolValue("VspBspTree.usePolygonSplitIfAvailable", mUsePolygonSplitIfAvailable); 118 119 119 120 mSubdivisionStats.open("subdivisionStats.log"); … … 431 432 432 433 mTotalCost = tData.mPvs * tData.mProbability / mBox.GetVolume(); 433 434 mTotalPvsSize = tData.mPvs; 435 434 436 mSubdivisionStats 435 437 << "#ViewCells\n1\n" << endl 436 438 << "#RenderCostDecrease\n0\n" << endl 437 << "#TotalRenderCost\n" << mTotalCost << endl; 439 << "#TotalRenderCost\n" << mTotalCost << endl 440 << "#AvgRenderCost\n" << mTotalPvsSize << endl; 438 441 439 442 Debug << "total cost: " << mTotalCost << endl; … … 533 536 float cData = tData.mPvs * tData.mProbability;; 534 537 535 538 float costDecr = 536 539 (cFront + cBack - cData) / mBox.GetVolume(); 540 541 int pvsFront = tFrontData.mPvs * tFrontData.mProbability; 542 int pvsBack = tBackData.mPvs * tBackData.mProbability; 543 int pvsData = tData.mPvs * tData.mProbability;; 544 537 545 mTotalCost += costDecr; 546 mTotalPvsSize += tFrontData.mPvs + tBackData.mPvs - tData.mPvs; 538 547 539 548 mSubdivisionStats 540 549 << "#ViewCells\n" << mBspStats.Leaves() << endl 541 550 << "#RenderCostDecrease\n" << -costDecr << endl 542 << "#TotalRenderCost\n" << mTotalCost << endl; 551 << "#TotalRenderCost\n" << mTotalCost << endl 552 << "#AvgRenderCost\n" << mTotalPvsSize / mBspStats.Leaves() << endl; 543 553 } 544 554 … … 1111 1121 } 1112 1122 1123 // cost ratio miss 1124 if (!mUsePolygonSplitIfAvailable || data.mPolygons->empty()) 1125 { 1126 frontData.mIsKdNode = backData.mIsKdNode = false; 1127 if (lowestCost > mTermMaxCostRatio) 1128 return false; 1129 1130 return true; 1131 } 1132 1113 1133 //-- evaluate axis aligned splits 1114 1134 int axis; … … 1361 1381 1362 1382 // only render cost heuristics or combined with standard deviation 1383 const float penaltyOld = EvalPvsPenalty(totalPvs, lowerPvsLimit, upperPvsLimit); 1384 const float penaltyFront = EvalPvsPenalty(pvsFront, lowerPvsLimit, upperPvsLimit); 1385 const float penaltyBack = EvalPvsPenalty(pvsBack, lowerPvsLimit, upperPvsLimit); 1386 1387 const float oldRenderCost = pOverall * (float)penaltyOld + Limits::Small; 1388 const float newRenderCost = penaltyFront * pFront + penaltyBack * pBack; 1389 1390 float oldCost, newCost; 1391 1392 // only render cost 1363 1393 if (1) 1364 1394 { 1365 const float penaltyOld = EvalPvsPenalty(totalPvs, lowerPvsLimit, upperPvsLimit); 1366 const float penaltyFront = EvalPvsPenalty(pvsFront, lowerPvsLimit, upperPvsLimit); 1367 const float penaltyBack = EvalPvsPenalty(pvsBack, lowerPvsLimit, upperPvsLimit); 1368 1369 const float oldRenderCost = pOverall * (float)penaltyOld + Limits::Small; 1370 const float newRenderCost = penaltyFront * pFront + penaltyBack * pBack; 1371 1372 float oldCost, newCost; 1373 1374 // only render cost 1375 if (1) 1376 { 1377 oldCost = oldRenderCost; 1378 newCost = newRenderCost; 1379 } 1380 else // also considering standard deviation 1381 { 1382 // standard deviation is difference of back and front pvs 1383 const float expectedCost = 0.5f * (penaltyFront + penaltyBack); 1384 1385 const float newDeviation = 0.5f * 1386 fabs(penaltyFront - expectedCost) + fabs(penaltyBack - expectedCost); 1387 1388 const float oldDeviation = penaltyOld + Limits::Small; 1389 1390 newCost = mRenderCostWeight * newRenderCost + (1.0f - mRenderCostWeight) * newDeviation; 1391 oldCost = mRenderCostWeight * oldRenderCost + (1.0f - mRenderCostWeight) * oldDeviation; 1392 } 1393 1394 cost += mPvsFactor * newCost / oldCost; 1395 } 1395 oldCost = oldRenderCost; 1396 newCost = newRenderCost; 1397 } 1398 else // also considering standard deviation 1399 { 1400 // standard deviation is difference of back and front pvs 1401 const float expectedCost = 0.5f * (penaltyFront + penaltyBack); 1402 1403 const float newDeviation = 0.5f * 1404 fabs(penaltyFront - expectedCost) + fabs(penaltyBack - expectedCost); 1405 1406 const float oldDeviation = penaltyOld + Limits::Small; 1407 1408 newCost = mRenderCostWeight * newRenderCost + (1.0f - mRenderCostWeight) * newDeviation; 1409 oldCost = mRenderCostWeight * oldRenderCost + (1.0f - mRenderCostWeight) * oldDeviation; 1410 } 1411 1412 cost += mPvsFactor * newCost / oldCost; 1413 1396 1414 } 1397 1415 -
trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.h
r605 r607 706 706 707 707 float mTotalCost; 708 int mTotalPvsSize; 709 708 710 int mSplits; 709 711 … … 711 713 712 714 bool mUseRandomAxis; 715 716 bool mUsePolygonSplitIfAvailable; 717 713 718 private: 714 719
Note: See TracChangeset
for help on using the changeset viewer.