Changeset 2606 for GTP/trunk/Lib/Vis/Preprocessing
- Timestamp:
- 01/17/08 15:56:37 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r2582 r2606 1159 1159 optFloat, 1160 1160 "kd_pvs_area=", 1161 "1e- 4");1161 "1e-5"); 1162 1162 1163 1163 RegisterOption("KdTree.splitBorder", … … 1700 1700 "false"); 1701 1701 1702 1702 1703 1703 1704 -
GTP/trunk/Lib/Vis/Preprocessing/src/IntelRayCaster.cpp
r2582 r2606 15 15 FILE *fileOut = 0; 16 16 bool saveRays = false; 17 bool saveMutationRays = false; 17 18 const int saveRaysStart = 3000000; 18 19 int cntSavedRaysFLUSH = 0; … … 41 42 if (!InitRayCast(externKdTree)) 42 43 cout << "warning: intel ray tracer could not be initialized!" << endl; 43 if (saveRays )44 if (saveRays || saveMutationRays) 44 45 InitSaving(); 45 46 } … … 59 60 return mlrtaLoadAS(externKdTree.c_str()); 60 61 } 62 63 64 // Using packet of 4 rays supposing that these are coherent 65 // We give a box to which each ray is clipped to before the 66 // ray shooting is computed ! 61 67 62 68 // Using packet of 4 rays supposing that these are coherent … … 75 81 76 82 mlrtaTraverseGroupASEye4(&minBox.x, &maxBox.x, result4, dist4); 83 84 if (saveMutationRays) { 85 fprintf(fileOut, "I %4.7f %4.7f %4.7f %4.7f %4.7f %4.7f\n", 86 minBox.x, minBox.y, minBox.z, maxBox.x, maxBox.y, maxBox.z); 87 for (int i = 0; i < 4; i++) { 88 fprintf(fileOut, "%d %4.7f %4.7f %4.7f %4.7f %4.7f %4.7f %d %4.7f\n", 89 cntSavedRays, 90 origin4[i].x, 91 origin4[i].y, 92 origin4[i].z, 93 dirs4[i].x, 94 dirs4[i].y, 95 dirs4[i].z, 96 (result4[i] != -1) ? 1 : 0, 97 (result4[i] != -1) ? dist4[i] : 0); 98 cntSavedRays ++; 99 cntSavedRaysFLUSH++; 100 } 101 if (cntSavedRaysFLUSH > intSavedLIMIT) { 102 fflush(fileOut); 103 cntSavedRaysFLUSH = 0; 104 } 105 } // if we are saving rays 106 77 107 return; 78 108 } -
GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp
r2575 r2606 129 129 delete splitCandidates; 130 130 131 float area = Get Box().SurfaceArea() * mKdPvsArea;132 131 float area = GetPvsArea(); 132 133 133 SetPvsTerminationNodes(area); 134 134 135 135 return true; 136 } 137 138 float 139 KdTree::GetPvsArea() const { 140 return GetBox().SurfaceArea() * mKdPvsArea; 136 141 } 137 142 … … 891 896 892 897 void 898 KdTree::CollectSmallKdObjects(const AxisAlignedBox3 &box, 899 ObjectContainer &objects, 900 const float maxAreaFrac 901 ) 902 { 903 stack<KdNode *> nodeStack; 904 905 nodeStack.push(mRoot); 906 float maxArea = GetPvsArea()*maxAreaFrac; 907 908 while (!nodeStack.empty()) { 909 KdNode *node = nodeStack.top(); 910 nodeStack.pop(); 911 if (!node->Mailed()) { 912 node->Mail(); 913 if (node->IsLeaf() || GetSurfaceArea(node) <= maxArea) { 914 Intersectable *object = GetOrCreateKdIntersectable(node); 915 if (!node->Mailed()) { 916 objects.push_back(object); 917 } 918 } 919 else { 920 KdInterior *interior = (KdInterior *)node; 921 922 if ( box.Max()[interior->mAxis] > interior->mPosition ) 923 nodeStack.push(interior->mFront); 924 925 if (box.Min()[interior->mAxis] < interior->mPosition) 926 nodeStack.push(interior->mBack); 927 } 928 } 929 } // while 930 } 931 932 933 void 893 934 KdTree::CollectObjects(const AxisAlignedBox3 &box, 894 935 ObjectContainer &objects) … … 1451 1492 KdNode *node = nodeStack.top(); 1452 1493 nodeStack.pop(); 1453 1494 1454 1495 node->mPvsTermination = 0; 1455 1496 if (node->IsLeaf() || (GetSurfaceArea(node) <= maxArea) ) { -
GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.h
r2575 r2606 344 344 void 345 345 SetPvsTerminationNodes(const float maxArea); 346 347 float 348 GetPvsArea() const; 346 349 347 350 KdNode * … … 353 356 ObjectContainer &objects 354 357 ); 358 359 // colect objects which are in the bounding box by explictly specifying the 360 // allowed size of the boxes. If this size is smaller than size used for pvs entries 361 // filtering will be more precise 362 void 363 CollectSmallKdObjects(const AxisAlignedBox3 &box, 364 ObjectContainer &objects, 365 const float maxArea 366 ); 355 367 356 368 void -
GTP/trunk/Lib/Vis/Preprocessing/src/Makefile
r2603 r2606 1 1 ############################################################################# 2 2 # Makefile for building: preprocessor 3 # Generated by qmake (2.00a) (Qt 4.1.2) on: st 16. I 22:10:4520083 # Generated by qmake (2.00a) (Qt 4.1.2) on: ?t 17. I 15:26:52 2008 4 4 # Project: preprocessor.pro 5 5 # Template: app … … 63 63 $(MAKE) -f $(MAKEFILE).Debug uninstall 64 64 65 Makefile: preprocessor.pro C:/Qt/4.1.2/mkspecs/win32-msvc .net\qmake.conf C:/Qt/4.1.2/mkspecs/qconfig.pri \65 Makefile: preprocessor.pro C:/Qt/4.1.2/mkspecs/win32-msvc2005\qmake.conf C:/Qt/4.1.2/mkspecs/qconfig.pri \ 66 66 C:\Qt\4.1.2\mkspecs\features\qt_config.prf \ 67 67 C:\Qt\4.1.2\mkspecs\features\exclusive_builds.prf \ -
GTP/trunk/Lib/Vis/Preprocessing/src/Mutation.cpp
r2599 r2606 83 83 #endif 84 84 85 for (int i=0; i < vssRays.size(); i++) { 86 if (vssRays[i]->mPvsContribution) { 87 // reset the counter of unsuccsseful mutation for a generating ray (if it exists) 88 if (vssRays[i]->mDistribution == MUTATION_BASED_DISTRIBUTION && 89 vssRays[i]->mGeneratorId != -1 85 for (int i=0; i < vssRays.size(); i++) 86 if (vssRays[i]->mTerminationObject) { 87 if (vssRays[i]->mPvsContribution) { 88 // reset the counter of unsuccsseful mutation for a generating ray (if it exists) 89 if (vssRays[i]->mDistribution == MUTATION_BASED_DISTRIBUTION && 90 vssRays[i]->mGeneratorId != -1 90 91 ) { 91 mRays[vssRays[i]->mGeneratorId].mUnsuccessfulMutations = 0;92 mRays[vssRays[i]->mGeneratorId].mUnsuccessfulMutations = 0; 92 93 #if EVALUATE_MUTATION_STATS 93 mutationRays++; 94 mutationRays++; 95 96 Intersectable *newObject = vssRays[i]->mTerminationObject; 94 97 95 Intersectable *newObject = vssRays[i]->mTerminationObject; 96 97 Intersectable *oldObject = mRays[vssRays[i]->mGeneratorId].mRay->mTerminationObject; 98 // the ray generated a contribution although it hits the same object 98 Intersectable *oldObject = mRays[vssRays[i]->mGeneratorId].mRay->mTerminationObject; 99 // the ray generated a contribution although it hits the same object 99 100 // mark this using a counter 100 101 if (oldObject == newObject) … … 144 145 mRays[newRay->mGeneratorId].SetReverseMutation(origin, termination); 145 146 } 146 147 147 reverseCandidates++; 148 148 //mReverseCandidates … … 311 311 { 312 312 #ifdef GTP_INTERNAL 313 313 static int counter = 0; 314 315 314 316 // first reconstruct the termination point 315 317 Vector3 oldDir = Normalize(oldRay.GetDir()); … … 331 333 332 334 Intersectable *occluder = newRay.mTerminationObject; 333 335 336 334 337 AxisAlignedBox3 box = occluder->GetBox(); 335 338 // consider slightly larger neighborhood of the occluder … … 337 340 box.Scale(2.0f); 338 341 //box.Scale(200.0f); 342 339 343 340 344 const int packetSize = 4; -
GTP/trunk/Lib/Vis/Preprocessing/src/ObjectPvs.cpp
r2575 r2606 137 137 138 138 Intersectable::NewMail(); 139 Kd Leaf::NewMail();139 KdNode::NewMail(); 140 140 141 141 ObjectPvsIterator pit = GetIterator(); -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2603 r2606 1208 1208 1209 1209 // !!!!!!!!!!!!!!!! VH no sorting 1210 if ( 1211 rays.size() > 10000) 1210 if ( 1211 rays.size() > 10000 1212 ) 1212 1213 { 1213 1214 1214 mRayCaster->SortRays(rays); 1215 1215 cout<<"Rays sorted in "<<TimeDiff(t1, GetTime())<<" ms."<<endl; … … 1565 1565 void Preprocessor::DeterminePvsObjects(VssRayContainer &rays) 1566 1566 { 1567 1567 mViewCellsManager->DeterminePvsObjects(rays, false); 1568 1568 } 1569 1569 -
GTP/trunk/Lib/Vis/Preprocessing/src/SceneGraph.h
r2601 r2606 37 37 virtual void UpdateBox(); 38 38 39 ~SceneGraphInterior(); 40 39 41 //protected: 40 42 … … 51 53 virtual bool IsLeaf() const { return true; } 52 54 virtual void UpdateBox(); 55 56 ~SceneGraphLeaf(); 53 57 54 58 //protected: -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r2601 r2606 2474 2474 int ViewCellsManager::GetNumViewCells() const 2475 2475 { 2476 2476 return (int)mViewCells.size(); 2477 2477 } 2478 2478 … … 2493 2493 2494 2494 // set only the termination object 2495 // if (vssRay->mTerminationObject == NULL) 2496 // cerr<<"Error NULL termination object!"<<endl; 2495 2497 vssRay->mTerminationObject = GetIntersectable(*vssRay, true); 2496 } 2497 } 2498 #if 0 2499 if (vssRay->mTerminationObject == NULL) { 2500 cerr<<"Error in DeterminePvsObjects - termination object maps to NULL!"<<endl; 2501 } 2502 #endif 2503 } 2504 } 2505 2498 2506 } 2499 2507 … … 3247 3255 for (int i = 0; it != it_end; ++ it, ++ i) 3248 3256 { 3249 3257 if ((*it) != viewCell) 3250 3258 { 3251 3252 3259 //cout<<"v"<<i<<" pvs="<<(*it)->GetPvs().mEntries.size()<<endl; 3260 basePvs.MergeInPlace((*it)->GetPvs()); 3253 3261 } 3254 3255 3256 3257 3258 3262 3263 // update samples and globalC 3264 samples = (float)pvs.GetSamples(); 3265 // cout<<"neighboring viewcells = "<<i-1<<endl; 3266 // cout<<"Samples' = "<<samples<<endl; 3259 3267 } 3260 3268 } … … 3342 3350 3343 3351 if (filteredBoxes) 3344 3345 3352 filteredBoxes->push_back(box); 3353 3346 3354 objects.clear(); 3347 3355 3348 3356 // $$ warning collect objects takes only unmailed ones! 3349 if (mUseKdPvs) 3350 GetPreprocessor()->mKdTree->CollectKdObjects(box, objects); 3351 else 3352 CollectObjects(box, objects); 3353 3357 if (mUseKdPvs) { 3358 // GetPreprocessor()->mKdTree->CollectKdObjects(box, objects); 3359 GetPreprocessor()->mKdTree->CollectSmallKdObjects(box, objects, 0.1f); 3360 3361 } else 3362 CollectObjects(box, objects); 3363 3354 3364 // cout<<"collected objects="<<objects.size()<<endl; 3355 3365 ObjectContainer::const_iterator noi = objects.begin(); 3356 3366 for (; noi != objects.end(); ++ noi) 3357 {3367 { 3358 3368 Intersectable *o = *noi; 3359 3369 // $$ JB warning: pdfs are not correct at this point! -
GTP/trunk/Lib/Vis/Preprocessing/src/default.env
r2602 r2606 3 3 # Jiri Bittner 2003 4 4 ############################################################################# 5 5 6 6 7 Scene { … … 179 180 } 180 181 181 splitMethod spatialMedian182 #splitMethod SAH182 # splitMethod spatialMedian 183 splitMethod SAH 183 184 splitBorder 0.01 184 pvsArea 1e-3 185 } 185 pvsArea 1e-5 186 } 187 186 188 187 189 … … 202 204 importRandomViewCells false 203 205 204 useKdPvs false206 useKdPvs true 205 207 useKdPvsAfterFiltering true 206 208 # samples used for view cell construction -
GTP/trunk/Lib/Vis/Preprocessing/src/run_test_pompeii
r2105 r2606 4 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 COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish+ -preprocessor_use_gl_renderer- -preprocessor_evaluate_filter- -preprocessor_detect_empty_viewspace+ -samples_per_evaluation=5000000 -samples_per_pass=1000000 -total_samples=250000000 -view_cells_use_kd_pvs+ "6 COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish+ -preprocessor_use_gl_renderer- -preprocessor_evaluate_filter- -preprocessor_detect_empty_viewspace+ -samples_per_evaluation=5000000 -samples_per_pass=1000000 -total_samples=250000000 -view_cells_use_kd_pvs+ -kd_pvs_area=1e-5" 7 7 8 8
Note: See TracChangeset
for help on using the changeset viewer.