Changeset 1642 for GTP/trunk/Lib/Vis
- Timestamp:
- 10/19/06 03:53:51 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/vsposp_typical.env
r1640 r1642 225 225 Construction { 226 226 227 samples 100000227 samples 200000 228 228 229 229 # type 0 = sequential computation, 1 = interleaved, 2 = gradient … … 248 248 249 249 # number of iteration steps 250 levels 4250 levels 3 251 251 252 252 # minimal steps of same type: for interleaved, this is only valid for the first few splits -
GTP/trunk/Lib/Vis/Preprocessing/scripts/vsposp_typical.sh
r1640 r1642 26 26 27 27 28 METHOD=interleaved_full29 echo "$SCENE $METHOD"28 # METHOD=interleaved_full 29 # echo "$SCENE $METHOD" 30 30 31 $PROGRAM $ENVIRONMENT \32 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \33 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \34 -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \35 -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \36 -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \37 -hierarchy_construction_type=1 \38 -hierarchy_construction_recompute_split_on_repair=true31 # $PROGRAM $ENVIRONMENT \ 32 # -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 33 # -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 34 # -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 35 # -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 36 # -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 37 # -hierarchy_construction_type=1 \ 38 # -hierarchy_construction_recompute_split_on_repair=true 39 39 40 mv debug.log $LOG_PREFIX-$METHOD-debug.log41 mv view_cells.wrl $LOG_PREFIX-$METHOD-view_cells.wrl42 mv final_object_partition.wrl $LOG_PREFIX-$METHOD-final_object_partition.wrl43 mv final_view_cells.wrl $LOG_PREFIX-$METHOD-final_view_cells.wrl40 # mv debug.log $LOG_PREFIX-$METHOD-debug.log 41 # mv view_cells.wrl $LOG_PREFIX-$METHOD-view_cells.wrl 42 # mv final_object_partition.wrl $LOG_PREFIX-$METHOD-final_object_partition.wrl 43 # mv final_view_cells.wrl $LOG_PREFIX-$METHOD-final_view_cells.wrl 44 44 45 45 46 METHOD=interleaved47 echo "$SCENE $METHOD"46 # METHOD=interleaved 47 # echo "$SCENE $METHOD" 48 48 49 $PROGRAM $ENVIRONMENT \50 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \51 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \52 -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \53 -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \54 -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \55 -hierarchy_construction_type=1 \56 -hierarchy_construction_recompute_split_on_repair=false49 # $PROGRAM $ENVIRONMENT \ 50 # -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 51 # -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 52 # -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 53 # -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 54 # -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 55 # -hierarchy_construction_type=1 \ 56 # -hierarchy_construction_recompute_split_on_repair=false 57 57 58 mv debug.log $LOG_PREFIX-$METHOD-debug.log59 mv view_cells.wrl $LOG_PREFIX-$METHOD-view_cells.wrl60 mv final_object_partition.wrl $LOG_PREFIX-$METHOD-final_object_partition.wrl61 mv final_view_cells.wrl $LOG_PREFIX-$METHOD-final_view_cells.wrl58 # mv debug.log $LOG_PREFIX-$METHOD-debug.log 59 # mv view_cells.wrl $LOG_PREFIX-$METHOD-view_cells.wrl 60 # mv final_object_partition.wrl $LOG_PREFIX-$METHOD-final_object_partition.wrl 61 # mv final_view_cells.wrl $LOG_PREFIX-$METHOD-final_view_cells.wrl 62 62 63 63 64 METHOD=gradient65 echo "$SCENE $METHOD"64 # METHOD=gradient 65 # echo "$SCENE $METHOD" 66 66 67 $PROGRAM $ENVIRONMENT \68 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \69 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \70 -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \71 -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \72 -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \73 -hierarchy_construction_type=2 \74 -hierarchy_construction_recompute_split_on_repair=true67 # $PROGRAM $ENVIRONMENT \ 68 # -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 69 # -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 70 # -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 71 # -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 72 # -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 73 # -hierarchy_construction_type=2 \ 74 # -hierarchy_construction_recompute_split_on_repair=true 75 75 76 mv debug.log $LOG_PREFIX-$METHOD-debug.log 77 mv view_cells.wrl $LOG_PREFIX-$METHOD-view_cells.wrl 78 mv final_object_partition.wrl $LOG_PREFIX-$METHOD-final_object_partition.wrl 79 mv final_view_cells.wrl $LOG_PREFIX-$METHOD-final_view_cells.wrl 76 # mv debug.log $LOG_PREFIX-$METHOD-debug.log 77 # mv view_cells.wrl $LOG_PREFIX-$METHOD-view_cells.wrl 78 # mv final_object_partition.wrl $LOG_PREFIX-$METHOD-final_object_partition.wrl 79 # mv final_view_cells.wrl $LOG_PREFIX-$METHOD-final_view_cells.wrl 80 81 METHOD=multilevel 82 echo "$SCENE $METHOD" 83 84 $PROGRAM $ENVIRONMENT \ 85 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 86 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 87 -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 88 -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 89 -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 90 -hierarchy_construction_type=2 \ 91 -hierarchy_construction_multilevel=true \ 92 -hierarchy_construction_samples=20000 \ 93 -hierarchy_term_max_leaves=500 \ 94 -hierarchy_construction_levels=1 \ 95 -hierarchy_construction_recompute_split_on_repair=true 96 97 mv debug.log $LOG_PREFIX-$METHOD-debug.log 98 mv view_cells.wrl $LOG_PREFIX-$METHOD-view_cells.wrl 99 mv final_object_partition.wrl $LOG_PREFIX-$METHOD-final_object_partition.wrl 100 mv final_view_cells.wrl $LOG_PREFIX-$METHOD-final_view_cells.wrl -
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r1640 r1642 2468 2468 RegisterOption("Hierarchy.Construction.samples", 2469 2469 optInt, 2470 " vsp_construction_samples=",2470 "hierarchy_construction_samples=", 2471 2471 "100000"); 2472 2473 2472 2474 2473 RegisterOption("Hierarchy.subdivisionStats", -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r1640 r1642 311 311 break; 312 312 } 313 314 // hack: should be different parameter name 315 if (mUseMultiLevelConstruction) 316 { 317 cout << "starting optimizing multilevel ... " << endl; 318 // try to optimize on the above hierarchy 319 OptimizeMultiLevel(sampleRays, objects, forcedViewSpace); 320 321 cout << "finished" << endl; 322 } 313 323 } 314 324 … … 376 386 viewSpaceQueue.Push(vsc); 377 387 378 // view space subdivision was constructed388 // view space subdivision started 379 389 mViewSpaceSubdivisionType = mSavedViewSpaceSubdivisionType; 380 390 … … 828 838 void HierarchyManager::RunConstruction(const bool repairQueue) 829 839 { 830 //int i = 0;831 840 // main loop 832 841 while (!FinishedConstruction()) 833 842 { 834 843 SubdivisionCandidate *sc = NextSubdivisionCandidate(mTQueue); 835 844 cout << "p=" << sc->GetPriority() << " "; 845 836 846 //////// 837 847 //-- subdivide leaf node of either type 838 ApplySubdivisionCandidate(sc, mTQueue, repairQueue); 848 ApplySubdivisionCandidate(sc, mTQueue, repairQueue); 849 //cout << "\nhere45 " << sc->GetPriority() << " " << sc->GetRenderCostDecrease() << " " << mObjectSpaceSubdivisionType << " " << mViewSpaceSubdivisionType << endl; 850 839 851 DEL_PTR(sc); 840 852 } … … 883 895 const ObjectContainer &objects) 884 896 { 885 // no object space subdivision yet886 if (!ObjectSpaceSubdivisionConstructed())887 {888 return PrepareObjectSpaceSubdivision(sampleRays, objects);889 }890 891 897 SubdivisionCandidate *firstCandidate; 892 898 … … 898 904 cout << "\nreseting bv hierarchy" << endl; 899 905 Debug << "old bv hierarchy:\n " << mBvHierarchy->mBvhStats << endl; 900 906 907 mBvHierarchy->Initialise(objects); 908 909 // rather use this: remove previous nodes and add the two new ones 910 //mHierarchyStats.mNodes -= mBvHierarchy->mBvhStats.nodes + 2; 911 mHierarchyStats.mNodes = 2; 912 901 913 firstCandidate = mBvHierarchy->Reset(sampleRays, objects); 902 914 903 915 mHierarchyStats.mTotalCost = mBvHierarchy->mTotalCost; 904 905 // bug!! pvs entries could be much higher at this stage 906 mHierarchyStats.mNodes = 2; 916 mHierarchyStats.mRenderCostDecrease = 0; 917 918 // bug!! pvs entries cab be much higher at this stage 919 // (if view space was already subdivided) 907 920 mHierarchyStats.mPvsEntries = 1; 908 mHierarchyStats.m RenderCostDecrease = 0;921 mHierarchyStats.mMemory = sizeof(PvsData) + sizeof(Intersectable *) / (1024.0f * 1024.0f); 909 922 910 923 // evaluate stats before first subdivision … … 925 938 926 939 SubdivisionCandidate *HierarchyManager::ResetViewSpaceSubdivision(const VssRayContainer &sampleRays, 927 const ObjectContainer &objects) 940 const ObjectContainer &objects, 941 AxisAlignedBox3 *forcedViewSpace) 928 942 { 929 943 ViewCellsManager *vc = mVspTree->mViewCellsManager; … … 933 947 mVspTree = new VspTree(); 934 948 mVspTree->mHierarchyManager = this; 935 mVspTree->mViewCellsManager = vc; 936 937 SubdivisionCandidate *vsc = PrepareViewSpaceSubdivision(sampleRays, objects); 949 950 mVspTree->Initialise(sampleRays, forcedViewSpace); 951 952 SubdivisionCandidate *vsc = 953 PrepareViewSpaceSubdivision(sampleRays, objects); 938 954 939 955 mHierarchyStats.mNodes = 2; … … 969 985 // use sah for evaluating osp tree construction 970 986 // in the first iteration of the subdivision 971 987 972 988 mSavedViewSpaceSubdivisionType = mViewSpaceSubdivisionType; 973 989 mViewSpaceSubdivisionType = NO_VIEWSPACE_SUBDIV; 974 990 975 mSavedObjectSpaceSubdivisionType = mObjectSpaceSubdivisionType; 976 mObjectSpaceSubdivisionType = NO_OBJ_SUBDIV; 991 SubdivisionCandidate *osc = 992 PrepareObjectSpaceSubdivision(sampleRays, objects); 993 mTQueue.Push(osc); 994 995 //////////////////////////7 996 977 997 978 998 const int limit = mNumMultiLevels; … … 991 1011 992 1012 // subdivide object space first 993 ResetObjectSpaceSubdivision(sampleRays, objects); 1013 osc = ResetObjectSpaceSubdivision(sampleRays, objects); 1014 mTQueue.Push(osc); 994 1015 995 1016 // process object space candidates … … 1012 1033 // subdivide view space with respect to the objects 1013 1034 1014 SubdivisionCandidate *vspVc = ResetViewSpaceSubdivision(sampleRays, objects );1035 SubdivisionCandidate *vspVc = ResetViewSpaceSubdivision(sampleRays, objects, forcedViewSpace); 1015 1036 mTQueue.Push(vspVc); 1016 1037 … … 1018 1039 mViewSpaceSubdivisionType = mSavedViewSpaceSubdivisionType; 1019 1040 1020 1021 1041 // process view space candidates 1022 1042 RunConstruction(false); … … 1031 1051 1032 1052 cout << "\nfinished in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 1033 1034 /*#if _DEBUG1035 cout << "view space: " << GetViewSpaceBox() << endl;1036 cout << "object space: " << GetObjectSpaceBox() << endl;1037 #endif*/1038 1053 1039 1054 mHierarchyStats.Stop(); … … 1047 1062 AxisAlignedBox3 *forcedViewSpace) 1048 1063 { 1049 mHierarchyStats.Reset(); 1050 mHierarchyStats.Start(); 1051 mHierarchyStats.mNodes = 2; 1052 1053 mHierarchyStats.mTotalCost = (float)objects.size(); 1054 Debug << "setting total cost to " << mHierarchyStats.mTotalCost << endl; 1064 // assume object space subdivision constructed 1065 //mObjectSpaceSubdivisionType = mSavedObjectSpaceSubdivisionType; 1066 1067 // set the number of leaves 'evaluated' from the previous methods 1068 // we go for the same numbers, but we try to optimize both 1069 // subdivisions 1070 switch (mObjectSpaceSubdivisionType) 1071 { 1072 case BV_BASED_OBJ_SUBDIV: 1073 mBvHierarchy->mTermMaxLeaves = mBvHierarchy->mBvhStats.Leaves(); 1074 break; 1075 case KD_BASED_OBJ_SUBDIV: 1076 mOspTree->mTermMaxLeaves = mOspTree->mOspStats.Leaves(); 1077 default: 1078 break; 1079 } 1080 1081 mVspTree->mMaxViewCells = mVspTree->mVspStats.Leaves(); 1055 1082 1056 1083 const long startTime = GetTime(); 1057 cout << "Constructing view space / object space tree ... \n";1058 1059 // initialise view / object space1060 mVspTree->Initialise(sampleRays, forcedViewSpace);1061 InitialiseObjectSpaceSubdivision(objects);1062 1063 // use sah for evaluating osp tree construction1064 // in the first iteration of the subdivision1065 1066 mSavedViewSpaceSubdivisionType = mViewSpaceSubdivisionType;1067 mViewSpaceSubdivisionType = NO_VIEWSPACE_SUBDIV;1068 1069 mSavedObjectSpaceSubdivisionType = mObjectSpaceSubdivisionType;1070 mObjectSpaceSubdivisionType = NO_OBJ_SUBDIV;1071 1072 1084 const int limit = mNumMultiLevels; 1073 int i = 0; 1085 1086 // open up new subdivision 1087 mSubdivisionStats.close(); 1088 1089 int steps = 0; 1074 1090 1075 1091 // This method subdivides view space / object space … … 1081 1097 { 1082 1098 char subdivisionStatsLog[100]; 1083 sprintf(subdivisionStatsLog, "tests/i3d/subdivision-%04d.log", i);1099 sprintf(subdivisionStatsLog, "tests/i3d/subdivision-%04d.log", steps); 1084 1100 mSubdivisionStats.open(subdivisionStatsLog); 1085 1101 1086 1102 // subdivide object space first 1087 ResetObjectSpaceSubdivision(sampleRays, objects); 1103 SubdivisionCandidate *ospVc = ResetObjectSpaceSubdivision(sampleRays, objects); 1104 mTQueue.Push(ospVc); 1088 1105 1089 1106 // process object space candidates 1090 1107 RunConstruction(false); 1091 1108 1092 // object space subdivision constructed 1093 mObjectSpaceSubdivisionType = mSavedObjectSpaceSubdivisionType; 1094 1095 cout << "iteration " << i << " of " << limit << " finished" << endl; 1109 cout << "iteration " << steps << " of " << limit << " finished" << endl; 1096 1110 1097 1111 mSubdivisionStats.close(); 1098 1112 1099 if (( i ++) >= limit)1113 if ((++ steps) >= limit) 1100 1114 break; 1101 1115 1102 sprintf(subdivisionStatsLog, "tests/i3d/subdivision-%04d.log", i);1116 sprintf(subdivisionStatsLog, "tests/i3d/subdivision-%04d.log", steps); 1103 1117 mSubdivisionStats.open(subdivisionStatsLog); 1104 1118 … … 1106 1120 // subdivide view space with respect to the objects 1107 1121 1108 SubdivisionCandidate *vspVc = ResetViewSpaceSubdivision(sampleRays, objects );1122 SubdivisionCandidate *vspVc = ResetViewSpaceSubdivision(sampleRays, objects, forcedViewSpace); 1109 1123 mTQueue.Push(vspVc); 1110 1111 // view space subdivision constructed1112 mViewSpaceSubdivisionType = mSavedViewSpaceSubdivisionType;1113 1114 1124 1115 1125 // process view space candidates 1116 1126 RunConstruction(false); 1117 1127 1118 cout << "iteration " << i<< " of " << limit << " finished" << endl;1128 cout << "iteration " << steps << " of " << limit << " finished" << endl; 1119 1129 1120 1130 mSubdivisionStats.close(); 1121 1131 1122 if (( i ++) >= limit)1132 if ((++ steps) >= limit) 1123 1133 break; 1124 1134 } 1125 1135 1126 1136 cout << "\nfinished in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 1127 1128 /*#if _DEBUG1129 cout << "view space: " << GetViewSpaceBox() << endl;1130 cout << "object space: " << GetObjectSpaceBox() << endl;1131 #endif*/1132 1137 1133 1138 mHierarchyStats.Stop(); … … 1146 1151 bool HierarchyManager::ObjectSpaceSubdivisionConstructed() const 1147 1152 { 1148 switch (mObjectSpaceSubdivisionType)1153 /*switch (mObjectSpaceSubdivisionType) 1149 1154 { 1150 1155 case KD_BASED_OBJ_SUBDIV: … … 1154 1159 default: 1155 1160 return false; 1156 } 1161 }*/ 1162 return mObjectSpaceSubdivisionType != NO_OBJ_SUBDIV; 1157 1163 } 1158 1164 -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
r1640 r1642 427 427 428 428 SubdivisionCandidate *ResetViewSpaceSubdivision(const VssRayContainer &rays, 429 const ObjectContainer &objects); 429 const ObjectContainer &objects, 430 AxisAlignedBox3 *forcedViewSpace); 430 431 431 432
Note: See TracChangeset
for help on using the changeset viewer.