Changeset 2035 for GTP/trunk/Lib
- Timestamp:
- 01/23/07 14:13:43 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Mutation.cpp
r2022 r2035 30 30 // use avg ray contribution as importance 31 31 // if 0 the importance is evaluated from the succ of mutations 32 #define USE_AVG_CONTRIBUTION 032 #define USE_AVG_CONTRIBUTION 1 33 33 34 34 MutationBasedDistribution::RayEntry & -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2023 r2035 1110 1110 bool Preprocessor::LoadInternKdTree( const string internKdTree) 1111 1111 { 1112 // always try to load the kd tree 1113 cout << "loading kd tree file " << internKdTree << " ... " << endl; 1114 1115 if (!LoadKdTree(internKdTree)) 1116 { 1117 cout << "error loading kd tree with filename " 1118 << internKdTree << ", rebuilding it instead ... " << endl; 1119 // build new kd tree from scene geometry 1120 BuildKdTree(); 1121 1122 // export kd tree? 1123 const long startTime = GetTime(); 1124 cout << "exporting kd tree ... "; 1125 1126 if (!ExportKdTree(internKdTree)) 1127 { 1128 cout << " error exporting kd tree with filename " 1129 << internKdTree << endl; 1130 } 1131 else 1132 { 1133 cout << "finished in " 1134 << TimeDiff(startTime, GetTime()) * 1e-3 1135 << " secs" << endl; 1136 } 1137 } 1138 1139 KdTreeStatistics(cout); 1140 cout << mKdTree->GetBox() << endl; 1141 1112 if (!mUseKdTree) { 1113 // create just a dummy KdTree 1114 mKdTree = new KdTree; 1142 1115 return true; 1116 } 1117 1118 // always try to load the kd tree 1119 cout << "loading kd tree file " << internKdTree << " ... " << endl; 1120 1121 if (!LoadKdTree(internKdTree)) { 1122 cout << "error loading kd tree with filename " 1123 << internKdTree << ", rebuilding it instead ... " << endl; 1124 // build new kd tree from scene geometry 1125 BuildKdTree(); 1126 1127 // export kd tree? 1128 const long startTime = GetTime(); 1129 cout << "exporting kd tree ... "; 1130 1131 if (!ExportKdTree(internKdTree)) 1132 { 1133 cout << " error exporting kd tree with filename " 1134 << internKdTree << endl; 1135 } 1136 else 1137 { 1138 cout << "finished in " 1139 << TimeDiff(startTime, GetTime()) * 1e-3 1140 << " secs" << endl; 1141 } 1142 } 1143 1144 KdTreeStatistics(cout); 1145 cout << mKdTree->GetBox() << endl; 1146 1147 return true; 1143 1148 } 1144 1149 … … 1209 1214 ) 1210 1215 { 1216 1211 1217 const long t1 = GetTime(); 1212 1213 #if 1 1214 mRayCaster->SortRays(rays);1215 //cout<<"Rays sorted in "<<TimeDiff(t1, GetTime())<<" ms."<<endl; 1216 1217 if (0) { 1218 VssRayContainer tmpRays;1219 int m = 50000;1220 for (int i=m; i < m+20; i++) {1221 tmpRays.push_back(new VssRay(rays[i].mOrigin,1222 rays[i].mOrigin + 100.0f*rays[i].mDirection,1223 NULL,1224 NULL1225 )1226 );1227 1228 }1229 ExportRays("sorted_rays.x3d", tmpRays, 200);1218 if (rays.size() > 10000) { 1219 mRayCaster->SortRays(rays); 1220 cout<<"Rays sorted in "<<TimeDiff(t1, GetTime())<<" ms."<<endl; 1221 1222 if (0) { 1223 VssRayContainer tmpRays; 1224 int m = 50000; 1225 for (int i=m; i < m+20; i++) { 1226 tmpRays.push_back(new VssRay(rays[i].mOrigin, 1227 rays[i].mOrigin + 100.0f*rays[i].mDirection, 1228 NULL, 1229 NULL 1230 ) 1231 ); 1232 1233 } 1234 ExportRays("sorted_rays.x3d", tmpRays, 200); 1235 } 1230 1236 } 1231 #endif 1232 1233 SimpleRayContainer::const_iterator rit, rit_end = rays.end(); 1237 1238 SimpleRayContainer::const_iterator rit, rit_end = rays.end(); 1234 1239 1235 1240 SimpleRayContainer rayBucket; … … 1261 1266 } 1262 1267 1263 if ((int)rays.size() > 10000 && i % 10000 == 0)1268 if ((int)rays.size() > 100000 && i % 100000 == 0) 1264 1269 cout<<"\r"<<i<<"/"<<(int)rays.size()<<"\r"; 1265 1270 } -
GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.cpp
r2021 r2035 106 106 else 107 107 { 108 if (mPreprocessor.mDetectEmptyViewSpace) 109 { 110 if (DotProd(hit.mNormal, direction) >= -Limits::Small) 111 { 112 hit.mObject = NULL; 113 return false; 114 } 108 if (mPreprocessor.mDetectEmptyViewSpace) { 109 if (DotProd(hit.mNormal, direction) >= -Limits::Small) { 110 hit.mObject = NULL; 111 return false; 115 112 } 116 } 117 113 } 114 } 115 118 116 return true; 119 117 } … … 251 249 // regardless of the pruneInvalidRays setting reject rays whic degenerate to a point 252 250 if (EpsilonEqualV3(hitA.mPoint, hitB.mPoint, Limits::Small)) { 253 251 return 0; 254 252 } 255 253 -
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.cpp
r2022 r2035 11 11 #include "VssRay.h" 12 12 #include "SamplingStrategy.h" 13 #include "RayCaster.h" 13 14 14 15 … … 25 26 SamplingPreprocessor::~SamplingPreprocessor() 26 27 { 27 CLEAR_CONTAINER(mSampleRays);28 CLEAR_CONTAINER(mVssSampleRays);29 28 } 30 29 … … 91 90 92 91 map<ViewCell *, HaltonSequence> dirHalton; 93 92 int lastEvaluation = 0; 93 SimpleRayContainer rays; 94 VssRayContainer vssRays; 95 94 96 while (samples < mTotalSamples) { 95 for (int i=0; i < mSamplesPerEvaluation;) { 96 SimpleRayContainer rays; 97 VssRayContainer vssRays; 98 // vector<ViewCell *> viewcells; 97 for (int i=0; i < mSamplesPerPass;) { 98 99 mRayCaster->InitPass(); 99 100 100 101 float r[5]; … … 107 108 if (!viewcell || !viewcell->GetValid()) 108 109 continue; 109 110 111 rays.clear(); 112 vssRays.clear(); 113 110 114 for (; rays.size() < 16; ) { 111 if (i%100000 == 0) 112 cout<<"+"; 115 if (i%100000 == 0) { 116 cout<<samples/1e6f<<"M rays, progress: "<<samples*100/mTotalSamples<<" % \r"; 117 } 113 118 114 // dirHalton.GetNext(2, r);115 119 dirHalton[viewcell].GetNext(2, r); 116 120 direction = UniformRandomVector(r[0],r[1]); 117 121 //direction = UniformRandomVector(); 118 122 119 // viewcells.push_back(viewcell);120 123 // cast rays in both directions to make the number of samples comparable 121 124 // with the global sampling method which also casts a "double" ray per sample … … 133 136 true); 134 137 135 // if (vssRays.size()!=32) {136 // cerr<<"wrong number of rays "<<(int)vssRays.size()<<endl;137 // exit(1);138 // }139 138 140 139 rssSamples += vssRays.size(); … … 147 146 float pdf = 1.0f; 148 147 // ViewCell *viewcell = viewcells[j/2]; 149 148 150 149 ObjectPvs &pvs = viewcell->GetPvs(); 151 150 pvs.AddSampleDirtyCheck(obj, pdf); … … 157 156 } 158 157 159 CLEAR_CONTAINER(vssRays);160 161 158 if (samples > mTotalSamples) 162 159 break; 163 160 } 164 161 165 #if 0 166 Debug<<"Valid viewcells before set validity: "<<mViewCellsManager->CountValidViewcells()<<endl;167 mViewCellsManager->SetValidity(0, intersectables/2);168 Debug<<"Valid viewcells after set validity: "<<mViewCellsManager->CountValidViewcells()<<endl;169 #endif 170 171 // mVssRays.PrintStatistics(mStats);172 mStats <<173 "#Time\n" << TimeDiff(startTime, GetTime())*1e-3<<endl<<174 "#TotalSamples\n" <<samples<<endl<< 175 "#RssSamples\n" <<rssSamples<<endl;176 177 mViewCellsManager->PrintPvsStatistics(mStats);178 // ComputeRenderError();179 180 162 163 if (samples - lastEvaluation >= mSamplesPerEvaluation) { 164 mViewCellsManager->PrintPvsStatistics(mStats); 165 mStats << 166 "#Pass\n" <<mPass<<endl<< 167 "#Time\n" << TimeDiff(startTime, GetTime())<<endl<< 168 "#TotalSamples\n" <<samples<<endl<< 169 "#RssSamples\n" <<rssSamples<<endl; 170 lastEvaluation = samples; 171 172 if (renderer) { 173 ComputeRenderError(); 174 } 175 176 } 177 } 181 178 if (0) { 182 179 Exporter *exporter = Exporter::GetExporter("ray-density.x3d"); … … 185 182 delete exporter; 186 183 } 187 188 189 184 185 186 // $$JB temporary removed 190 187 // mViewCellsManager->PostProcess(objects, mSampleRays); 191 188 -
GTP/trunk/Lib/Vis/Preprocessing/src/run_test_pompeii
r2010 r2035 2 2 3 3 #COMMAND="./release/preprocessor.exe -preprocessor_quit_on_finish+" 4 COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish+ -preprocessor_use_gl_renderer- -preprocessor_evaluate_filter + -preprocessor_detect_empty_viewspace-"4 COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish+ -preprocessor_use_gl_renderer- -preprocessor_evaluate_filter- -preprocessor_detect_empty_viewspace- -total_samples=500000000" 5 5 6 6 … … 8 8 VIEWCELLS=../data/Pompeii/pompeii_big-seq-viewcells.xml.gz 9 9 10 PREFIX=../work/plots/osp-pompeii 3-1e510 PREFIX=../work/plots/osp-pompeii4-1e5 11 11 12 12 # $COMMAND -preprocessor=combined -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ … … 16 16 # -preprocessor_histogram_file=$PREFIX-i-mixed-b1-n4n.hlog 17 17 18 # n - no origin mutation, q=2, reverse samples18 # # n - no origin mutation, q=2, reverse samples 19 19 20 $COMMAND -preprocessor=combined -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \21 -rss_distributions=mutation+object_direction+spatial \22 -view_cells_use_kd_pvs- -af_use_kd_pvs- \23 -preprocessor_visibility_file=$PREFIX-i-mixed-bvh-n4n.xml \24 -preprocessor_stats=$PREFIX-i-mixed-bvh-n4n.log \25 -preprocessor_histogram_file=$PREFIX-i-mixed-bvh-n4n.hlog20 # $COMMAND -preprocessor=combined -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 21 # -rss_distributions=mutation+object_direction+spatial \ 22 # -view_cells_use_kd_pvs- -af_use_kd_pvs- \ 23 # -preprocessor_visibility_file=$PREFIX-i-mixed-bvh-n4n.xml \ 24 # -preprocessor_stats=$PREFIX-i-mixed-bvh-n4n.log \ 25 # -preprocessor_histogram_file=$PREFIX-i-mixed-bvh-n4n.hlog 26 26 27 #$COMMAND -preprocessor=sampling -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \28 #-preprocessor_visibility_file=$PREFIX-r-reference.xml \29 #-view_cells_filter_max_size=1 -preprocessor_stats=$PREFIX-r-reference.log \30 #-preprocessor_histogram_file=$PREFIX-r-reference.hlog27 $COMMAND -preprocessor=sampling -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 28 -preprocessor_visibility_file=$PREFIX-r-reference.xml \ 29 -view_cells_filter_max_size=1 -preprocessor_stats=$PREFIX-r-reference.log \ 30 -preprocessor_histogram_file=$PREFIX-r-reference.hlog 31 31 32 #$COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \33 #-rss_distributions=direction -view_cells_filter_max_size=1 \34 #-preprocessor_visibility_file=$PREFIX-r-reference-global.xml \35 #-preprocessor_stats=$PREFIX-r-reference-global.log \36 #-preprocessor_histogram_file=$PREFIX-r-reference-global.hlog32 $COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 33 -rss_distributions=direction -view_cells_filter_max_size=1 \ 34 -preprocessor_visibility_file=$PREFIX-r-reference-global.xml \ 35 -preprocessor_stats=$PREFIX-r-reference-global.log \ 36 -preprocessor_histogram_file=$PREFIX-r-reference-global.hlog 37 37 38 38 #mutation+object_direction+
Note: See TracChangeset
for help on using the changeset viewer.