Changeset 1662 for GTP/trunk/Lib/Vis
- Timestamp:
- 10/22/06 09:03:24 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/vsposp_typical.sh
r1660 r1662 61 61 ################################################################################## 62 62 63 METHOD=gradient 63 METHOD=gradient-mem 64 64 echo "$SCENE $METHOD" 65 65 … … 71 71 -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 72 72 -hierarchy_construction_type=2 \ 73 -hierarchy_construction_consider_memory=true \ 73 74 -hierarchy_construction_multilevel=false \ 74 75 -hierarchy_construction_recompute_split_on_repair=true … … 134 135 ######################################################################## 135 136 136 #METHOD=gradient_simplesplit137 #echo "$SCENE $METHOD"137 METHOD=gradient_simplesplit 138 echo "$SCENE $METHOD" 138 139 139 #$PROGRAM $ENVIRONMENT \140 #-view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \141 #-view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \142 #-vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \143 #-bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \144 #-bvh_use_sah=true \145 # -vsp_use_cost_heuristics=false \146 #-hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \147 #-hierarchy_construction_type=2 \148 #-hierarchy_construction_recompute_split_on_repair=true140 $PROGRAM $ENVIRONMENT \ 141 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 142 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 143 -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 144 -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 145 -bvh_use_sah=true \ 146 -vsp_use_cost_heuristics=true \ 147 -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 148 -hierarchy_construction_type=2 \ 149 -hierarchy_construction_recompute_split_on_repair=true 149 150 150 151 sh movefiles.sh $LOG_PREFIX-$METHOD … … 167 168 168 169 sh movefiles.sh $LOG_PREFIX-$METHOD 170 171 ########################################################## 172 METHOD=gradient-500 173 echo "$SCENE $METHOD" 174 175 $PROGRAM $ENVIRONMENT \ 176 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 177 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 178 -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 179 -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 180 -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 181 -hierarchy_construction_type=2 \ 182 -hierarchy_construction_consider_memory=false \ 183 -hierarchy_construction_min_steps_same_type=500 \ 184 -hierarchy_construction_multilevel=false \ 185 -hierarchy_construction_recompute_split_on_repair=true 186 187 sh movefiles.sh $LOG_PREFIX-$METHOD 188 189 190 ############################################################################ 191 -
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1654 r1662 25 25 #define PROBABILIY_IS_BV_VOLUME 1 26 26 #define USE_FIXEDPOINT_T 0 27 //#define COUNT_ORIGIN_OBJECTS 0 27 28 #define USE_VOLUMES_FOR_HEURISTICS 1 29 28 30 29 31 int BvhNode::sMailId = 10000; //2147483647; … … 261 263 Environment::GetSingleton()->GetBoolValue("BvHierarchy.Construction.useGlobalSorting", mUseGlobalSorting); 262 264 265 mUseBboxAreaForSah = true; 263 266 264 267 ///////////// … … 432 435 // decrease the weighted average cost of the subdivisoin 433 436 mTotalCost -= sc->GetRenderCostDecrease(); 437 mPvsEntries += sc->GetPvsEntriesIncr(); 434 438 435 439 // subdivision statistics … … 527 531 //-- surface area heuristics 528 532 529 // if (objects.empty())530 // return 0.0f;531 532 533 const AxisAlignedBox3 box = EvalBoundingBox(leaf->mObjects); 533 534 const float area = box.SurfaceArea(); … … 814 815 int objectsLeft = 0, objectsRight = (int)tData.mNode->mObjects.size(); 815 816 816 AxisAlignedBox3box = tData.mNode->GetBoundingBox();817 818 float minBox =box.Min(axis);819 float maxBox =box.Max(axis);820 float boxArea =box.SurfaceArea();817 const AxisAlignedBox3 nodeBbox = tData.mNode->GetBoundingBox(); 818 819 const float minBox = nodeBbox.Min(axis); 820 const float maxBox = nodeBbox.Max(axis); 821 const float boxArea = nodeBbox.SurfaceArea(); 821 822 822 823 float minSum = 1e20f; … … 828 829 SortableEntryContainer::const_iterator currentPos = 829 830 mSubdivisionCandidates->begin(); 830 831 832 // we keep track of both borders of the bounding boxes => 833 // store the events in descending order 831 834 832 vector<float> bordersRight; 835 bordersRight.resize(mSubdivisionCandidates->size()); 836 837 SortableEntryContainer::reverse_iterator rcit = 838 mSubdivisionCandidates->rbegin(), rcit_end = mSubdivisionCandidates->rend(); 839 840 vector<float>::reverse_iterator rbit = bordersRight.rbegin(); 841 842 for (; rcit != rcit_end; ++ rcit, ++ rbit) 843 { 844 Intersectable *obj = (*rcit).mObject; 845 const AxisAlignedBox3 box = obj->GetBox(); 846 847 if (box.Min(axis) < minBorder) 848 { 849 minBorder = box.Min(axis); 850 } 851 852 (*rbit) = minBorder; 853 } 833 834 if (mUseBboxAreaForSah) 835 { 836 // we keep track of both borders of the bounding boxes => 837 // store the events in descending order 838 839 bordersRight.resize(mSubdivisionCandidates->size()); 840 841 SortableEntryContainer::reverse_iterator rcit = 842 mSubdivisionCandidates->rbegin(), rcit_end = mSubdivisionCandidates->rend(); 843 844 vector<float>::reverse_iterator rbit = bordersRight.rbegin(); 845 846 for (; rcit != rcit_end; ++ rcit, ++ rbit) 847 { 848 Intersectable *obj = (*rcit).mObject; 849 const AxisAlignedBox3 obox = obj->GetBox(); 850 851 if (obox.Min(axis) < minBorder) 852 { 853 minBorder = obox.Min(axis); 854 } 855 856 (*rbit) = minBorder; 857 } 858 } 859 860 // temporary surface areas 861 float al = 0; 862 float ar = boxArea; 854 863 855 864 vector<float>::const_iterator bit = bordersRight.begin(); … … 863 872 -- objectsRight; 864 873 865 AxisAlignedBox3 lbox = box;866 AxisAlignedBox3 rbox = box;867 868 874 const AxisAlignedBox3 obox = obj->GetBox(); 869 875 870 // the borders of the bounding boxes have changed 871 if (obox.Max(axis) > maxBorder) 872 { 873 maxBorder = obox.Max(axis); 874 } 875 876 minBorder = (*bit); 877 878 lbox.SetMax(axis, maxBorder); 879 rbox.SetMin(axis, minBorder); 880 881 const float al = lbox.SurfaceArea(); 882 const float ar = rbox.SurfaceArea(); 876 if (mUseBboxAreaForSah) 877 { 878 AxisAlignedBox3 lbox = nodeBbox; 879 AxisAlignedBox3 rbox = nodeBbox; 880 881 // the borders of the bounding boxes have changed 882 if (obox.Max(axis) > maxBorder) 883 { 884 maxBorder = obox.Max(axis); 885 } 886 887 minBorder = (*bit); 888 889 lbox.SetMax(axis, maxBorder); 890 rbox.SetMin(axis, minBorder); 891 892 al = lbox.SurfaceArea(); 893 ar = rbox.SurfaceArea(); 894 } 895 else 896 { 897 // just add up areas of the object bbs 898 // (as we are not sampling volumetric visibility, 899 // this should provide better heuristics 900 const float area = obox.SurfaceArea(); 901 902 al += area; 903 ar -= area; 904 } 883 905 884 906 const float sum = objectsLeft * al + objectsRight * ar; … … 1151 1173 for (vit = viewCells.begin(); vit != vit_end; ++ vit) 1152 1174 { 1153 vol += (*vit)->GetVolume(); 1175 #if USE_VOLUMES_FOR_HEURISTICS 1176 const float volIncr = (*vit)->GetVolume(); 1177 #else 1178 const float volIncr = 1.0f; 1179 #endif 1180 vol += volIncr; 1154 1181 } 1155 1182 … … 1185 1212 // view cells can also be seen from left child node 1186 1213 ViewCell *viewCell = *vit; 1187 1214 #if USE_VOLUMES_FOR_HEURISTICS 1188 1215 const float vol = viewCell->GetVolume(); 1189 1216 #else 1217 const float vol = 1.0f; 1218 #endif 1190 1219 if (!viewCell->Mailed()) 1191 1220 { … … 1352 1381 << "#Leaves\n" << mBvhStats.Leaves() << endl 1353 1382 << "#RenderCostDecrease\n" << costDecr << endl 1354 << "#TotalRenderCost\n" << mTotalCost << endl; 1383 << "#TotalRenderCost\n" << mTotalCost << endl 1384 << "#EntriesInPvs\n" << mPvsEntries << endl; 1355 1385 } 1356 1386 … … 1881 1911 const float viewSpaceVol = mViewCellsManager->GetViewSpaceBox().GetVolume(); 1882 1912 mTotalCost = (float)objects.size() * prop / viewSpaceVol; 1913 mPvsEntries = CountViewCells(objects); 1883 1914 1884 1915 PrintSubdivisionStats(*oSubdivisionCandidate); -
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h
r1643 r1662 886 886 /// keeps track of cost during subdivision 887 887 float mTotalCost; 888 int mPvsEntries; 888 889 /// keeps track of overall pvs size during subdivision 889 890 int mTotalPvsSize; … … 899 900 bool mUseGlobalSorting; 900 901 902 bool mUseBboxAreaForSah; 903 901 904 SortableEntryContainer *mSortedObjects[3]; 902 905 }; -
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r1653 r1662 2517 2517 "true"); 2518 2518 2519 RegisterOption("Hierarchy.Construction.considerMemory", 2520 optBool, 2521 "hierarchy_construction_consider_memory=", 2522 "false"); 2523 2519 2524 RegisterOption("Hierarchy.Construction.repairQueue", 2520 2525 optBool, -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r1661 r1662 119 119 "Hierarchy.Construction.recomputeSplitPlaneOnRepair", mRecomputeSplitPlaneOnRepair); 120 120 121 Environment::GetSingleton()->GetBoolValue( 122 "Hierarchy.Construction.considerMemory", mConsiderMemory); 123 121 124 Environment::GetSingleton()->GetFloatValue( 122 125 "Hierarchy.Termination.maxMemory", mTermMaxMemory); 123 126 127 // compare to bytes 124 128 mTermMaxMemory *= (1024.0f * 1024.0f); 125 129 … … 134 138 Debug << "minimal number of steps from same type: " << mMinStepsOfSameType << endl; 135 139 Debug << "maximal allowed memory: " << mTermMaxMemory << endl; 140 Debug << "consider mem: " << mConsiderMemory << endl; 136 141 137 142 switch (mConstructionType) … … 350 355 mHierarchyStats.mTotalCost = (float)objects.size(); 351 356 mHierarchyStats.mPvsEntries = 1; 352 mHierarchyStats.mMemory = sizeof(PvsData) + sizeof(Intersectable *) / (1024.0f * 1024.0f); 357 358 const int entrySize = sizeof(PvsData) + sizeof(Intersectable *); 359 mHierarchyStats.mMemory = entrySize / (1024.0f * 1024.0f); 353 360 354 361 EvalSubdivisionStats(); … … 365 372 mSavedViewSpaceSubdivisionType = mViewSpaceSubdivisionType; 366 373 mViewSpaceSubdivisionType = NO_VIEWSPACE_SUBDIV; 367 //mSavedObjectSpaceSubdivisionType = mObjectSpaceSubdivisionType;374 mSavedObjectSpaceSubdivisionType = mObjectSpaceSubdivisionType; 368 375 369 376 // number of initial splits … … 404 411 ResetQueue(objectSpaceQueue, false); 405 412 406 407 // lower number of minsteps: the decicion of which domain to subdivide408 // should be decided using the render cost decrease from now409 413 //minSteps = 1; 410 414 … … 417 421 while (!(viewSpaceQueue.Empty() && objectSpaceQueue.Empty())) 418 422 { 419 const float vspPriority = viewSpaceQueue.Empty() ? 0 : 420 viewSpaceQueue.Top()->GetPriority() / ((float)viewSpaceQueue.Top()->GetPvsEntriesIncr() + Limits::Small); 421 const float ospPriority = objectSpaceQueue.Empty() ? 0 : 422 objectSpaceQueue.Top()->GetPriority() / ((float)objectSpaceQueue.Top()->GetPvsEntriesIncr() + Limits::Small); 423 float vspPriority; 424 425 // decide upon next split type 426 if (!viewSpaceQueue.Empty()) 427 { 428 vspPriority = viewSpaceQueue.Top()->GetPriority(); 429 430 if (mConsiderMemory) 431 vspPriority /= ((float)viewSpaceQueue.Top()->GetPvsEntriesIncr() + Limits::Small); 432 } 433 else 434 { 435 vspPriority = 0; 436 } 437 438 float ospPriority = 0; 439 440 if (!objectSpaceQueue.Empty()) 441 { 442 ospPriority = objectSpaceQueue.Top()->GetPriority(); 443 444 if (mConsiderMemory) 445 ospPriority /= ((float)objectSpaceQueue.Top()->GetPvsEntriesIncr() + Limits::Small); 446 } 447 else 448 { 449 ospPriority = 0; 450 } 423 451 424 452 cout << "new decicion, vsp: " << vspPriority << ", osp: " << ospPriority << endl; … … 567 595 568 596 mHierarchyStats.mTotalCost = mVspTree->mTotalCost; 569 mHierarchyStats.mPvsEntries = mVspTree->EvalPvsEntriesSize(*viewSpaceRays); 570 mHierarchyStats.mMemory = mHierarchyStats.mPvsEntries * 571 sizeof(PvsData) + sizeof(Intersectable *) / (1024.0f * 1024.0f); 572 597 573 598 cout << "\nreseting cost for vsp, new total cost: " << mHierarchyStats.mTotalCost << endl; 574 599 … … 933 958 934 959 // rather use this: remove previous nodes and add the two new ones 935 //mHierarchyStats.mNodes -= mBvHierarchy->mBvhStats.nodes + 2; 936 mHierarchyStats.mNodes = 2; 937 938 //firstCandidate = mBvHierarchy->PrepareConstruction(sampleRays, objects); 960 mHierarchyStats.mNodes -= mBvHierarchy->mBvhStats.nodes + 1; 961 939 962 firstCandidate = mBvHierarchy->Reset(sampleRays, objects); 940 963 941 964 mHierarchyStats.mTotalCost = mBvHierarchy->mTotalCost; 942 mHierarchyStats.mRenderCostDecrease = 0; 943 944 // bug!! pvs entries cab be much higher at this stage 945 // (if view space was already subdivided) 965 //mHierarchyStats.mPvsEntries -= mBvHierarchy->mPvsEntries + 1; 946 966 mHierarchyStats.mPvsEntries = mBvHierarchy->CountViewCells(objects); 947 967 mHierarchyStats.mMemory = mHierarchyStats.mPvsEntries * 948 968 sizeof(PvsData) + sizeof(Intersectable *) / (1024.0f * 1024.0f); 969 970 mHierarchyStats.mRenderCostDecrease = 0; 949 971 950 972 // evaluate stats before first subdivision … … 980 1002 mVspTree->Initialise(sampleRays, forcedViewSpace); 981 1003 982 mHierarchyStats.mNodes = -mVspTree->mVspStats.nodes + 1; 1004 //-- reset stats 1005 mHierarchyStats.mNodes = -mVspTree->mVspStats.nodes + 1; 1006 1007 SubdivisionCandidate *vsc = PrepareViewSpaceSubdivision(sampleRays, objects); 1008 1009 mHierarchyStats.mPvsEntries = mVspTree->mPvsEntries; 983 1010 mHierarchyStats.mRenderCostDecrease = 0; 984 1011 985 SubdivisionCandidate *vsc = PrepareViewSpaceSubdivision(sampleRays, objects); 986 1012 mHierarchyStats.mMemory = mHierarchyStats.mPvsEntries * 1013 sizeof(PvsData) + sizeof(Intersectable *) / (1024.0f * 1024.0f); 1014 987 1015 // evaluate new stats before first subdivsiion 988 1016 EvalSubdivisionStats(); -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
r1654 r1662 524 524 */ 525 525 bool mRecomputeSplitPlaneOnRepair; 526 527 /** If memory should be considered during choosing 528 of the next split type during gradient method. 529 */ 530 bool mConsiderMemory; 526 531 }; 527 532 -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r1660 r1662 388 388 { 389 389 ExportBinaryObj("../data/test.bin", mSceneGraph->GetRoot()); 390 //Exporter *exporter = Exporter::GetExporter("dummy.wrl");391 //exporter->ExportGeometry(mSceneGraph->GetRoot()->mGeometry);392 390 } 393 391 } -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r1608 r1662 1024 1024 }; 1025 1025 1026 #define TEST_EVALUATION 11026 #define TEST_EVALUATION 0 1027 1027 1028 1028 /** -
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp
r1649 r1662 714 714 mTotalCost -= sc->GetRenderCostDecrease(); 715 715 mTotalPvsSize += tFrontData.mPvs + tBackData.mPvs - tData.mPvs; 716 mPvsEntries += sc->GetPvsEntriesIncr(); 716 717 717 718 // subdivision statistics … … 2914 2915 2915 2916 mTotalCost = (float)pvsSize; 2917 mPvsEntries = EvalPvsEntriesSize(rays); 2918 2916 2919 EvalSubdivisionStats(*splitCandidate); 2917 2920 -
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.h
r1640 r1662 1088 1088 /// keeps track of cost during subdivision 1089 1089 float mTotalCost; 1090 int mPvsEntries; 1090 1091 /// keeps track of overall pvs size during subdivision 1091 1092 int mTotalPvsSize;
Note: See TracChangeset
for help on using the changeset viewer.