Changeset 1895
- Timestamp:
- 12/14/06 23:02:53 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1893 r1895 587 587 static float AvgRayContribution(const int pvs, const int nRays) 588 588 { 589 return (float)pvs / ( float)nRays;589 return (float)pvs / ((float)nRays + Limits::Small); 590 590 } 591 591 … … 646 646 renderCostDecr); 647 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; 648 if (0) 649 { 650 // this leaf is a pvs entry in all the view cells 651 // 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 pvs 656 const float avgRayContri = 657 AvgRayContribution(pvs, splitCandidate.mParentData.mNumRays); 658 659 Debug << "bvh avgRayContri: " << avgRayContri << " #pvs: " << pvs << " #rays: " << splitCandidate.mParentData.mNumRays << endl; 660 cout << "bvh avgRayContri: " << avgRayContri << endl; 661 662 // high avg ray contri, the result is influenced by undersampling 663 // => decrease priority 664 if (0 && (avgRayContri > mHierarchyManager->mMaxAvgRayContri)) 665 { 666 const float factor = 1.0f + avgRayContri - mHierarchyManager->mMaxAvgRayContri; 667 cout << "here5 " << factor << endl; 668 669 priority /= factor; 670 } 671 672 //splitCandidate.SetAvgRayContri(avgRayContri); 662 673 } 663 674 -
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r1887 r1895 2645 2645 "true"); 2646 2646 2647 RegisterOption("Hierarchy.Construction.maxAvgRayContri", 2648 optFloat, 2649 "hierarchy_construction_max_avg_raycontri=", 2650 "99999.0"); 2651 2647 2652 ///////////////////////////////////////////////////////////////// 2653 2648 2654 } 2649 2655 -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r1893 r1895 31 31 #define STUPID_METHOD 0 32 32 33 34 33 35 /*******************************************************************/ 34 36 /* class HierarchyManager implementation */ … … 151 153 "Hierarchy.Construction.maxRepairs", mMaxRepairs); 152 154 153 // compare to bytes 155 Environment::GetSingleton()->GetFloatValue( 156 "Hierarchy.Construction.maxAvgRayContri", mMaxAvgRayContri); 157 158 // for comparing it with byte - value 154 159 mTermMaxMemory *= (1024.0f * 1024.0f); 155 160 … … 168 173 Debug << "max steps of same kind: " << mMaxStepsOfSameType << endl; 169 174 Debug << "max repairs: " << mMaxRepairs << endl; 175 Debug << "max avg ray contribution: " << mMaxAvgRayContri << endl; 176 170 177 171 178 switch (mConstructionType) … … 769 776 770 777 // memory size in byte 771 mHierarchyStats.mMemory += (float)ObjectPvs::GetEntrySizeByte() * pvsEntriesIncr; 778 float mem = (float)ObjectPvs::GetEntrySizeByte() * pvsEntriesIncr; 779 780 // high avg ray contri, the result is influenced by undersampling 781 // => decrease priority 782 if (0 && (sc->GetAvgRayContribution() > mMaxAvgRayContri)) 783 { 784 const float factor = 1.0f + sc->GetAvgRayContribution() - mMaxAvgRayContri; 785 cout << "here5 " << factor << endl; 786 787 mem *= factor; 788 } 789 790 mHierarchyStats.mMemory += mem; 772 791 mHierarchyStats.mRenderCostDecrease = sc->GetRenderCostDecrease(); 773 792 774 793 mPriority = sc->GetPriority(); 794 795 ////////// 796 // show current memory 775 797 776 798 static float memoryCount = 0; -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
r1893 r1895 575 575 OspTree *mOspTree; 576 576 577 public: 577 // quick hack: 578 public: 578 579 /// bounding volume hierarchy 579 580 BvHierarchy *mBvHierarchy; 580 581 582 float mMaxAvgRayContri; 583 581 584 protected: 582 585 -
GTP/trunk/Lib/Vis/Preprocessing/src/SubdivisionCandidate.h
r1733 r1895 22 22 enum {OBJECT_SPACE, VIEW_SPACE}; 23 23 24 SubdivisionCandidate(): mRenderCostDecrease(0), mDirty(true) {}; 24 SubdivisionCandidate(): 25 mRenderCostDecrease(0), 26 mAvgRayContribution(0), 27 mDirty(true) 28 {} 25 29 26 30 virtual ~SubdivisionCandidate() {}; 31 27 32 /** Evaluate this subdivision candidate. 28 33 */ 29 34 virtual void EvalCandidate(bool computeSplitplane = true) = 0; 35 30 36 /** Returns type of this subdivision candidate. 31 37 */ 32 38 virtual int Type() const = 0; 39 33 40 /** Evaluate this candidate and put results into queue for further traversal. 34 41 */ 35 42 virtual bool Apply(SplitQueue &splitQueue, bool terminationCriteriaMet) = 0; 43 36 44 /** Returns true of the global termination criteria of this split were met, 37 45 false otherwise. 38 46 */ 39 47 virtual bool GlobalTerminationCriteriaMet() const = 0; 48 40 49 /** Collects subdivision candidates that were affected by the 41 50 application of this one. … … 54 63 { 55 64 return mRenderCostDecrease; 65 } 66 67 /** The average ray contribution of this candidate . 68 This is somewhat of a confidence value into the computed values. If 69 it is high, there is likely to be a lot of undersampling. 70 */ 71 inline void SetAvgRayContribution(const float rayContri) 72 { 73 mAvgRayContribution = rayContri; 74 } 75 76 inline float GetAvgRayContribution() const 77 { 78 return mAvgRayContribution; 56 79 } 57 80 … … 139 162 int mPvsEntriesIncr; 140 163 164 /// the average ray contribution of this candidate 165 float mAvgRayContribution; 166 141 167 int mMailbox; 142 168 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1891 r1895 5108 5108 : ViewCellsManager(vcTree), mHierarchyManager(hm) 5109 5109 { 5110 //cout<<"here4"<<endl;5111 5110 Environment::GetSingleton()->GetIntValue("Hierarchy.Construction.samples", mInitialSamples); 5112 5111 Environment::GetSingleton()->GetBoolValue("ViewCells.compressObjects", mCompressObjects); -
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp
r1893 r1895 856 856 } 857 857 858 858 859 ///////////// 859 860 // avg ray contri 860 861 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; 862 if (0) 863 { 864 const int pvs = EvalPvsEntriesSize(*splitCandidate.mParentData.mRays); 865 const float avgRayContri = (float)pvs / ((float)splitCandidate.mParentData.mRays->size() + Limits::Small); 866 867 Debug << "vsp avgRayContri: " << avgRayContri << " #pvs: " << pvs << " #rays: " << splitCandidate.mParentData.mRays->size() << endl; 868 cout << "vsp avgRayContri: " << avgRayContri << endl; 869 870 // high avg ray contri very, the result is influenced by undersampling 871 // => decrease priority 872 if (0 && (avgRayContri > mHierarchyManager->mMaxAvgRayContri)) 873 { 874 const float factor = 1.0f + avgRayContri - mHierarchyManager->mMaxAvgRayContri; 875 priority /= factor; 876 } 877 878 splitCandidate.SetAvgRayContribution(avgRayContri); 869 879 } 870 880 … … 966 976 parent->ReplaceChildLink(leaf, interior); 967 977 interior->SetParent(parent); 978 968 979 #if WORK_WITH_VIEWCELLS 969 980 // remove "parent" view cell from pvs of all objects (traverse trough rays)
Note: See TracChangeset
for help on using the changeset viewer.