- Timestamp:
- 01/26/07 13:44:12 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r2051 r2060 1287 1287 1288 1288 /*************************************************************************/ 1289 /* Mutation strategy related options */ 1290 /*************************************************************************/ 1291 1292 RegisterOption("Mutation.bufferSize", 1293 optInt, 1294 "mutation_buffer_size=", 1295 "500000"); 1296 1297 RegisterOption("Mutation.radiusOrigin", 1298 optFloat, 1299 "mutation_radius_origin=", 1300 "0.5"); 1301 1302 RegisterOption("Mutation.radiusTermination", 1303 optFloat, 1304 "mutation_radius_termination=", 1305 "0.5"); 1306 1307 RegisterOption("Mutation.useReverseSamples", 1308 optBool, 1309 "mutation_use_reverse_samples", 1310 "true"); 1311 1312 RegisterOption("Mutation.reverseSamplesDistance", 1313 optFloat, 1314 "mutation_reverse_samples_distance", 1315 "3.0"); 1316 1317 RegisterOption("Mutation.useSilhouetteSamples", 1318 optBool, 1319 "mutation_use_silhouette_samples", 1320 "true"); 1321 1322 RegisterOption("Mutation.silhouetteSearchSteps", 1323 optInt, 1324 "mutation_silhouette_search_steps=", 1325 "3"); 1326 1327 RegisterOption("Mutation.silhouetteProb", 1328 optFloat, 1329 "mutation_silhouette_prob=", 1330 "0.8"); 1331 1332 RegisterOption("Mutation.usePassImportance", 1333 optBool, 1334 "mutation_use_pass_importance", 1335 "true"); 1336 1337 RegisterOption("Mutation.useUnsuccCountImportance", 1338 optBool, 1339 "mutation_use_unsucc_count_importance", 1340 "false"); 1341 1342 1343 /*************************************************************************/ 1289 1344 /* GvsPrerpocessor related options */ 1290 1345 /*************************************************************************/ -
GTP/trunk/Lib/Vis/Preprocessing/src/Makefile
r2049 r2060 1 1 ############################################################################# 2 2 # Makefile for building: preprocessor 3 # Generated by qmake (2.00a) (Qt 4.1.2) on: út 23. I 21:53:4920073 # Generated by qmake (2.00a) (Qt 4.1.2) on: ?t 25. I 14:38:54 2007 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
r2050 r2060 10 10 #include "Mutation.h" 11 11 #include "Exporter.h" 12 #include "Environment.h" 12 13 13 14 #ifdef GTP_INTERNAL … … 18 19 19 20 #define MUTATION_USE_CDF 0 20 #define USE_SILHOUETTE_MUTATIONS 0 21 22 23 #define SIL_TERMINATION_MUTATION_PROB 0.8f 21 22 //#define SIL_TERMINATION_MUTATION_PROB 0.8f 24 23 25 24 #define EVALUATE_MUTATION_STATS 1 26 25 27 #define Q_SEARCH_STEPS 326 //#define Q_SEARCH_STEPS 3 28 27 29 28 #define SORT_RAY_ENTRIES 1 … … 123 122 VssRay *newRay = vssRays[i]; 124 123 125 #define DIST_THRESHOLD 3.0f126 124 127 125 Intersectable *oldObject = oldRay->mTerminationObject; … … 133 131 float newDist = Magnitude(newRay->mTermination - newRay->mOrigin); 134 132 135 if (newDist < oldDist - oldObject->GetBox().Radius()* DIST_THRESHOLD) {133 if (newDist < oldDist - oldObject->GetBox().Radius()*mReverseSamplesDistance) { 136 134 Vector3 origin, termination; 137 135 if (ComputeReverseMutation(*oldRay, *newRay, origin, termination)) { … … 170 168 cout<<"Percentage of contributing rays:"<<pContributingRays<<endl; 171 169 172 #if USE_AVG_CONTRIBUTION 173 float importance = 1.0f/(pContributingRays + 1e-5); 174 // float importance = 1.0f; 175 // set this values for last contributingRays 176 int index = mBufferStart - 1; 177 178 for (int i=0; i < contributingRays; i++, index--) { 179 if (index < 0) 180 index = mRays.size()-1; 181 mRays[index].mImportance = importance; 182 } 183 #else 184 // use unsucc mutation samples as feedback on importance 185 for (int i=0; i < mRays.size(); i++) { 186 const float minImportance = 0.1f; 187 const int minImportanceSamples = 20; 188 mRays[i].mImportance = minImportance + 189 (1-minImportance)*exp(-3.0f*mRays[i].mUnsuccessfulMutations/minImportanceSamples); 190 191 //mRays[i].mImportance = 1.0f/(mRays[i].mUnsuccessfulMutations+3); 192 // mRays[i].mImportance = 1.0f; 193 } 194 #endif 170 if (mUseUnsuccCountImportance) { 171 // use unsucc mutation samples as feedback on importance 172 for (int i=0; i < mRays.size(); i++) { 173 const float minImportance = 0.1f; 174 const int minImportanceSamples = 20; 175 mRays[i].mImportance = minImportance + 176 (1-minImportance)*exp(-3.0f*mRays[i].mUnsuccessfulMutations/minImportanceSamples); 177 } 178 } else { 179 float importance = 1.0f; 180 if (mUsePassImportance) 181 importance = 1.0f/(pContributingRays + 1e-5); 182 // set this values for last contributingRays 183 int index = mBufferStart - 1; 184 185 for (int i=0; i < contributingRays; i++, index--) { 186 if (index < 0) 187 index = mRays.size()-1; 188 mRays[index].mImportance = importance; 189 } 190 } 195 191 196 192 #if SORT_RAY_ENTRIES … … 373 369 float right = 1.0f; 374 370 // cast rays to find silhouette ray 375 for (int j=0; j < Q_SEARCH_STEPS; j++) {371 for (int j=0; j < mSilhouetteSearchSteps; j++) { 376 372 for (i=0; i < packetSize; i++) { 377 373 float r = left + (i+1)*(right-left)/(packetSize+1); … … 482 478 float right = radius; 483 479 // cast rays to find silhouette ray 484 for (int j=0; j < Q_SEARCH_STEPS; j++) {480 for (int j=0; j < mSilhouetteSearchSteps; j++) { 485 481 for (i=0; i < packetSize; i++) { 486 482 float r = left + (i+1)*(right-left)/(packetSize+1); … … 623 619 } 624 620 625 #if USE_SILHOUETTE_MUTATIONS626 return GenerateSilhouetteMutation(index, sray);627 #else628 621 return GenerateMutation(index, sray); 629 #endif630 622 } 631 623 … … 666 658 Vector3 termination = ray->mTermination; //box.Center(); //ray->mTermination; //box.Center(); 667 659 668 // optimal for Pompeii 0.1f 669 // optimal for Vienna 0.5f 670 671 float radiusExtension = 0.5f; 672 // + mRays[index].mMutations/50.0f; 673 674 float mutationRadius = objectRadius*radiusExtension; 675 676 // tmp for pompeii 677 // mutationRadius = 0.22f; 678 660 679 661 // use probabilitistic approach to decide for the type of mutation 680 662 float a = RandomValue(0.0f,1.0f); 681 663 682 if ( a < SIL_TERMINATION_MUTATION_PROB) {664 if (mUseSilhouetteSamples && a < mSilhouetteProb) { 683 665 termination += ComputeSilhouetteTerminationMutation(*ray, 684 666 origin, … … 691 673 origin += ComputeOriginMutation(*ray, U, V, 692 674 Vector2(rr[0], rr[1]), 693 m utationRadius);675 mMutationRadiusOrigin*objectRadius); 694 676 695 677 termination += ComputeTerminationMutation(*ray, U, V, 696 678 Vector2(rr[2], rr[3]), 697 m utationRadius);679 mMutationRadiusTermination*objectRadius); 698 680 } 699 681 … … 734 716 return false; 735 717 } 736 737 bool738 MutationBasedDistribution::GenerateSilhouetteMutation(const int index, SimpleRay &sray)739 {740 #ifndef GTP_INTERNAL741 return GenerateMutation(index, sray);742 #else743 const int packetSize = 4;744 const int maxTries = 8;745 746 static int hit_triangles[16];747 static float dist[16];748 749 SimpleRay mutationCandidates[packetSize];750 int candidates = 0;751 752 VssRay *ray = mRays[index].mRay;753 754 Intersectable *object = mPreprocessor.mViewCellsManager->GetIntersectable(755 *ray,756 true);757 758 AxisAlignedBox3 box = object->GetBox();759 760 int id = 0;761 int silhouetteRays = 0;762 int tries = 0;763 while (silhouetteRays == 0 && tries < maxTries) {764 for (candidates = 0; candidates < packetSize && tries < maxTries; tries++)765 if (GenerateMutationCandidate(index, mutationCandidates[candidates], object, box))766 candidates++;767 768 if (candidates < packetSize)769 break;770 771 // cout<<candidates<<endl;772 // cast rays to find silhouette edge773 for (int i=0; i < packetSize; i++)774 mlrtaStoreRayAS4(&mutationCandidates[i].mOrigin.x,775 &mutationCandidates[i].mDirection.x,776 i);777 778 mlrtaTraverseGroupAS4(&box.Min().x,779 &box.Max().x,780 hit_triangles,781 dist);782 783 for (int i=0; i < packetSize; i++)784 if (hit_triangles[i] == -1) {785 silhouetteRays++;786 id = i;787 break;788 }789 }790 791 if (candidates == 0)792 return false;793 794 // cout<<id<<endl;795 // cout<<tries<<endl;796 sray = mutationCandidates[id];797 mRays[index].mMutations++;798 mRays[index].mUnsuccessfulMutations++;799 800 return true;801 #endif802 }803 804 718 805 719 … … 811 725 mType = MUTATION_BASED_DISTRIBUTION; 812 726 mBufferStart = 0; 813 mMaxRays = 500000; 727 mLastIndex = 0; 728 729 Environment::GetSingleton()->GetIntValue("Mutation.bufferSize", 730 mMaxRays); 731 814 732 mRays.reserve(mMaxRays); 815 mOriginMutationSize = 10.0f; 816 mLastIndex = 0; 817 // mOriginMutationSize = Magnitude(preprocessor.mViewCellsManager-> 818 // GetViewSpaceBox().Diagonal())*1e-3; 819 820 } 821 822 823 824 } 733 734 Environment::GetSingleton()->GetFloatValue("Mutation.radiusOrigin", 735 mMutationRadiusOrigin); 736 737 Environment::GetSingleton()->GetFloatValue("Mutation.radiusTermination", 738 mMutationRadiusTermination); 739 740 Environment::GetSingleton()->GetBoolValue("Mutation.useReverseSamples", 741 mUseReverseSamples); 742 743 Environment::GetSingleton()->GetFloatValue("Mutation.reverseSamplesDistance", 744 mReverseSamplesDistance); 745 746 747 Environment::GetSingleton()->GetBoolValue("Mutation.useSilhouetteSamples", 748 mUseSilhouetteSamples); 749 750 Environment::GetSingleton()->GetIntValue("Mutation.silhouetteSearchSteps", 751 mSilhouetteSearchSteps); 752 753 Environment::GetSingleton()->GetFloatValue("Mutation.silhouetteProb", 754 mSilhouetteProb); 755 756 757 Environment::GetSingleton()->GetBoolValue("Mutation.usePassImportance", 758 mUsePassImportance); 759 760 761 Environment::GetSingleton()->GetBoolValue("Mutation.useUnsuccCountImportance", 762 mUseUnsuccCountImportance); 763 764 765 766 } 767 768 769 770 } -
GTP/trunk/Lib/Vis/Preprocessing/src/Mutation.h
r2022 r2060 32 32 bool 33 33 GenerateMutation(const int index, SimpleRay &ray); 34 bool35 GenerateSilhouetteMutation(const int index, SimpleRay &ray);36 34 37 35 bool … … 126 124 127 125 vector<RayEntry> mRays; 128 int mMaxRays;129 float mOriginMutationSize;130 126 int mBufferStart; 131 127 int mLastIndex; 128 129 130 int mMaxRays; 131 float mMutationRadiusOrigin; 132 float mMutationRadiusTermination; 133 bool mUseReverseSamples; 134 float mReverseSamplesDistance; 135 bool mUseSilhouetteSamples; 136 int mSilhouetteSearchSteps; 137 float mSilhouetteProb; 138 bool mUsePassImportance; 139 bool mUseUnsuccCountImportance; 140 132 141 }; 133 142 -
GTP/trunk/Lib/Vis/Preprocessing/src/default.env
r2051 r2060 199 199 200 200 ViewCells { 201 importRandomViewCells true201 importRandomViewCells false 202 202 203 203 useKdPvs true -
GTP/trunk/Lib/Vis/Preprocessing/src/run_test2
r2052 r2060 31 31 32 32 SCENE=../data/vienna/vienna_cropped.obj 33 VIEWCELLS=../data/vienna/vienna_cropped-gradient-viewcells.xml.gz 33 #VIEWCELLS=../data/vienna/vienna_cropped-gradient-viewcells.xml.gz 34 VIEWCELLS=../data/vienna/vienna-seq-viewcells-20000.xml.gz 34 35 36 <<<<<<< .mine 37 PREFIX=../work/plots/osp-vienna2-1e5 38 ======= 35 39 # SCENE=../data/Pompeii/PompeiiTen.obj 36 40 # VIEWCELLS=../data/Pompeii/pompeii_big-seq-viewcells.xml.gz 41 >>>>>>> .r2051 37 42 38 43 PREFIX=../work/plots/osp-FILTER-1e5 … … 50 55 -preprocessor_histogram_file=$PREFIX-i-mixed-b1-n4a.hlog 51 56 57 <<<<<<< .mine 58 # $COMMAND -preprocessor=sampling -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 59 # -preprocessor_visibility_file=$PREFIX-r-reference.xml \ 60 # -view_cells_filter_max_size=1 -preprocessor_stats=$PREFIX-r-reference.log \ 61 # -preprocessor_histogram_file=$PREFIX-r-reference.hlog 62 ======= 52 63 $COMMAND -preprocessor=combined -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 53 64 -rss_distributions=mutation+object_direction+spatial \ … … 57 68 -preprocessor_stats=$PREFIX-i-mixed-b1-n4b.log \ 58 69 -preprocessor_histogram_file=$PREFIX-i-mixed-b1-n4b.hlog 70 >>>>>>> .r2051 59 71 60 72 $COMMAND -preprocessor=combined -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ … … 78 90 79 91 80 #$COMMAND -preprocessor=combined -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \81 #-rss_distributions=mutation+object_direction+spatial -view_cells_filter_max_size=1 \82 # -view_cells_use_kd_pvs- -af_use_kd_pvs+\83 #-preprocessor_visibility_file=$PREFIX-i-mixed-bvh-n4k.xml \84 #-preprocessor_stats=$PREFIX-i-mixed-bvh-n4k.log \85 #-preprocessor_histogram_file=$PREFIX-i-mixed-bvh-n4k.hlog92 $COMMAND -preprocessor=combined -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 93 -rss_distributions=mutation+object_direction+spatial -view_cells_filter_max_size=1 \ 94 -view_cells_use_kd_pvs- -af_use_kd_pvs- \ 95 -preprocessor_visibility_file=$PREFIX-i-mixed-bvh-n4k.xml \ 96 -preprocessor_stats=$PREFIX-i-mixed-bvh-n4k.log \ 97 -preprocessor_histogram_file=$PREFIX-i-mixed-bvh-n4k.hlog 86 98 87 #$COMMAND -preprocessor=sampling -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \88 # -view_cells_use_kd_pvs- -af_use_kd_pvs+\89 #-preprocessor_visibility_file=$PREFIX-r-bvh-reference.xml \90 #-view_cells_filter_max_size=1 -preprocessor_stats=$PREFIX-r-bvh-reference.log \91 #-preprocessor_histogram_file=$PREFIX-r-bvh-reference.hlog99 $COMMAND -preprocessor=sampling -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 100 -view_cells_use_kd_pvs- -af_use_kd_pvs- \ 101 -preprocessor_visibility_file=$PREFIX-r-bvh-reference.xml \ 102 -view_cells_filter_max_size=1 -preprocessor_stats=$PREFIX-r-bvh-reference.log \ 103 -preprocessor_histogram_file=$PREFIX-r-bvh-reference.hlog 92 104 93 #$COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \94 # -view_cells_use_kd_pvs- -af_use_kd_pvs+\95 #-rss_distributions=direction -view_cells_filter_max_size=1 \96 #-preprocessor_visibility_file=$PREFIX-r-bvh-reference-global.xml \97 #-preprocessor_stats=$PREFIX-r-bvh-reference-global.log \98 #-preprocessor_histogram_file=$PREFIX-r-bvh-reference-global.hlog105 $COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 106 -view_cells_use_kd_pvs- -af_use_kd_pvs- \ 107 -rss_distributions=direction -view_cells_filter_max_size=1 \ 108 -preprocessor_visibility_file=$PREFIX-r-bvh-reference-global.xml \ 109 -preprocessor_stats=$PREFIX-r-bvh-reference-global.log \ 110 -preprocessor_histogram_file=$PREFIX-r-bvh-reference-global.hlog 99 111 100 112
Note: See TracChangeset
for help on using the changeset viewer.