- Timestamp:
- 02/27/06 07:58:27 (19 years ago)
- Location:
- GTP/trunk/Lib/Vis
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r662 r663 1172 1172 "100000"); 1173 1173 1174 1175 1176 1174 RegisterOption("VssPreprocessor.useImportanceSampling", 1177 1175 optBool, … … 1992 1990 "0.5"); 1993 1991 1994 1995 1992 RegisterOption("VspBspTree.Construction.randomize", 1996 1993 optBool, … … 1998 1995 "false"); 1999 1996 2000 1997 RegisterOption("VspBspTree.simulateOctree", 1998 optBool, 1999 "vsp_bsp_simulate_octree=", 2000 "false"); 2001 2001 2002 RegisterOption("VspBspTree.maxTotalMemory", 2002 2003 optFloat, -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r660 r663 277 277 if (SAMPLE_AFTER_SUBDIVISION) 278 278 ComputeSampleContributions(postProcessSamples, true, storeViewCells); 279 279 280 // merge the view cells 280 281 PostProcess(preprocessor->mObjects, postProcessSamples); … … 310 311 environment->GetIntValue("ViewCells.Evaluation.samples", numSamples); 311 312 313 Debug << "view cells evaluation samples per pass: " << samplesPerPass << endl; 314 Debug << "view cells evaluation samples: " << numSamples << endl; 315 312 316 while (castSamples < numSamples) 313 317 { 318 314 319 } 315 320 //char s[64]; sprintf(s, "bsp-pvs%04d.x3d", i); -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
r660 r663 37 37 int VspBspTree::sFrontAndBackId = 0; 38 38 39 39 bool VspBspTraversalData::sBreathFirstSplits = false; 40 40 41 41 … … 129 129 environment->GetBoolValue("VspBspTree.useCostHeuristics", mUseCostHeuristics); 130 130 environment->GetBoolValue("VspBspTree.useSplitCostQueue", mUseSplitCostQueue); 131 environment->GetBoolValue("VspBspTree.simulateOctree", mSimulateOctree); 132 environment->GetBoolValue("VspBspTree.breathFirstSplits", VspBspTraversalData::sBreathFirstSplits); 131 133 132 134 char subdivisionStatsLog[100]; … … 143 145 Debug << "min rays: " << mTermMinRays << endl; 144 146 Debug << "max ray contri: " << mTermMaxRayContribution << endl; 145 //Debug << "VSP BSP mininam accumulated ray lenght: ", mTermMinAccRayLength) << endl;146 147 Debug << "max cost ratio: " << mTermMaxCostRatio << endl; 147 148 Debug << "miss tolerance: " << mTermMissTolerance << endl; 148 149 Debug << "max view cells: " << mMaxViewCells << endl; 149 150 Debug << "max polygon candidates: " << mMaxPolyCandidates << endl; 150 Debug << "max plane candidates: " << mMaxRayCandidates << endl;151 //Debug << "max plane candidates: " << mMaxRayCandidates << endl; 151 152 Debug << "randomize: " << randomize << endl; 152 153 153 154 Debug << "using area for pvs: " << mUseAreaForPvs << endl; 154 155 Debug << "render cost weight: " << mRenderCostWeight << endl; 156 Debug << "min global cost ratio: " << mTermMinGlobalCostRatio << endl; 157 Debug << "global cost miss tolerance: " << mTermGlobalCostMissTolerance << endl; 158 Debug << "only driving axis: " << mOnlyDrivingAxis << endl; 159 Debug << "max memory: " << mMaxMemory << endl; 160 Debug << "use poly split if available: " << mUsePolygonSplitIfAvailable << endl; 161 Debug << "use cost heuristics: " << mUseCostHeuristics << endl; 162 Debug << "use split cost queue: " << mUseSplitCostQueue << endl; 163 Debug << "subdivision stats log: " << subdivisionStatsLog << endl; 164 165 155 166 Debug << "Split plane strategy: "; 156 167 … … 163 174 Debug << "axis aligned "; 164 175 } 165 if (mSplitPlaneStrategy & LEAST_RAY_SPLITS)176 /*if (mSplitPlaneStrategy & LEAST_RAY_SPLITS) 166 177 { 167 178 mCostNormalizer += mLeastRaySplitsFactor; … … 177 188 mCostNormalizer += mPvsFactor; 178 189 Debug << "pvs"; 179 } 190 }*/ 180 191 181 192 … … 451 462 prop, 452 463 geom); 453 #if OCTREE_HACK 454 tData.mAxis = 0; 455 #endif 464 465 tData.mPriority = mBreathFirstSplits ? 466 (float)-frontData.mDepth : tData.mPvs * tData.mProbability; 467 468 if (mSimulateOctree) 469 tData.mAxis = 0; 470 456 471 // first node is kd node, i.e. an axis aligned box 457 472 if (1) … … 560 575 geom); 561 576 577 tData.mPriority = mBreathFirstSplits ? 578 (float)-tData.mDepth : tData.mPvs * tData.mProbability; 579 562 580 // compute first split candidate 563 581 VspBspSplitCandidate splitCandidate; … … 684 702 VspBspTraversalData tBackData; 685 703 686 #if OCTREE_HACK 687 //Debug << "new axis:" << (tData.mAxis + 1) % 3 << endl; 688 tFrontData.mAxis = (tData.mAxis + 1) % 3; 689 tBackData.mAxis = (tData.mAxis + 1) % 3; 690 #endif 704 if (mSimulateOctree) 705 { // choose axes in circular motion 706 tFrontData.mAxis = (tData.mAxis + 1) % 3; 707 tBackData.mAxis = (tData.mAxis + 1) % 3; 708 } 709 691 710 // create new interior node and two leaf nodes 692 711 // or return leaf as it is (if maxCostRatio missed) 693 694 712 int splitAxis; 695 713 bool splitFurther = true; … … 721 739 722 740 tFrontData.mIsKdNode = tBackData.mIsKdNode = (tData.mIsKdNode && splitAxis < 3); 741 723 742 // how often was max cost ratio missed in this branch? 724 743 tFrontData.mMaxCostMisses = maxCostMisses; 725 744 tBackData.mMaxCostMisses = maxCostMisses; 745 746 ComputePriority(tFrontData); 747 ComputePriority(tBackData); 726 748 727 749 if (1) … … 843 865 tBackData.mMaxCostMisses = maxCostMisses; 844 866 845 867 ComputePriority(tFrontData); 868 ComputePriority(tBackData); 869 870 frontData.mPriority = mBreathFirstSplits ? 871 (float)-frontData.mDepth : frontData.mPvs * frontData.mProbability; 872 backData.mPriority = mBreathFirstSplits ? 873 (float)-backData.mDepth : backData.mPvs * backData.mProbability; 846 874 if (1) 847 875 { … … 937 965 938 966 // compute locally best split plane 939 bool success = SelectPlane(splitData.mSplitPlane, leaf, tData, frontData, backData, splitAxis); 967 bool success = SelectPlane(splitData.mSplitPlane, leaf, tData, 968 frontData, backData, splitAxis); 940 969 941 970 // TODO: reuse … … 1004 1033 } 1005 1034 } 1006 1035 1007 1036 1008 1037 // subdivide polygons … … 1324 1353 box.Include((*ri).ExtrapTermination()); 1325 1354 } 1326 #if OCTREE_HACK 1327 //Debug << "choosing axis:" << tData.mAxis << endl; 1328 const int sAxis = tData.mAxis; 1329 #else 1330 const int sAxis = mUseRandomAxis ? Random(3) : box.Size().DrivingAxis(); 1331 #endif 1355 1356 int sAxis = 0; 1357 1358 bool useSpecialAxis = false; 1359 1360 if (mSimulateOctree) 1361 { 1362 sAxis = tData.mAxis; 1363 useSpecialAxis = true; 1364 } 1365 else if (mUseRandomAxis) 1366 { 1367 sAxis = Random(3); 1368 useSpecialAxis = true; 1369 } 1370 else if (mOnlyDrivingAxis) 1371 { 1372 sAxis = box.Size().DrivingAxis(); 1373 useSpecialAxis = true; 1374 } 1375 1332 1376 for (axis = 0; axis < 3; ++ axis) 1333 1377 { 1334 if (! mOnlyDrivingAxis || (axis == sAxis))1378 if (!useSpecialAxis || (axis == sAxis)) 1335 1379 { 1336 1380 if (!mUseCostHeuristics) -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.h
r660 r663 28 28 struct BspRay; 29 29 30 #define OCTREE_HACK 030 //#define OCTREE_HACK 0 31 31 /** 32 32 This is a view space partitioning specialised BSPtree. … … 44 44 /** Additional data which is passed down the BSP tree during traversal. 45 45 */ 46 structVspBspTraversalData46 class VspBspTraversalData 47 47 { 48 public: 48 49 /// the current node 49 50 BspNode *mNode; … … 64 65 /// if this node is a kd-node (i.e., boundaries are axis aligned 65 66 bool mIsKdNode; 66 67 68 #if OCTREE_HACK // OCTREE HACK 67 // hack for octree 69 68 int mAxis; 70 #endif 71 /// bounding box of current view space. 72 ///AxisAlignedBox3 mBbox;73 69 float mPriority; 70 71 static bool sBreathFirstSplits; 72 74 73 /** Returns average ray contribution. 75 74 */ … … 129 128 float GetCost() const 130 129 { 131 #if 1 132 return mPvs * mProbability; 133 #endif 134 #if 0 135 return (float) (-mDepth); // for regular grid 136 #endif 137 #if 0 138 return (float)(mPvs * (int)mRays->size()); 139 #endif 140 #if 0 141 return (float)mPvs; 142 #endif 143 #if 0 144 return mProbabiliy * (float)mRays->size(); 145 #endif 130 if (sBreathFirstSplits) 131 return mPvs * mProbability; 132 else 133 return (float) (-mDepth); // for kd tree 146 134 } 147 135 … … 160 148 }; 161 149 150 162 151 typedef std::priority_queue<VspBspTraversalData> VspBspTraversalQueue; 163 152 … … 788 777 789 778 //int mSplits; 790 779 /// subdivision stats output file 791 780 ofstream mSubdivsionStats; 792 781 /// if random split axis should be used 793 782 bool mUseRandomAxis; 794 783 /// use polygon split whenever there are polys left 795 784 bool mUsePolygonSplitIfAvailable; 796 785 /// current time stamp (used for keeping split history) 797 786 int mTimeStamp; 798 787 /// number of currenly generated view cells 799 788 int mCreatedViewCells; 789 /// if vsp bsp tree should simulate octree 790 bool mSimulateOctree; 791 792 int mBreathFirstSplits; 800 793 801 794 private:
Note: See TracChangeset
for help on using the changeset viewer.