Changeset 1911 for GTP/trunk/Lib/Vis/Preprocessing/src
- Timestamp:
- 12/19/06 11:09:01 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1909 r1911 621 621 BvhLeaf *leaf = splitCandidate.mParentData.mNode; 622 622 623 if (USE_AVGRAYCONTRI) 624 { 625 // this leaf is a pvs entry in all the view cells 626 // that see one of the objects. 627 const int pvs = CountViewCells(leaf->mObjects); 628 //const int pvs = (int)leaf->mObjects.size(); 629 630 // avg contribution of a ray to a pvs 631 const float avgRayContri = 632 AvgRayContribution(pvs, splitCandidate.mParentData.mNumRays); 633 634 // high avg ray contri, the result is influenced by undersampling 635 splitCandidate.SetAvgRayContri(avgRayContri); 636 } 637 623 638 const float oldProp = EvalViewCellsVolume(leaf->mObjects); 624 639 const float oldRenderCost = EvalRenderCost(leaf->mObjects); 625 640 626 641 // compute global decrease in render cost 627 642 const float newRenderCost = EvalRenderCost(splitCandidate.mFrontObjects) + … … 645 660 renderCostDecr, 646 661 oldRenderCost); 647 648 if (USE_AVGRAYCONTRI)649 {650 // this leaf is a pvs entry in all the view cells651 // that see one of the objects.652 const int pvs = CountViewCells(leaf->mObjects);653 //const int pvs = (int)leaf->mObjects.size();654 655 // avg contribution of a ray to a pvs656 const float avgRayContri =657 AvgRayContribution(pvs, splitCandidate.mParentData.mNumRays);658 659 // high avg ray contri, the result is influenced by undersampling660 // => decrease priority661 if (0 && (avgRayContri > mHierarchyManager->mMaxAvgRayContri))662 {663 const float factor = 1.0f + avgRayContri - mHierarchyManager->mMaxAvgRayContri;664 priority /= factor;665 }666 667 //splitCandidate.SetAvgRayContri(avgRayContri);668 }669 662 670 663 // compute global decrease in render cost … … 1706 1699 //////////////// 1707 1700 //-- surface area heuristics 1701 1708 1702 if (leaf->mObjects.empty()) 1709 1703 return 0.0f; -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r1904 r1911 734 734 735 735 736 float HierarchyManager::EvalPvsCorrectionFactor(const float childPvs, 737 const float totalPvs, 738 const float avgRayContri) const 739 { 740 if (!childPvs || 741 // assume pvs sampled sufficiently => take child pvs 742 (avgRayContri < mMinAvgRayContri)) 743 return 1.0f; 744 745 // assume pvs not sampled sufficiently => take total pvs 746 if (avgRayContri > mMaxAvgRayContri) 747 return totalPvs / childPvs; 748 749 const float factor = 750 (mMaxAvgRayContri - avgRayContri) / 751 (mMaxAvgRayContri - mMinAvgRayContri); 752 753 const float newPvs = factor * childPvs + (1.0f - factor) * totalPvs; 754 755 return newPvs / childPvs; 756 } 757 758 736 759 bool HierarchyManager::ApplySubdivisionCandidate(SubdivisionCandidate *sc, 737 760 SplitQueue &splitQueue, … … 780 803 // high avg ray contri, the result is influenced by undersampling 781 804 // => decrease priority 782 if ( USE_AVGRAYCONTRI && (sc->GetAvgRayContribution() > mMaxAvgRayContri))805 if (0 && USE_AVGRAYCONTRI && (sc->GetAvgRayContribution() > mMaxAvgRayContri)) 783 806 { 784 807 const float factor = 1.0f + sc->GetAvgRayContribution() - mMaxAvgRayContri; -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
r1899 r1911 46 46 #define COUNT_ORIGIN_OBJECTS 1 47 47 #define USE_AVGRAYCONTRI 1 48 49 48 50 /** View space / object space hierarchy statistics. 49 51 */ … … 294 296 void CreateUniqueObjectIds(); 295 297 296 297 float mInitialRenderCost; 298 float EvalPvsCorrectionFactor(const float pvsFront, 299 const float totalPvs, 300 const float avgRayContri) const; 298 301 299 302 … … 534 537 535 538 536 537 539 protected: 538 540 … … 563 565 // the original vsp type 564 566 int mSavedViewSpaceSubdivisionType; 565 /// the current subdivision candidate 566 //SubdivisionCandidate *mCurrentCandidate; 567 567 568 568 569 569 /////////////////// … … 575 575 OspTree *mOspTree; 576 576 577 float mInitialRenderCost; 578 579 float mMaxAvgRayContri; 580 581 float mMinAvgRayContri; 582 577 583 // quick hack: 578 584 public: … … 580 586 BvHierarchy *mBvHierarchy; 581 587 582 float mMaxAvgRayContri;583 584 588 protected: 585 589 -
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp
r1909 r1911 863 863 { 864 864 const int pvs = EvalPvsEntriesSize(*splitCandidate.mParentData.mRays); 865 865 866 const float avgRayContri = (float)pvs / 866 867 ((float)splitCandidate.mParentData.mRays->size() + Limits::Small); 867 868 // high avg ray contri very, the result is influenced by undersampling869 // => decrease priority870 if (0 && (avgRayContri > mHierarchyManager->mMaxAvgRayContri))871 {872 const float factor = 1.0f + avgRayContri - mHierarchyManager->mMaxAvgRayContri;873 priority /= factor;874 }875 868 876 869 splitCandidate.SetAvgRayContribution(avgRayContri); … … 1527 1520 1528 1521 float VspTree::EvalRenderCostDecrease(const AxisAlignedPlane &candidatePlane, 1529 const VspTraversalData &data, 1530 float &normalizedOldRenderCost) const 1522 const VspTraversalData &tData, 1523 float &normalizedOldRenderCost, 1524 const float avgRayContri) const 1531 1525 { 1532 1526 float pvsFront = 0; … … 1582 1576 /////////////////// 1583 1577 //-- evaluate render cost heuristics 1584 1578 #if 0 1585 1579 const float penaltyOld = totalPvs; 1580 1586 1581 const float penaltyFront = pvsFront; 1587 1582 const float penaltyBack = pvsBack; 1588 1583 #else 1584 const float penaltyOld = totalPvs * tData.mPvsCorrectionFactor; 1585 1586 const float frontCorr = mHierarchyManager->EvalPvsCorrectionFactor(pvsFront, penaltyOld, avgRayContri); 1587 const float backCorr = mHierarchyManager->EvalPvsCorrectionFactor(pvsBack, penaltyOld, avgRayContri); 1588 1589 const float penaltyFront = frontCorr; 1590 const float penaltyBack = pvsBack * backCorr;; 1591 #endif 1592 1589 1593 const float oldRenderCost = pOverall * penaltyOld; 1590 1594 const float newRenderCost = penaltyFront * pFront + penaltyBack * pBack;
Note: See TracChangeset
for help on using the changeset viewer.