Changeset 551
- Timestamp:
- 01/18/06 23:35:50 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env
r550 r551 30 30 samplesPerPass 100000 31 31 initialSamples 300000 32 vssSamples 70000032 vssSamples 1500000 33 33 vssSamplesPerPass 100000 34 34 useImportanceSampling true … … 180 180 181 181 height 5.0 182 maxViewCells 100000182 maxViewCells 3000 183 183 #percentage of total visible objects where pvs is considered invalid 184 maxPvsRatio 0.9184 maxPvsRatio 1.0 185 185 186 186 delayedConstruction true … … 189 189 PostProcess { 190 190 # how much samples are used for post processing 191 samples 200000191 samples 300000 192 192 } 193 193 … … 195 195 # how much samples we use for visualization 196 196 samples 5000 197 colorCode PVS197 #colorCode PVS 198 198 #colorCode MergedLeaves 199 199 #colorCode MergedTreeDiff 200 #colorCode Random200 colorCode Random 201 201 exportRays false 202 202 exportGeometry true … … 259 259 VspBspTree { 260 260 Construction { 261 samples 500000261 samples 1200000 262 262 epsilon 0.005 263 263 randomize false … … 292 292 Termination { 293 293 # parameters used for autopartition 294 minRays 400294 minRays 100 295 295 minPolygons -1 296 296 maxDepth 30 … … 298 298 #minProbability 0.0001 299 299 minProbability -1 300 maxRayContribution 0. 2301 maxCostRatio 0.9 300 maxRayContribution 0.6 301 maxCostRatio 0.99 302 302 missTolerance 3 303 303 #maxAccRayLength 100 304 304 305 maxViewCells 2501305 maxViewCells 3501 306 306 307 307 # used for pvs criterium … … 322 322 323 323 PostProcess { 324 maxCostRatio 0. 000001325 minViewCells 80326 useRaysForMerge true324 maxCostRatio 0.1 325 minViewCells 200 326 useRaysForMerge false 327 327 } 328 328 } -
trunk/VUT/GtpVisibilityPreprocessor/src/RenderSimulator.cpp
r497 r551 77 77 // probability of view cell 78 78 const float pInVc = mViewCellsManager->GetProbability(vc); 79 79 80 // compute render time of PVS times probability 80 81 // that view point is in view cell … … 82 83 mViewCellsManager->GetRendercost(vc, mObjRenderCost); 83 84 84 // crossing the border of a view cell is depending on the move speed85 // and the probability that a view cell border is crossed85 // crossing the border of a view cell is depending on the move 86 // speed and the probability that a view cell border is crossed 86 87 loadPvsOverhead += GetCrossVcProbability() * mVcOverhead; 87 88 -
trunk/VUT/GtpVisibilityPreprocessor/src/RssTree.cpp
r549 r551 219 219 maxDepthNodes*100/(double)Leaves()<<endl; 220 220 221 app << "#N_PMINPVSLEAVES ( Percentage of leaves with min Cost)\n"<<221 app << "#N_PMINPVSLEAVES ( Percentage of leaves with minPvs )\n"<< 222 222 minPvsNodes*100/(double)Leaves()<<endl; 223 223 224 app << "#N_PMINRAYSLEAVES ( Percentage of leaves with min Cost)\n"<<224 app << "#N_PMINRAYSLEAVES ( Percentage of leaves with minRays )\n"<< 225 225 minRaysNodes*100/(double)Leaves()<<endl; 226 226 -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.cpp
r547 r551 10 10 MeshInstance(NULL), 11 11 mPiercingRays(0), 12 mArea( 0),13 mVolume( 0),12 mArea(-1), 13 mVolume(-1), 14 14 mValid(true) 15 15 { … … 19 19 MeshInstance(mesh), 20 20 mPiercingRays(0), 21 mArea( 0),22 mVolume( 0),21 mArea(-1), 22 mVolume(-1), 23 23 mValid(true) 24 24 { -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r547 r551 1509 1509 } 1510 1510 1511 1511 1512 float BspTree::SplitPlaneCost(const Plane3 &candidatePlane, 1512 1513 const BoundedRayContainer &rays, -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp
r547 r551 252 252 253 253 254 void ViewCellsManager::FinalizeViewCells(const bool createMesh) 255 { 256 ViewCellContainer::const_iterator it, it_end = mViewCells.end(); 257 for (it = mViewCells.begin(); it != it_end; ++ it) 258 { 259 Finalize(*it, createMesh); 260 } 261 } 262 263 264 void ViewCellsManager::Finalize(ViewCell *viewCell, const bool createMesh) 265 { 266 // implemented in subclasses 267 } 268 269 254 270 ViewCell *ViewCellsManager::MergeViewCells(ViewCell &front, ViewCell &back) const 255 271 { … … 1145 1161 void BspViewCellsManager::CreateMesh(ViewCell *vc) 1146 1162 { 1147 } 1148 1149 ViewCell * 1150 BspViewCellsManager::GetViewCell(const Vector3 &point) 1163 // TODO 1164 } 1165 1166 1167 ViewCell *BspViewCellsManager::GetViewCell(const Vector3 &point) 1151 1168 { 1152 1169 if (!mBspTree) … … 1445 1462 void KdViewCellsManager::CreateMesh(ViewCell *vc) 1446 1463 { 1464 // TODO 1447 1465 } 1448 1466 … … 1793 1811 void VspKdViewCellsManager::CreateMesh(ViewCell *vc) 1794 1812 { 1813 //TODO 1795 1814 } 1796 1815 … … 1816 1835 float VspBspViewCellsManager::GetProbability(ViewCell *viewCell) 1817 1836 { 1818 if ( mVspBspTree->mUseAreaForPvs)1837 if (0 && mVspBspTree->mUseAreaForPvs) 1819 1838 return GetArea(viewCell) / GetAccVcArea(); 1820 1839 else … … 1865 1884 VssRayContainer savedRays; 1866 1885 1886 Debug << "construction samples: " << mConstructionSamples << " rays: " << rays.size() << endl; 1867 1887 GetRaySets(rays, mConstructionSamples, constructionRays, &savedRays); 1868 1888 … … 1973 1993 if (exporter) 1974 1994 { 1975 //exporter->SetWireframe(); 1976 exporter->SetFilled(); 1995 if (1) 1996 exporter->SetWireframe(); 1997 else 1998 exporter->SetFilled(); 1977 1999 ExportViewCellsForViz(exporter); 1978 2000 … … 2031 2053 if (mViewCellsFinished) 2032 2054 { 2055 FinalizeViewCells(true); 2033 2056 EvaluateViewCellsStats(); 2034 2057 return 0; … … 2049 2072 2050 2073 2051 //-- merge the individual view cells: Should be done here because it makes 2074 if (1) 2075 { 2076 FinalizeViewCells(false); 2077 } 2078 2079 //-- merge the individual view cells 2052 2080 MergeViewCells(postProcessRays, objects); 2053 2081 //-- refines the merged view cells … … 2059 2087 2060 2088 // real meshes are only contructed only at this stage 2061 CreateViewCellMeshes(); 2089 //CreateViewCellMeshes(); 2090 FinalizeViewCells(true); 2062 2091 2063 2092 // write view cells to disc … … 2497 2526 return mVspBspTree->CastBeam(beam); 2498 2527 } 2528 2529 2530 void VspBspViewCellsManager::Finalize(ViewCell *viewCell) 2531 { 2532 BspViewCell *vc = dynamic_cast<BspViewCell *>(viewCell); 2533 CreateMesh(vc); 2534 2535 vector<BspLeaf *>::const_iterator it, it_end = vc->mLeaves.end(); 2536 2537 float area = 0; 2538 float volume = 0; 2539 2540 for (it = vc->mLeaves.begin(); it != it_end; ++ it) 2541 { 2542 BspNodeGeometry geom; 2543 BspLeaf *leaf = *it; 2544 mVspBspTree->ConstructGeometry(leaf, geom); 2545 2546 area += geom.GetArea(); 2547 volume += geom.GetVolume(); 2548 } 2549 2550 viewCell->SetVolume(volume); 2551 viewCell->SetArea(area); 2552 } -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h
r547 r551 216 216 virtual float GetArea(ViewCell *viewCell) const; 217 217 218 /** Returns volume of view cell s.218 /** Returns volume of view cell. 219 219 */ 220 220 virtual float GetVolume(ViewCell *viewCell) const; … … 259 259 int GetMaxPvsSize() const; 260 260 261 262 261 /** Exports view cell geometry. 263 262 */ 264 263 virtual void ExportVcGeometry(Exporter *exporter, ViewCell *vc) const = 0; 265 264 265 virtual void FinalizeViewCells(const bool createMesh); 266 266 267 protected: 267 268 … … 271 272 */ 272 273 void CreateUniqueViewCellIds(); 274 275 /** Finalizes, i.e., creates mesh, volume, area etc. for the view cell. 276 */ 277 virtual void Finalize(ViewCell *viewCell, const bool createMesh); 273 278 274 279 /** Recollects view cells and resets statistics. … … 599 604 void ExportVcGeometry(Exporter *exporter, ViewCell *vc) const; 600 605 606 //float GetVolume(ViewCell *viewCell) const; 607 608 void Finalize(ViewCell *viewCell); 609 601 610 protected: 602 611 -
trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp
r548 r551 83 83 // maximum and minimum number of view cells 84 84 environment->GetIntValue("VspBspTree.Termination.maxViewCells", mMaxViewCells); 85 86 environment->GetBoolValue("VspBspTree.splitUseOnlyDrivingAxis", mOnlyDrivingAxis); 87 88 //-- merge options 85 89 environment->GetIntValue("VspBspTree.PostProcess.minViewCells", mMergeMinViewCells); 86 90 environment->GetFloatValue("VspBspTree.PostProcess.maxCostRatio", mMergeMaxCostRatio); 87 88 environment->GetBoolValue("VspBspTree.splitUseOnlyDrivingAxis", mOnlyDrivingAxis);89 91 environment->GetBoolValue("VspBspTree.PostProcess.useRaysForMerge", mUseRaysForMerge); 90 92 … … 116 118 Debug << "max plane candidates: " << mMaxRayCandidates << endl; 117 119 Debug << "randomize: " << randomize << endl; 118 120 Debug << "minimum view cells: " << mMergeMinViewCells << endl; 121 Debug << "using area for pvs: " << mUseAreaForPvs << endl; 119 122 Debug << "Split plane strategy: "; 120 123 if (mSplitPlaneStrategy & RANDOM_POLYGON) … … 870 873 871 874 //TODO: for kd split geometry already is box 872 if (1 && mUseAreaForPvs)875 if (1) 873 876 { 874 877 PolygonContainer::const_iterator it, it_end = tData.mGeometry->mPolys.end(); … … 1012 1015 { // volume 1013 1016 pBack = pFront = pOverall * 0.5f; 1017 1018 #if 0 1014 1019 // box length substitute for probability 1015 #if 01016 1020 const float minBox = box.Min(axis); 1017 1021 const float maxBox = box.Max(axis); … … 1603 1607 { 1604 1608 ViewCell::NewMail(); 1605 CollectViewCells(mRoot, onlyValid, viewCells); 1609 1610 CollectViewCells(mRoot, onlyValid, viewCells, true); 1606 1611 } 1607 1612 … … 1901 1906 1902 1907 1908 typedef pair<BspNode *, BspNodeGeometry *> bspNodePair; 1909 1903 1910 int VspBspTree::FindNeighbors(BspNode *n, vector<BspLeaf *> &neighbors, 1904 1911 const bool onlyUnmailed) const 1905 1912 { 1906 BspNodeGeometry geom; 1907 ConstructGeometry(n, geom); 1908 1909 stack<BspNode *> nodeStack; 1910 nodeStack.push(mRoot); 1911 1913 stack<bspNodePair> nodeStack; 1914 1915 BspNodeGeometry nodeGeom; 1916 ConstructGeometry(n, nodeGeom); 1917 1912 1918 // split planes from the root to this node 1913 1919 // needed to verify that we found neighbor leaf … … 1915 1921 ExtractHalfSpaces(n, halfSpaces); 1916 1922 1923 1924 BspNodeGeometry *rgeom = new BspNodeGeometry(); 1925 ConstructGeometry(mRoot, *rgeom); 1926 1927 nodeStack.push(bspNodePair(mRoot, rgeom)); 1928 1929 1917 1930 while (!nodeStack.empty()) 1918 1931 { 1919 BspNode *node = nodeStack.top(); 1932 BspNode *node = nodeStack.top().first; 1933 BspNodeGeometry *geom = nodeStack.top().second; 1934 1920 1935 nodeStack.pop(); 1921 1936 1922 if (node->IsLeaf()) 1923 1924 { // test if this leaf is in valid view space 1925 if (node->TreeValid() && 1926 node != n && 1927 (!onlyUnmailed || !node->Mailed())) 1937 bool isAdjacent = true; 1938 1939 // test all planes of current node if still adjacent 1940 for (int i = 0; (i < halfSpaces.size()) && isAdjacent && (node != n); ++ i) 1941 { 1942 const int cf = 1943 Polygon3::ClassifyPlane(geom->mPolys, 1944 halfSpaces[i], 1945 mEpsilon); 1946 1947 if (cf == Polygon3::BACK_SIDE) 1928 1948 { 1929 // test all planes of current node if candidate really 1930 // is neighbour 1931 BspNodeGeometry neighborCandidate; 1932 ConstructGeometry(node, neighborCandidate); 1933 1934 bool isAdjacent = true; 1935 for (int i = 0; (i < halfSpaces.size()) && isAdjacent; ++ i) 1949 isAdjacent = false; 1950 } 1951 } 1952 1953 if (isAdjacent) 1954 { 1955 1956 if (node->IsLeaf()) 1957 { 1958 // test if this leaf is in valid view space 1959 if (node->TreeValid() && 1960 node != n && 1961 (!onlyUnmailed || !node->Mailed())) 1936 1962 { 1937 const int cf = 1938 Polygon3::ClassifyPlane(neighborCandidate.mPolys, 1939 halfSpaces[i], 1940 mEpsilon); 1941 1942 if (cf == Polygon3::BACK_SIDE) 1943 isAdjacent = false; 1963 // neighbor was found 1964 neighbors.push_back(dynamic_cast<BspLeaf *>(node)); 1944 1965 } 1945 // neighbor was found1946 if (isAdjacent)1947 neighbors.push_back(dynamic_cast<BspLeaf *>(node));1948 1966 } 1949 }1950 else1951 {1952 BspInterior *interior = dynamic_cast<BspInterior *>(node);1953 1954 const int cf = Polygon3::ClassifyPlane(geom.mPolys,1955 interior->GetPlane(),1956 mEpsilon);1957 1958 if (cf == Polygon3::FRONT_SIDE)1959 nodeStack.push(interior->GetFront());1960 1967 else 1961 if (cf == Polygon3::BACK_SIDE) 1962 nodeStack.push(interior->GetBack()); 1968 { 1969 BspInterior *interior = dynamic_cast<BspInterior *>(node); 1970 1971 const int cf = Polygon3::ClassifyPlane(nodeGeom.mPolys, 1972 interior->GetPlane(), 1973 mEpsilon); 1974 1975 BspNode *front = interior->GetFront(); 1976 BspNode *back = interior->GetBack(); 1977 1978 BspNodeGeometry *fGeom = new BspNodeGeometry(); 1979 BspNodeGeometry *bGeom = new BspNodeGeometry(); 1980 1981 geom->SplitGeometry(*fGeom, 1982 *bGeom, 1983 interior->GetPlane(), 1984 mBox, 1985 mEpsilon); 1986 1987 if (cf == Polygon3::FRONT_SIDE) 1988 { 1989 nodeStack.push(bspNodePair(interior->GetFront(), fGeom)); 1990 DEL_PTR(bGeom); 1991 } 1963 1992 else 1964 1993 { 1965 // random decision 1966 nodeStack.push(interior->GetBack()); 1967 nodeStack.push(interior->GetFront()); 1994 if (cf == Polygon3::BACK_SIDE) 1995 { 1996 nodeStack.push(bspNodePair(interior->GetBack(), bGeom)); 1997 DEL_PTR(fGeom); 1998 } 1999 else 2000 { // random decision 2001 nodeStack.push(bspNodePair(front, fGeom)); 2002 nodeStack.push(bspNodePair(back, bGeom)); 2003 } 1968 2004 } 1969 } 2005 } 2006 } 2007 2008 DEL_PTR(geom); 1970 2009 } 1971 2010 … … 2642 2681 if (0) 2643 2682 { 2683 cout << "finding additional merge candidates using geometry" << endl; 2644 2684 vector<BspLeaf *> leaves; 2645 2685 CollectLeaves(leaves, true); … … 2702 2742 mergeStats.Start(); 2703 2743 // TODO: REMOVE LATER for performance! 2704 const bool showMergeStats = true;2744 const bool showMergeStats = false; 2705 2745 //BspMergeCandidate::sOverallCost = mBox.SurfaceArea() * mStat.maxPvs; 2706 2746 long startTime = GetTime(); 2707 2747 2708 2748 if (mUseRaysForMerge) 2749 { 2750 cout << "collecting merge candidates (rays) ... "; 2709 2751 mergeStats.nodes = CollectMergeCandidates(rays); 2752 cout << "fininshed collecting candidates" << endl; 2753 } 2710 2754 else 2711 2755 { … … 2714 2758 mergeStats.nodes = CollectMergeCandidates(leaves); 2715 2759 } 2760 2716 2761 2717 2762 mergeStats.collectTime = TimeDiff(startTime, GetTime()); … … 2722 2767 int pass = 0; 2723 2768 const int nextPass = 200; 2769 2770 cout << "starting merge ... "; 2724 2771 2725 2772 //-- use priority queue to merge leaf pairs … … 2744 2791 2745 2792 MergeViewCells(mc.GetLeaf1(), mc.GetLeaf2()); 2746 -- nViewCells; 2747 2793 2748 2794 2749 2795 // increase absolute merge cost … … 2774 2820 << "#CurrentPvs\n" << mc.GetLeaf1()->GetViewCell()->GetPvs().GetSize() << endl; 2775 2821 2822 cout << "exporting view cells ... "; 2776 2823 ViewCellContainer viewCells; 2777 2824 CollectViewCells(mRoot, false, viewCells); 2778 2825 2826 2779 2827 char s[64]; 2780 2828 sprintf(s, "merged_viewcells%07d.x3d", nViewCells); … … 2784 2832 { 2785 2833 exporter->ExportGeometry(objects); 2786 Debug << "vc size " << viewCells.size() << endl;2834 Debug << "vc size " << (int)viewCells.size() << " merge queue size: " << (int)mMergeQueue.size() << endl; 2787 2835 ViewCellContainer::const_iterator it, it_end = viewCells.end(); 2788 2836 … … 2794 2842 delete exporter; 2795 2843 } 2844 cout << "finished " << endl; 2796 2845 } 2797 2846 } 2847 2848 -- nViewCells; 2798 2849 ++ mergeStats.merged; 2799 2800 2850 } 2801 2851 // merge candidate not valid, because one of the leaves was already … … 2807 2857 } 2808 2858 } 2809 2859 cout << "finished merge" << endl; 2810 2860 mergeStats.mergeTime = TimeDiff(startTime, GetTime()); 2811 2861 mergeStats.Stop(); … … 2911 2961 2912 2962 2913 float GetShuffledVcCost(BspLeaf *leaf, BspViewCell *vc1, BspViewCell *vc2, bool useArea)2963 float VspBspTree::GetShuffledVcCost(BspLeaf *leaf, BspViewCell *vc1, BspViewCell *vc2) const 2914 2964 { 2915 2965 //const int pvs1 = SubtractedPvsSize(vc1, leaf, *leaf->mPvs); … … 2917 2967 const int pvs2 = AddedPvsSize(vc2->GetPvs(), *leaf->mPvs); 2918 2968 2969 if (pvs1 + pvs2 > mViewCellsManager->GetMaxPvsSize()) 2970 return 1e15f; 2971 2919 2972 float p1, p2; 2920 2973 2921 if ( useArea)2974 if (mUseAreaForPvs) 2922 2975 { 2923 2976 p1 = vc1->GetArea() - leaf->mProbability; … … 3004 3057 // the view cell should not be empty after the shuffle 3005 3058 if (vc1->mLeaves.size() > 1) 3006 shuffledCost1 = GetShuffledVcCost(leaf1, vc1, vc2 , mUseAreaForPvs);3059 shuffledCost1 = GetShuffledVcCost(leaf1, vc1, vc2); 3007 3060 if (vc2->mLeaves.size() > 1) 3008 shuffledCost2 = GetShuffledVcCost(leaf2, vc2, vc1 , mUseAreaForPvs);3061 shuffledCost2 = GetShuffledVcCost(leaf2, vc2, vc1); 3009 3062 3010 3063 // shuffling unsuccessful -
trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.h
r547 r551 611 611 float GetMemUsage() const; 612 612 613 float GetShuffledVcCost(BspLeaf *leaf, BspViewCell *vc1, BspViewCell *vc2) const; 614 613 615 /// Pointer to the root of the tree 614 616 BspNode *mRoot; -
trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp
r540 r551 506 506 507 507 cout<<"mUseViewSpaceBox="<<mUseViewSpaceBox<<endl; 508 Debug << "use view space box=" << mUseViewSpaceBox << endl; 508 509 if (mUseViewSpaceBox) 509 510 { -
trunk/VUT/GtpVisibilityPreprocessor/src/VssTree.cpp
r485 r551 177 177 maxDepthNodes*100/(double)Leaves()<<endl; 178 178 179 app << "#N_PMINPVSLEAVES ( Percentage of leaves with min Cost)\n"<<179 app << "#N_PMINPVSLEAVES ( Percentage of leaves with minPvs )\n"<< 180 180 minPvsNodes*100/(double)Leaves()<<endl; 181 181 182 app << "#N_PMINRAYSLEAVES ( Percentage of leaves with min Cost)\n"<<182 app << "#N_PMINRAYSLEAVES ( Percentage of leaves with minRays )\n"<< 183 183 minRaysNodes*100/(double)Leaves()<<endl; 184 184
Note: See TracChangeset
for help on using the changeset viewer.