Changeset 474 for trunk/VUT/GtpVisibilityPreprocessor
- Timestamp:
- 12/21/05 10:53:47 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env
r473 r474 153 153 154 154 height 5.0 155 maxViewCells 5000155 maxViewCells 3000 156 156 157 157 PostProcessing { … … 236 236 237 237 # maximal candidates for split planes 238 maxPolyCandidates 50239 maxRayCandidates 50238 maxPolyCandidates 100 239 maxRayCandidates 100 240 240 241 241 # maximal tested rays for split cost heuristics … … 251 251 Termination { 252 252 # parameters used for autopartition 253 minRays 10 0253 minRays 10 254 254 minPolygons -1 255 255 maxDepth 30 256 minPvs 100257 minArea 0.0 1256 minPvs 20 257 minArea 0.0001 258 258 maxRayContribution 0.005 259 259 maxCostRatio 0.9 260 missTolerance 1260 missTolerance 3 261 261 #maxAccRayLength 100 262 262 -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r473 r474 344 344 345 345 app << "#N_SPLITS ( Number of splits )\n" << splits << "\n"; 346 347 app << "#N_PMAXDEPTHLEAVES ( Percentage of leaves at maximum depth )\n"348 << maxDepthNodes * 100 / (double)Leaves() << endl;349 346 350 347 app << "#N_PMAXDEPTHLEAVES ( Percentage of leaves at maximum depth )\n" -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp
r473 r474 268 268 const int limit = min(mConstructionSamples, (int)sourceRays.size()); 269 269 270 Debug << "size: " << sourceRays.size() << " limit " << limit << endl;271 270 VssRayContainer::const_iterator it, it_end = sourceRays.end(); 272 271 … … 478 477 479 478 } 480 481 479 482 480 cout << "starting post processing using " << mPostProcessSamples << " samples ... "; … … 1422 1420 1423 1421 GetRaySets(rays, constructionRays, savedRays); 1424 Debug << "rays " << rays.size() << " construction rays " << constructionRays.size() << endl;1422 1425 1423 mVspBspTree->Construct(constructionRays); 1426 1427 1424 mVspBspTree->CollectViewCells(mViewCells); 1428 1425 … … 1631 1628 bool exportGeometry = false; 1632 1629 1633 Debug << "here344" << endl;1634 1630 environment->GetBoolValue("VspBspTree.Visualization.exportRays", exportRays); 1635 1631 environment->GetBoolValue("VspBspTree.Visualization.exportGeometry", exportGeometry); … … 1687 1683 ObjectPvsMap::iterator it = vc->GetPvs().mEntries.begin(); 1688 1684 1689 exporter->SetWireframe();1690 //exporter->SetFilled();1685 //exporter->SetWireframe(); 1686 exporter->SetFilled(); 1691 1687 1692 1688 Material m;//= RandomMaterial(); … … 1843 1839 } 1844 1840 } 1845 Debug << "here222211" << endl;1846 1841 } 1847 1842 -
trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp
r473 r474 38 38 mRoot(NULL), 39 39 mPvsUseArea(true), 40 m NumCriteria(0)40 mCostNormalizer(Limits::Small) 41 41 { 42 42 mRootCell = new BspViewCell(); … … 91 91 Debug << "max polygon candidates: " << mMaxPolyCandidates << endl; 92 92 Debug << "max plane candidates: " << mMaxRayCandidates << endl; 93 93 94 94 Debug << "Split plane strategy: "; 95 95 if (mSplitPlaneStrategy & RANDOM_POLYGON) 96 { 96 97 Debug << "random polygon "; 97 98 } 98 99 if (mSplitPlaneStrategy & AXIS_ALIGNED) 99 100 { 100 ++ mNumCriteria;101 101 Debug << "axis aligned "; 102 102 } 103 103 if (mSplitPlaneStrategy & LEAST_RAY_SPLITS) 104 104 { 105 ++ mNumCriteria;105 mCostNormalizer += mLeastRaySplitsFactor; 106 106 Debug << "least ray splits "; 107 107 } 108 108 if (mSplitPlaneStrategy & BALANCED_RAYS) 109 109 { 110 ++ mNumCriteria;110 mCostNormalizer += mBalancedRaysFactor; 111 111 Debug << "balanced rays "; 112 112 } 113 113 if (mSplitPlaneStrategy & PVS) 114 114 { 115 ++ mNumCriteria;115 mCostNormalizer += mPvsFactor; 116 116 Debug << "pvs"; 117 117 } … … 273 273 } 274 274 275 mTermMinArea *= mBox.SurfaceArea(); // normalize 275 276 mStat.polys = (int)polys.size(); 276 277 … … 315 316 316 317 tStack.pop(); 317 318 318 // subdivide leaf node 319 319 BspNode *r = Subdivide(tStack, tData); … … 412 412 ++ maxCostMisses; 413 413 414 /*if (maxCostMisses >= mTermMissTolerance)414 if (maxCostMisses >= mTermMissTolerance) 415 415 { 416 416 // terminate branch because of max cost 417 417 ++ mStat.maxCostNodes; 418 418 return leaf; 419 } */419 } 420 420 } 421 421 … … 471 471 mEpsilon); 472 472 473 // area is normalized with view space area 474 frontData.mArea = frontData.mGeometry->GetArea() / mBox.SurfaceArea(); 475 backData.mArea = backData.mGeometry->GetArea() / mBox.SurfaceArea(); 473 frontData.mArea = frontData.mGeometry->GetArea(); 474 backData.mArea = backData.mGeometry->GetArea(); 476 475 } 477 476 … … 810 809 const int candidateIdx = (int)RandomValue(0, (Real)(-- maxIdx)); 811 810 //Debug << "current Idx: " << maxIdx << " cand idx " << candidateIdx << endl; 812 811 813 812 Polygon3 *poly = (*data.mPolygons)[candidateIdx]; 814 813 815 814 // swap candidate to the end to avoid testing same plane 816 815 std::swap((*data.mPolygons)[maxIdx], (*data.mPolygons)[candidateIdx]); 817 816 818 817 //Polygon3 *poly = (*data.mPolygons)[(int)RandomValue(0, (int)polys.size() - 1)]; 819 818 … … 829 828 } 830 829 831 //Debug << "lowest: " << lowestCost << endl;832 833 830 //-- choose candidate planes extracted from rays 834 // we use different methods chosen with 835 // equal probability 831 //-- different methods are available 836 832 for (int i = 0; i < mMaxRayCandidates; ++ i) 837 833 { 838 834 plane = ChooseCandidatePlane3(*data.mRays); 839 840 835 const float candidateCost = SplitPlaneCost(plane, data); 841 836 … … 846 841 } 847 842 } 843 844 #ifdef _DEBUG 845 Debug << "plane lowest cost: " << lowestCost << endl; 846 #endif 848 847 849 848 // cost ratio miss 850 849 if (lowestCost > mTermMaxCostRatio) 851 850 return false; 852 853 #ifdef _DEBUG854 Debug << "plane lowest cost: " << lowestCost << endl;855 #endif856 851 857 852 return true; … … 1011 1006 { 1012 1007 const float oldCost = pOverall * (float)data.mPvs + Limits::Small; 1013 1014 cost += mPvsFactor * (frontPvs * pFront + (backPvs * pBack)) / oldCost; 1015 1016 // give penalty to unbalanced split 1017 if (0) 1018 if (((pFront * 0.2 + Limits::Small) > pBack) || 1019 (pFront < (pBack * 0.2 + Limits::Small))) 1020 cost += 0.5; 1008 cost += mPvsFactor * (frontPvs * pFront + backPvs * pBack) / oldCost; 1009 1010 //cost += mPvsFactor * 0.5 * (frontPvs * pFront + backPvs * pBack) / oldCost; 1011 //Debug << "new cost: " << cost << " over" << frontPvs * pFront + backPvs * pBack << " old cost " << oldCost << endl; 1012 1013 if (0) // give penalty to unbalanced split 1014 if (((pFront * 0.2 + Limits::Small) > pBack) || 1015 (pFront < (pBack * 0.2 + Limits::Small))) 1016 cost += 0.5; 1021 1017 } 1022 1018 1023 1019 #ifdef _DEBUG 1024 // Debug << "totalpvs: " << pvs << " ptotal: " << pOverall1025 //<< " frontpvs: " << frontPvs << " pFront: " << pFront1026 //<< " backpvs: " << backPvs << " pBack: " << pBack << endl << endl;1020 Debug << "totalpvs: " << data.mPvs << " ptotal: " << pOverall 1021 << " frontpvs: " << frontPvs << " pFront: " << pFront 1022 << " backpvs: " << backPvs << " pBack: " << pBack << endl << endl; 1027 1023 #endif 1028 1029 // normalize by number of criteria1030 return cost / (float) (mNumCriteria + Limits::Small);1024 1025 // normalize cost by sum of linear factors 1026 return cost / (float)mCostNormalizer; 1031 1027 } 1032 1028 … … 1118 1114 if (data.mDepth < mStat.minDepth) 1119 1115 mStat.minDepth = data.mDepth; 1120 1116 1117 if (data.mDepth >= mTermMaxDepth) 1118 ++ mStat.maxDepthNodes; 1119 1120 if (data.mPvs < mTermMinPvs) 1121 ++ mStat.minPvsNodes; 1122 1123 if ((int)data.mRays->size() < mTermMinRays) 1124 ++ mStat.minRaysNodes; 1125 1126 if (data.GetAvgRayContribution() > mTermMaxRayContribution) 1127 ++ mStat.maxRayContribNodes; 1128 1129 if (data.mArea <= mTermMinArea) 1130 { 1131 //Debug << "area: " << data.mArea / mBox.SurfaceArea() << " min area: " << mTermMinArea / mBox.SurfaceArea() << endl; 1132 ++ mStat.minAreaNodes; 1133 } 1121 1134 // accumulate depth to compute average depth 1122 1135 mStat.accumDepth += data.mDepth; 1123 1124 1125 if (data.mDepth >= mTermMaxDepth)1126 ++ mStat.maxDepthNodes;1127 1128 if (data.mPvs < mTermMinPvs)1129 ++ mStat.minPvsNodes;1130 1131 if ((int)data.mRays->size() < mTermMinRays)1132 ++ mStat.minRaysNodes;1133 1134 if (data.GetAvgRayContribution() > mTermMaxRayContribution)1135 ++ mStat.maxRayContribNodes;1136 1137 if (data.mGeometry->GetArea() <= mTermMinArea)1138 ++ mStat.minAreaNodes;1139 1136 1140 1137 #ifdef _DEBUG -
trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.h
r473 r474 112 112 {} 113 113 114 /** Returns cost of the traversal data. 115 */ 116 float GetCost() const 117 { 118 #if 0 119 return mPvs * mArea; 120 #endif 121 #if 1 122 return (float)(mPvs * (int)mRays->size()); 123 #endif 124 #if 0 125 return (float)mPvs; 126 #endif 127 #if 0 128 return mArea * (float)mRays->size(); 129 #endif 130 } 131 114 132 friend bool operator<(const VspBspTraversalData &a, const VspBspTraversalData &b) 115 133 { 116 #if 0 117 return a.mPvs * a.mArea < b.mPvs * b.mArea; 118 #endif 119 #if 1 120 return a.mPvs * (int)a.mRays->size() < b.mPvs * (int)b.mRays->size(); 121 #endif 122 #if 0 123 return a.mPvs < b.mPvs; 124 #endif 125 #if 0 126 return 127 a.mPvs / (float)(a.mRays->size() + Limits::Small()) 128 > 129 b.mPvs / (float)(b.mRays->size() + Limits::Small()); 130 #endif 131 #if 0 132 return a.mPvs * (int)a.mRays->size() < b.mPvs * (int)b.mRays->size(); 133 #endif 134 return a.GetCost() < b.GetCost(); 134 135 } 135 136 }; … … 544 545 /// maximal number of test rays used to evaluate candidate split plane 545 546 int mMaxTests; 546 /// n umber ofdifferent bsp split plane criteria547 int mNumCriteria;547 /// normalizes different bsp split plane criteria 548 float mCostNormalizer; 548 549 /// maximal number of view cells 549 550 int mMaxViewCells; -
trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.h
r473 r474 477 477 #if 0 478 478 return 479 leafa->rays.size() *a.mBox.GetVolume()479 leafa->rays.size() * a.mBox.GetVolume() 480 480 < 481 leafb->rays.size() *b.mBox.GetVolume();481 leafb->rays.size() * b.mBox.GetVolume(); 482 482 #endif 483 483 #if 1 484 484 return 485 leafa->GetPvsSize() *a.mBox.GetVolume()485 leafa->GetPvsSize() * a.mBox.GetVolume() 486 486 < 487 leafb->GetPvsSize() *b.mBox.GetVolume();487 leafb->GetPvsSize() * b.mBox.GetVolume(); 488 488 #endif 489 489 #if 0 -
trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp
r473 r474 165 165 if (!use2dSampling) { 166 166 Vector3 normal; 167 int i = RandomValue(0, mObjects.size()-1);167 int i = (int)RandomValue(0, (Real)((int)mObjects.size()-1)); 168 168 Intersectable *object = mObjects[i]; 169 169 object->GetRandomSurfacePoint(point, normal); … … 561 561 562 562 mViewCellsManager->Visualize(mObjects, storedRays); 563 564 Debug << "here2" << endl;565 563 } 566 564 … … 569 567 570 568 mRenderSimulator->RenderScene(); 571 Debug << "here3" << endl;569 572 570 SimulationStatistics ss; 573 571 mRenderSimulator->GetStatistics(ss); 574 Debug << "here244" << endl;572 575 573 cout << " finished" << endl; 576 574 cout << ss << endl; … … 579 577 delete vssTree; 580 578 581 Debug << "here4" << endl;582 579 return true; 583 580 }
Note: See TracChangeset
for help on using the changeset viewer.