- Timestamp:
- 02/19/06 20:15:02 (19 years ago)
- Location:
- GTP/trunk/Lib/Vis
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/default.env
r652 r654 13 13 #;../data/vienna/vienna-plane.x3d 14 14 # filename ../data/vienna/viewcells-25-sel.x3d 15 #filename ../data/atlanta/atlanta2.x3d15 filename ../data/atlanta/atlanta2.x3d 16 16 # filename ../data/soda/soda.dat 17 filename ../data/soda/soda5.dat17 # filename ../data/soda/soda5.dat 18 18 } 19 19 … … 25 25 type vss 26 26 # type rss 27 detectEmptyViewSpace true27 detectEmptyViewSpace false 28 28 } 29 29 … … 36 36 loadInitialSamples false 37 37 storeInitialSamples false 38 useViewSpaceBox true38 useViewSpaceBox false 39 39 # testBeamSampling true 40 40 } … … 184 184 maxStaticMemory 40 185 185 186 exportToFile false187 loadFromFile true186 exportToFile true 187 loadFromFile false 188 188 189 189 #type kdTree … … 213 213 useRaysForMerge false 214 214 refine false 215 compress true216 merge false215 compress false 216 merge true 217 217 } 218 218 … … 288 288 VspBspTree { 289 289 Construction { 290 samples 50000290 samples 300000 291 291 epsilon 0.0005 292 292 randomize false … … 301 301 # pvs = 1024 302 302 303 splitPlaneStrategy 102 4303 splitPlaneStrategy 1026 304 304 305 305 # maximal candidates for split planes … … 330 330 maxCostRatio 1.8 331 331 missTolerance 6 332 333 maxViewCells 100 332 globalCostMissTolerance 4 333 minGlobalCostRatio 0.0000001 334 maxViewCells 40000 334 335 335 336 # used for pvs criterium … … 420 421 minProbability 0.00001 421 422 maxRayContribution 9999 422 maxViewCells 1000 423 maxViewCells 10000 423 424 424 425 # used for pvs criterium -
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r612 r654 1811 1811 /************************************************************************************/ 1812 1812 1813 RegisterOption("VspBspTree.Termination.minGlobalCostRatio", 1814 optFloat, 1815 "vsp_bsp_term_min_global_cost_ratio", 1816 "0.0001"); 1817 1818 RegisterOption("VspBspTree.Termination.globalCostMissTolerance", 1819 optInt, 1820 "vsp_bsp_term_global_cost_miss_tolerance", 1821 "4"); 1813 1822 1814 1823 RegisterOption("VspBspTree.Termination.minPolygons", -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp
r651 r654 414 414 } 415 415 } 416 Debug << "here22" << endl; 416 417 417 418 418 if (viewCellId >= 0) // valid view cell … … 427 427 BspViewCell *viewCell = dynamic_cast<BspViewCell *>(*vit); 428 428 429 Debug << "here44" << endl; 430 429 431 430 if (viewCell->GetId() == viewCellId) 432 431 { … … 447 446 mVspBspTree->PropagateUpValidity(leaf); 448 447 } 449 } Debug << "here33" << endl;448 } 450 449 } 451 450 … … 496 495 void ViewCellsParseHandlers::StartViewCellLeaf(AttributeList& attributes) 497 496 { 498 Debug << "here111" << endl;499 497 BspViewCell *viewCell = new BspViewCell(); 500 498 … … 518 516 void ViewCellsParseHandlers::StartViewCellInterior(AttributeList& attributes) 519 517 { 520 Debug << "here222" << endl;521 518 ViewCellInterior* interior = new ViewCellInterior(); 522 519 -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
r653 r654 91 91 environment->GetFloatValue("VspBspTree.Termination.maxCostRatio", mTermMaxCostRatio); 92 92 93 // HACK 94 mTermMinPolygons = 25; 93 environment->GetFloatValue("VspBspTree.Termination.minGlobalCostRatio", mTermMinGlobalCostRatio); 94 environment->GetIntValue("VspBspTree.Termination.globalCostMissTolerance", mTermGlobalCostMissTolerance); 95 96 // HACK//mTermMinPolygons = 25; 95 97 96 98 //-- factors for bsp tree split plane heuristics … … 389 391 mBspStats.polys = (int)polys.size(); 390 392 393 mGlobalCostMisses = 0; 394 391 395 cout << "finished" << endl; 392 396 … … 395 399 << TimeDiff(startTime, GetTime())*1e-3 << " secs" << endl << endl; 396 400 397 Construct(polys, rays); 401 if (0) 402 ConstructWithSplitQueue(polys, rays); 403 else 404 Construct(polys, rays); 398 405 399 406 // clean up polygons … … 496 503 << TimeDiff(startTime, GetTime())*1e-3 << "s" << endl; 497 504 498 if (mBspStats.Leaves() == nLeaves)505 if (mBspStats.Leaves() >= nLeaves) 499 506 { 500 507 nLeaves += 500; … … 523 530 524 531 525 void VspBspTree::ConstructWithSplitQueue Queue(const PolygonContainer &polys,532 void VspBspTree::ConstructWithSplitQueue(const PolygonContainer &polys, 526 533 RayInfoContainer *rays) 527 534 { … … 551 558 tQueue.push(splitCandidate); 552 559 553 554 560 mTotalCost = tData.mPvs * tData.mProbability / mBox.GetVolume(); 555 561 mTotalPvsSize = tData.mPvs; … … 558 564 << "#ViewCells\n1\n" << endl 559 565 << "#RenderCostDecrease\n0\n" << endl 566 << "#dummy\n0\n" << endl 560 567 << "#TotalRenderCost\n" << mTotalCost << endl 561 568 << "#AvgRenderCost\n" << mTotalPvsSize << endl; … … 583 590 tQueue.pop(); 584 591 592 // cost ratio of cost decrease / totalCost 593 float costRatio = splitCandidate.GetCost() / mTotalCost; 594 595 Debug << "cost ratio: " << costRatio << endl; 596 597 if (costRatio < mTermMinGlobalCostRatio) 598 {Debug << "here1 cost ratio: " << costRatio << " max " << mTermMinGlobalCostRatio << endl; 599 ++ mGlobalCostMisses; 600 } 585 601 if (0 && !mOutOfMemory) 586 602 { … … 601 617 << TimeDiff(startTime, GetTime())*1e-3 << "s" << endl; 602 618 603 if (mBspStats.Leaves() == nLeaves)619 if (mBspStats.Leaves() >= nLeaves) 604 620 { 605 621 nLeaves += 500; … … 627 643 628 644 629 bool VspBspTree:: TerminationCriteriaMet(const VspBspTraversalData &data) const645 bool VspBspTree::LocalTerminationCriteriaMet(const VspBspTraversalData &data) const 630 646 { 631 647 return … … 633 649 (data.mPvs <= mTermMinPvs) || 634 650 (data.mProbability <= mTermMinProbability) || 635 (mBspStats.Leaves() >= mMaxViewCells) ||636 #if 0637 (((int)data.mPolygons->size() <= mTermMinPolygons) && !data.mPolygons->empty())||638 #endif639 651 (data.GetAvgRayContribution() > mTermMaxRayContribution) || 640 652 (data.mDepth >= mTermMaxDepth)); … … 642 654 643 655 656 bool VspBspTree::GlobalTerminationCriteriaMet(const VspBspTraversalData &data) const 657 { 658 return 659 (mOutOfMemory 660 || (mBspStats.Leaves() >= mMaxViewCells) 661 || (mGlobalCostMisses >= mTermGlobalCostMissTolerance) 662 ); 663 } 664 665 666 644 667 BspNode *VspBspTree::Subdivide(VspBspTraversalQueue &tQueue, 645 668 VspBspTraversalData &tData) … … 647 670 BspNode *newNode = tData.mNode; 648 671 649 if (! mOutOfMemory && !TerminationCriteriaMet(tData))672 if (!LocalTerminationCriteriaMet(tData) && !GlobalTerminationCriteriaMet(tData)) 650 673 { 651 674 PolygonContainer coincident; … … 786 809 BspNode *newNode = tData.mNode; 787 810 788 if (! mOutOfMemory && !TerminationCriteriaMet(tData))811 if (!LocalTerminationCriteriaMet(tData) && !GlobalTerminationCriteriaMet(tData)) 789 812 { 790 813 PolygonContainer coincident; … … 801 824 // create new interior node and two leaf node 802 825 const Plane3 splitPlane = splitCandidate.mSplitPlane; 803 826 804 827 newNode = SubdivideNode(splitPlane, tData, tFrontData, tBackData, coincident); 805 828 806 829 #if 0 // TODO 807 if (splitAxis < 3) 808 ++ mBspStats.splits[splitAxis]; 809 else 810 ++ mBspStats.polySplits; 811 812 tFrontData.mIsKdNode = tBackData.mIsKdNode = (tData.mIsKdNode && splitAxis < 3); 813 // how often was max cost ratio missed in this branch? 814 tFrontData.mMaxCostMisses = maxCostMisses; 815 tBackData.mMaxCostMisses = maxCostMisses; 830 if (splitAxis < 3) 831 ++ mBspStats.splits[splitAxis]; 832 else 833 ++ mBspStats.polySplits; 834 835 tFrontData.mIsKdNode = tBackData.mIsKdNode = (tData.mIsKdNode && splitAxis < 3); 836 // how often was max cost ratio missed in this branch? 837 tFrontData.mMaxCostMisses = maxCostMisses; 838 tBackData.mMaxCostMisses = maxCostMisses; 839 816 840 #endif 817 841 if (1) … … 829 853 mSubdivisionStats 830 854 << "#ViewCells\n" << mBspStats.Leaves() << endl 831 << "#RenderCostDecrease\n" << -costDecr << endl 855 << "#RenderCostDecrease\n" << -costDecr << endl 856 << "#dummy\n" << splitCandidate.GetCost() << endl 832 857 << "#TotalRenderCost\n" << mTotalCost << endl 833 858 << "#AvgRenderCost\n" << (float)mTotalPvsSize / (float)mBspStats.Leaves() << endl; … … 838 863 VspBspSplitCandidate backCandidate; 839 864 840 EvalSplitCandidate(t Data, frontCandidate);841 EvalSplitCandidate(t Data, backCandidate);842 865 EvalSplitCandidate(tFrontData, frontCandidate); 866 EvalSplitCandidate(tBackData, backCandidate); 867 843 868 tQueue.push(frontCandidate); 844 869 tQueue.push(backCandidate); … … 847 872 DEL_PTR(tData.mNode); 848 873 } 874 849 875 850 876 //-- terminate traversal and create new view cell … … 904 930 905 931 BspLeaf *leaf = dynamic_cast<BspLeaf *>(tData.mNode); 932 933 // compute locally best split plane 906 934 SelectPlane(splitData.mSplitPlane, leaf, tData, frontData, backData, splitAxis); 907 935 … … 910 938 DEL_PTR(backData.mGeometry); 911 939 940 // compute global decrease in render cost 912 941 splitData.mRenderCost = EvalRenderCostDecrease(splitData.mSplitPlane, tData); 913 942 splitData.mParentData = tData; … … 966 995 { 967 996 frontData.mProbability = frontData.mGeometry->GetVolume(); 968 backData.mProbability = 997 backData.mProbability = tData.mProbability - frontData.mProbability; 969 998 } 970 999 } … … 1590 1619 int pvsFront = 0; 1591 1620 int pvsBack = 0; 1592 int totalPvs = data.mPvs;1621 int totalPvs = 0; 1593 1622 1594 1623 // probability that view point lies in back / front node … … 1649 1678 const float newRenderCost = penaltyFront * pFront + penaltyBack * pBack; 1650 1679 1651 return oldRenderCost - newRenderCost; 1680 //Debug << "decrease: " << oldRenderCost - newRenderCost << endl; 1681 return (oldRenderCost - newRenderCost) / mBox.GetVolume(); 1652 1682 } 1653 1683 … … 1860 1890 if (!obj) 1861 1891 return; 1862 1892 // new object 1863 1893 if ((obj->mMailbox != sFrontId) && 1864 1894 (obj->mMailbox != sBackId) && -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.h
r653 r654 64 64 /// if this node is a kd-node (i.e., boundaries are axis aligned 65 65 bool mIsKdNode; 66 67 66 68 #if OCTREE_HACK // OCTREE HACK 67 69 int mAxis; … … 398 400 const VspBspTraversalData &data) const; 399 401 400 void ConstructWithSplitQueue Queue(const PolygonContainer &polys, RayInfoContainer *rays);402 void ConstructWithSplitQueue(const PolygonContainer &polys, RayInfoContainer *rays); 401 403 402 404 … … 585 587 /** Returns true if tree can be terminated. 586 588 */ 587 inline bool TerminationCriteriaMet(const VspBspTraversalData &data) const; 589 inline bool LocalTerminationCriteriaMet(const VspBspTraversalData &data) const; 590 591 inline bool GlobalTerminationCriteriaMet(const VspBspTraversalData &data) const; 588 592 589 593 /** Computes accumulated ray lenght of this rays. … … 706 710 int mTermMinPolygons; 707 711 712 float mTermMinGlobalCostRatio; 713 int mTermGlobalCostMissTolerance; 714 715 int mGlobalCostMisses; 716 708 717 //-- termination criteria for axis aligned split 709 718 -
GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.cpp
r651 r654 531 531 if (mUseViewSpaceBox) 532 532 { 533 if (1) 533 if (0) 534 { 534 535 mViewSpaceBox = box; 536 } 535 537 else 536 538 {
Note: See TracChangeset
for help on using the changeset viewer.