Changeset 1893 for GTP/trunk/Lib/Vis/Preprocessing/src
- Timestamp:
- 12/14/06 09:16:08 (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
r1890 r1893 585 585 586 586 587 static float AvgRayContribution(const int pvs, const int nRays) 588 { 589 return (float)pvs / (float)nRays; 590 } 591 592 587 593 void BvHierarchy::EvalSubdivisionCandidate(BvhSubdivisionCandidate &splitCandidate, 588 594 bool computeSplitPlane) … … 591 597 { 592 598 const bool sufficientSamples = 593 599 splitCandidate.mParentData.mNumRays > mMinRaysForVisibility; 594 600 595 601 const bool useVisibiliyBasedHeuristics = … … 609 615 const int previousMisses = splitCandidate.mParentData.mMaxCostMisses; 610 616 611 splitCandidate.SetMaxCostMisses( 612 maxCostRatioViolated ?previousMisses + 1 : previousMisses);617 splitCandidate.SetMaxCostMisses(maxCostRatioViolated ? 618 previousMisses + 1 : previousMisses); 613 619 } 614 620 … … 629 635 const int pvsEntriesIncr = EvalPvsEntriesIncr(splitCandidate); 630 636 splitCandidate.SetPvsEntriesIncr(pvsEntriesIncr); 631 632 const int numViewCells = CountViewCells(leaf->mObjects); 633 634 const float avgRayContrib = 635 (float)splitCandidate.mParentData.mNumRays / (float)numViewCells; 636 637 cout << "avgRayContrib: " << avgRayContrib << endl; 637 638 638 #ifdef GTP_DEBUG 639 639 Debug << "old render cost: " << oldRenderCost << endl; … … 642 642 #endif 643 643 644 const float priority = EvalPriority(splitCandidate, 645 oldRenderCost, 646 renderCostDecr); 647 644 float priority = EvalPriority(splitCandidate, 645 oldRenderCost, 646 renderCostDecr); 647 648 // avg ray contri: this leaf is a pvs entry in all the view cells 649 // that see one of the objects. 650 const int numViewCells = CountViewCells(leaf->mObjects); 651 652 const float avgRayContri = 653 AvgRayContribution(numViewCells, splitCandidate.mParentData.mNumRays); 654 655 cout << "avgRayContri: " << avgRayContri << endl; 656 657 // avg ray contri very high. i.e., the result is influenced by undersampling 658 // => decrease priority 659 if (avgRayContri > 99925) 660 { 661 priority /= avgRayContri; 662 } 663 648 664 // compute global decrease in render cost 649 665 splitCandidate.SetPriority(priority); -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r1889 r1893 284 284 285 285 286 float HierarchyManager::AvgRayContribution(const float pvs, const float rays) const287 {288 return (float)pvs / rays;289 }290 291 292 286 void HierarchyManager::EvalSubdivisionStats() 293 287 { -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
r1889 r1893 265 265 266 266 Intersectable *GetIntersectable(Intersectable *obj, const Vector3 &point) const; 267 268 float AvgRayContribution(const float pvs, const float rays) const;269 267 270 268 /** Export object space partition bounding boxes. -
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp
r1845 r1893 827 827 const int maxCostMisses = splitCandidate.mParentData.mMaxCostMisses; 828 828 // max cost threshold violated? 829 splitCandidate.SetMaxCostMisses(maxCostRatioViolated ? maxCostMisses + 1: maxCostMisses); 829 splitCandidate.SetMaxCostMisses(maxCostRatioViolated ? 830 maxCostMisses + 1: maxCostMisses); 830 831 } 831 832 … … 848 849 const float factor = mRenderCostDecreaseWeight; 849 850 850 float priority; 851 852 if (1) 853 { 854 priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 855 if (mHierarchyManager->mConsiderMemory) 856 { 857 priority /= ((float)splitCandidate.GetPvsEntriesIncr() + mMemoryConst); 858 } 859 } 860 else 861 { 862 if (!mHierarchyManager->mConsiderMemory) 863 { 864 priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 865 } 866 else 867 { 868 const float ratio = 869 renderCostDecr / ((float)splitCandidate.GetPvsEntriesIncr() + mMemoryConst); 870 871 priority = factor * ratio + (1.0f - factor) * oldRenderCost; 872 } 851 float priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 852 853 if (mHierarchyManager->mConsiderMemory) 854 { 855 priority /= ((float)splitCandidate.GetPvsEntriesIncr() + mMemoryConst); 856 } 857 858 ///////////// 859 // avg ray contri 860 861 const float avgRayContri = splitCandidate.mParentData.GetAvgRayContribution(); 862 cout << "vsp avgRayContri: " << avgRayContri << endl; 863 864 // avg ray contri very high. i.e., the result is influenced by undersampling 865 // => decrease priority 866 if (avgRayContri > 99925) 867 { 868 priority /= avgRayContri; 873 869 } 874 870 … … 1869 1865 VspLeaf *leaf = dynamic_cast<VspLeaf *>(data.mNode); 1870 1866 1871 1872 1867 if (data.mPvs > mVspStats.maxPvs) 1873 1868 { … … 1885 1880 { 1886 1881 ++ mVspStats.maxDepthNodes; 1887 //Debug << "new max depth: " << mVspStats.maxDepthNodes << endl;1888 1882 } 1889 1883 … … 1908 1902 ++ mCreatedViewCells; 1909 1903 1910 #ifdef GTP GTP_DEBUG1904 #ifdef GTP_DEBUG 1911 1905 Debug << "BSP stats: " 1912 1906 << "Depth: " << data.mDepth << " (max: " << mTermMaxDepth << "), "
Note: See TracChangeset
for help on using the changeset viewer.