Changeset 1966 for GTP/trunk/Lib/Vis/Preprocessing
- Timestamp:
- 01/10/07 21:32:50 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/CombinedPreprocessor.cpp
r1942 r1966 16 16 namespace GtpVisibilityPreprocessor { 17 17 18 const bool pruneInvalidRays = false;18 const bool pruneInvalidRays = true; 19 19 20 20 … … 23 23 { 24 24 // this should increase coherence of the samples 25 Environment::GetSingleton()->GetIntValue("RssPreprocessor.vssSamples", mTotalSamples);26 Environment::GetSingleton()->GetIntValue("RssPreprocessor.samplesPerPass", mSamplesPerPass);27 Environment::GetSingleton()->GetIntValue("RssPreprocessor.vssSamplesPerPass",28 mSamplesPerEvaluation);25 // Environment::GetSingleton()->GetIntValue("RssPreprocessor.vssSamples", mTotalSamples); 26 // Environment::GetSingleton()->GetIntValue("RssPreprocessor.samplesPerPass", mSamplesPerPass); 27 // Environment::GetSingleton()->GetIntValue("RssPreprocessor.vssSamplesPerPass", 28 // mSamplesPerEvaluation); 29 29 30 30 … … 69 69 for (int i=0; i < mTotalSamples; i += mSamplesPerPass, mPass++) { 70 70 71 72 71 cout<<"Progress : "<<(100.0f*i)/mTotalSamples<<"%"<<endl; 73 72 rays.clear(); … … 108 107 } 109 108 109 cerr<<"deleting rays"<<endl; 110 //clear all unreferenced rays 111 for (int j=0; j < vssRays.size(); j++) { 112 if (vssRays[j]->RefCount() == 0) 113 delete vssRays[j]; 114 } 115 cerr<<"done."<<endl; 116 110 117 111 112 if (!mMixtureDistribution->RequiresRays()) 113 CLEAR_CONTAINER(vssRays); 118 // if (!mMixtureDistribution->RequiresRays()) 119 // CLEAR_CONTAINER(vssRays); 114 120 115 121 if (renderer) { -
GTP/trunk/Lib/Vis/Preprocessing/src/CombinedPreprocessor.h
r1891 r1966 27 27 MixtureDistribution *mMixtureDistribution; 28 28 29 int mTotalSamples;30 int mSamplesPerPass;31 int mSamplesPerEvaluation;32 33 29 }; 34 30 -
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r1942 r1966 1173 1173 "0.1"); 1174 1174 1175 RegisterOption("SamplingPreprocessor.totalSamples", 1176 optInt, 1177 "total_samples=", 1178 "1000000"); 1179 1180 RegisterOption("SamplingPreprocessor.samplesPerPass", 1181 optInt, 1182 "samples_per_pass=", 1183 "10"); 1175 RegisterOption("Preprocessor.totalSamples", 1176 optInt, 1177 "total_samples=", 1178 "10000000"); 1179 1180 RegisterOption("Preprocessor.samplesPerPass", 1181 optInt, 1182 "samples_per_pass=", 1183 "100000"); 1184 1185 RegisterOption("Preprocessor.samplesPerEvaluation", 1186 optInt, 1187 "samples_per_evaluation=", 1188 "1000000"); 1184 1189 1185 1190 RegisterOption("RenderSampler.samples", … … 1199 1204 "true"); 1200 1205 1201 RegisterOption("VssPreprocessor.initialSamples",1202 optInt,1203 "vss_initial_samples=",1204 "100000");1206 // RegisterOption("VssPreprocessor.initialSamples", 1207 // optInt, 1208 // "vss_initial_samples=", 1209 // "100000"); 1205 1210 1206 1211 RegisterOption("VssPreprocessor.testBeamSampling", … … 1209 1214 "false"); 1210 1215 1211 RegisterOption("VssPreprocessor.vssSamples",1212 optInt,1213 "vss_samples=",1214 "1000000");1215 1216 RegisterOption("VssPreprocessor.vssSamplesPerPass",1217 optInt,1218 "vss_samples_per_pass=",1219 "1000");1220 1221 RegisterOption("VssPreprocessor.samplesPerPass",1222 optInt,1223 "vss_samples_per_pass=",1224 "100000");1216 // RegisterOption("VssPreprocessor.vssSamples", 1217 // optInt, 1218 // "vss_samples=", 1219 // "1000000"); 1220 1221 // RegisterOption("VssPreprocessor.vssSamplesPerPass", 1222 // optInt, 1223 // "vss_samples_per_pass=", 1224 // "1000"); 1225 1226 // RegisterOption("VssPreprocessor.samplesPerPass", 1227 // optInt, 1228 // "vss_samples_per_pass=", 1229 // "100000"); 1225 1230 1226 1231 RegisterOption("VssPreprocessor.useImportanceSampling", … … 1896 1901 1897 1902 1898 RegisterOption("RssPreprocessor.initialSamples",1899 optInt,1900 "rss_initial_samples=",1901 "100000");1902 1903 RegisterOption("RssPreprocessor.vssSamples",1904 optInt,1905 "rss_vss_samples=",1906 "1000000");1907 1908 RegisterOption("RssPreprocessor.vssSamplesPerPass",1909 optInt,1910 "rss_vss_samples_per_pass=",1911 "1000");1912 1913 RegisterOption("RssPreprocessor.samplesPerPass",1914 optInt,1915 "rss_samples_per_pass=",1916 "100000");1903 // RegisterOption("RssPreprocessor.initialSamples", 1904 // optInt, 1905 // "rss_initial_samples=", 1906 // "100000"); 1907 1908 // RegisterOption("RssPreprocessor.vssSamples", 1909 // optInt, 1910 // "rss_vss_samples=", 1911 // "1000000"); 1912 1913 // RegisterOption("RssPreprocessor.vssSamplesPerPass", 1914 // optInt, 1915 // "rss_vss_samples_per_pass=", 1916 // "1000"); 1917 1918 // RegisterOption("RssPreprocessor.samplesPerPass", 1919 // optInt, 1920 // "rss_samples_per_pass=", 1921 // "100000"); 1917 1922 1918 1923 RegisterOption("RssPreprocessor.useImportanceSampling", -
GTP/trunk/Lib/Vis/Preprocessing/src/Makefile
r1952 r1966 1 1 ############################################################################# 2 2 # Makefile for building: preprocessor 3 # Generated by qmake (2.00a) (Qt 4.1.2) on: ne 7. I 23:22:4620073 # Generated by qmake (2.00a) (Qt 4.1.2) on: st 10. I 21:30:27 2007 4 4 # Project: preprocessor.pro 5 5 # Template: app -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r1960 r1966 168 168 Environment::GetSingleton()->GetIntValue("Preprocessor.Export.numRays", mExportNumRays); 169 169 170 171 Environment::GetSingleton()->GetIntValue("Preprocessor.samplesPerPass", mSamplesPerPass); 172 Environment::GetSingleton()->GetIntValue("Preprocessor.totalSamples", mTotalSamples); 173 Environment::GetSingleton()->GetIntValue("Preprocessor.samplesPerEvaluation", 174 mSamplesPerEvaluation); 175 176 170 177 Debug << "******* Preprocessor Options **********" << endl; 171 178 Debug << "detect empty view space=" << mDetectEmptyViewSpace << endl; -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h
r1958 r1966 233 233 GlRendererBuffer *renderer; 234 234 235 235 int mTotalSamples; 236 int mSamplesPerPass; 237 int mSamplesPerEvaluation; 238 236 239 protected: 237 240 -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r1948 r1966 692 692 updateGL(); 693 693 break; 694 694 case Qt::Key_S: { 695 // set view poitn and direction 696 QString text; 697 bool ok; 698 text.sprintf("%f %f %f", mViewPoint.x, mViewPoint.y, mViewPoint.z); 699 text = QInputDialog::getText(this, 700 "Enter a view point", 701 "", 702 QLineEdit::Normal, 703 text, 704 &ok); 705 if (!ok) 706 break; 707 QTextStream ts(&text); 708 ts>>mViewPoint.x>>mViewPoint.y>>mViewPoint.z; 709 mViewCellsManager->GetViewPoint(mViewPoint); 710 updateGL(); 711 break; 712 } 695 713 default: 696 714 e->ignore(); -
GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.cpp
r1952 r1966 142 142 return 0; 143 143 } 144 if (EpsilonEqualV3(hitA.mPoint, hitB.mPoint, Limits::Small)) { 145 return 0; 146 } 147 } 144 } 145 148 146 149 147 // regardless of the pruneInvalidRays setting reject rays whic degenerate to a point 148 if (EpsilonEqualV3(hitA.mPoint, hitB.mPoint, Limits::Small)) { 149 return 0; 150 } 151 152 150 153 const bool validA = ValidateRay(simpleRay.mOrigin, simpleRay.mDirection, box, hitA); 151 154 const bool validB = //castDoubleRay && -
GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.cpp
r1931 r1966 29 29 { 30 30 // this should increase coherence of the samples 31 Environment::GetSingleton()->GetIntValue("RssPreprocessor.samplesPerPass", mSamplesPerPass);32 Environment::GetSingleton()->GetIntValue("RssPreprocessor.initialSamples", mInitialSamples);33 Environment::GetSingleton()->GetIntValue("RssPreprocessor.vssSamples", mRssSamples);34 Environment::GetSingleton()->GetIntValue("RssPreprocessor.vssSamplesPerPass", mRssSamplesPerPass);31 // Environment::GetSingleton()->GetIntValue("RssPreprocessor.samplesPerPass", mSamplesPerPass); 32 //Environment::GetSingleton()->GetIntValue("RssPreprocessor.initialSamples", mInitialSamples); 33 //Environment::GetSingleton()->GetIntValue("RssPreprocessor.vssSamples", mRssSamples); 34 //Environment::GetSingleton()->GetIntValue("RssPreprocessor.vssSamplesPerPass", mRssSamplesPerPass); 35 35 Environment::GetSingleton()->GetBoolValue("RssPreprocessor.useImportanceSampling", mUseImportanceSampling); 36 36 -
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.cpp
r1900 r1966 20 20 { 21 21 // this should increase coherence of the samples 22 Environment::GetSingleton()->GetIntValue("SamplingPreprocessor.samplesPerPass", mSamplesPerPass);23 Environment::GetSingleton()->GetIntValue("SamplingPreprocessor.totalSamples", mTotalSamples);24 22 25 23 } … … 87 85 int intersectables, faces; 88 86 mSceneGraph->GetStatistics(intersectables, faces); 89 HaltonSequence halton;87 HaltonSequence posHalton; 90 88 91 89 int samples = 0; 92 int i=0; 90 int rssSamples = 0; 91 92 map<ViewCell *, HaltonSequence> dirHalton; 93 93 94 while (samples < mTotalSamples) { 94 for (i =0; i < mSamplesPerPass;) {95 for (int i=0; i < mSamplesPerEvaluation;) { 95 96 SimpleRayContainer rays; 96 97 VssRayContainer vssRays; 97 vector<ViewCell *> viewcells; 98 // vector<ViewCell *> viewcells; 99 100 float r[5]; 101 Vector3 origin, direction; 102 posHalton.GetNext(3, r); 103 104 mViewCellsManager->GetViewPoint(origin, Vector3(r[0], r[1], r[2])); 105 ViewCell *viewcell = mViewCellsManager->GetViewCell(origin); 106 107 if (!viewcell || !viewcell->GetValid()) 108 continue; 109 98 110 for (; rays.size() < 16; ) { 99 if (i%10000 == 0)111 if (i%100000 == 0) 100 112 cout<<"+"; 101 102 float r[5];103 halton.GetNext(5, r);104 Vector3 origin, direction;105 mViewCellsManager->GetViewPoint(origin, Vector3(r[0], r[1], r[2]));106 113 107 direction = UniformRandomVector(r[3],r[4]); 108 ViewCell *viewcell = mViewCellsManager->GetViewCell(origin); 114 // dirHalton.GetNext(2, r); 115 dirHalton[viewcell].GetNext(2, r); 116 direction = UniformRandomVector(r[0],r[1]); 117 //direction = UniformRandomVector(); 109 118 110 if (viewcell && viewcell->GetValid()) { 111 viewcells.push_back(viewcell); 112 // cast rays in both directions to make the number of samples comparable 113 // with the global sampling method which also casts a "double" ray per sample 114 rays.push_back(SimpleRay(origin, 115 direction, 116 SamplingStrategy::DIRECTION_BASED_DISTRIBUTION, 117 1.0f)); 118 i++; 119 samples++; 120 } 119 // viewcells.push_back(viewcell); 120 // cast rays in both directions to make the number of samples comparable 121 // with the global sampling method which also casts a "double" ray per sample 122 rays.push_back(SimpleRay(origin, 123 direction, 124 SamplingStrategy::DIRECTION_BASED_DISTRIBUTION, 125 1.0f)); 126 i++; 127 samples++; 121 128 } 122 129 … … 124 131 vssRays, 125 132 true, 126 false); 127 128 if (vssRays.size()!=32) { 129 cerr<<"wrong number of rays "<<(int)vssRays.size()<<endl; 130 exit(1); 131 } 132 133 true); 134 135 // if (vssRays.size()!=32) { 136 // cerr<<"wrong number of rays "<<(int)vssRays.size()<<endl; 137 // exit(1); 138 // } 139 140 rssSamples+=vssRays.size(); 133 141 for (int j=0; j < vssRays.size(); j++) 134 142 if (vssRays[j]->mFlags & VssRay::Valid) { … … 137 145 if (obj) { 138 146 // if ray not outside of view space 139 float contribution;140 int pvsContribution = 0;141 float relativePvsContribution = 0;142 147 float pdf = 1.0f; 143 ViewCell *viewcell = viewcells[j/2]; 144 if (viewcell->GetPvs().GetSampleContribution(obj, 145 pdf, 146 contribution)) 147 ++pvsContribution; 148 relativePvsContribution += contribution; 149 viewcell->GetPvs().AddSample(obj, pdf); 148 // ViewCell *viewcell = viewcells[j/2]; 149 150 ObjectPvs &pvs = viewcell->GetPvs(); 151 pvs.AddSampleDirtyCheck(obj, pdf); 152 153 if (pvs.RequiresResort()) { 154 pvs.SimpleSort(); 155 } 150 156 } 151 157 } 152 158 153 159 CLEAR_CONTAINER(vssRays); 154 160 155 161 if (samples > mTotalSamples) 156 162 break; … … 166 172 mStats << 167 173 "#Time\n" << TimeDiff(startTime, GetTime())*1e-3<<endl<< 168 "#TotalSamples\n" <<samples<<endl; 169 174 "#TotalSamples\n" <<samples<<endl<< 175 "#RssSamples\n" <<rssSamples<<endl; 176 170 177 mViewCellsManager->PrintPvsStatistics(mStats); 171 178 // ComputeRenderError(); -
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.h
r1771 r1966 47 47 48 48 int mPass; 49 int mSamplesPerPass;50 int mTotalSamples;51 49 52 50 ObjectContainer mObjects; -
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp
r1952 r1966 18 18 HaltonSequence ObjectDirectionBasedDistribution::sHalton; 19 19 HaltonSequence DirectionBasedDistribution::sHalton; 20 HaltonSequence MutationBasedDistribution::sHalton;21 20 22 21 … … 478 477 // small non-zero value 479 478 mDistributions[i]->mRays = 1; 479 mDistributions[i]->mGeneratedRays = 1; 480 480 // unit contribution per ray 481 481 if (1 || mDistributions[i]->mType != RSS_BASED_DISTRIBUTION) … … 511 511 break; 512 512 513 return mDistributions[i]->GenerateSample(ray); 513 bool result = mDistributions[i]->GenerateSample(ray); 514 515 if (result) 516 mDistributions[i]->mGeneratedRays++; 517 518 return result; 514 519 } 515 520 … … 548 553 549 554 UpdateRatios(); 555 550 556 } 551 557 … … 558 564 } 559 565 } 560 566 567 #define RAY_CAST_TIME 0.9f 568 #define VIEWCELL_CAST_TIME 0.1f 569 561 570 void 562 571 MixtureDistribution::UpdateRatios() … … 570 579 float importance = 0.0f; 571 580 if (mDistributions[i]->mRays != 0) { 572 // importance = pow(mDistributions[i]->mContribution/mDistributions[i]->mRays, 3); 573 importance = mDistributions[i]->mContribution/mDistributions[i]->mRays; 581 //importance = pow(mDistributions[i]->mContribution/mDistributions[i]->mRays, 2); 582 importance = mDistributions[i]->mContribution/ 583 (RAY_CAST_TIME*mDistributions[i]->mGeneratedRays + 584 VIEWCELL_CAST_TIME*mDistributions[i]->mRays); 574 585 } 575 586 mDistributions[i]->mRatio = importance; … … 577 588 } 578 589 579 const float minratio = 0.02f; 590 591 592 if (sum == 0.0f) 593 sum = Limits::Small; 594 595 const float minratio = 0.01f; 580 596 float threshold = minratio*sum; 597 598 // recaluate the sum 599 sum = 0.0f; 581 600 for (i=0; i < mDistributions.size(); i++) { 582 601 if (mDistributions[i]->mRatio < threshold) { 583 sum += threshold - mDistributions[i]->mRatio;584 602 mDistributions[i]->mRatio = threshold; 585 603 } 604 sum += mDistributions[i]->mRatio; 586 605 } 587 606 588 607 mDistributions[0]->mRatio /= sum; 589 608 590 609 for (i=1; i < mDistributions.size(); i++) { 591 610 float r = mDistributions[i]->mRatio / sum; 592 611 mDistributions[i]->mRatio = mDistributions[i-1]->mRatio + r; 593 612 } 613 594 614 595 615 cout<<"ratios: "; … … 653 673 } 654 674 655 675 int 676 MixtureDistribution::GenerateSamples(const int number, 677 SimpleRayContainer &rays) 678 { 679 for (int i=0; i < mDistributions.size(); i++) 680 mDistributions[i]->mGeneratedRays = 0; 681 682 return SamplingStrategy::GenerateSamples(number, rays); 683 } 656 684 657 685 void … … 661 689 // cout<<mRays[i].mSamples<<" "; 662 690 // cout<<endl; 663 691 cerr<<"Muattion update..."<<endl; 692 cerr<<"rays = "<<mRays.size()<<endl; 693 if (mRays.size()) 694 cerr<<"Oversampling factor = "<<mRays[0].mSamples<<endl; 664 695 for (int i=0; i < vssRays.size(); i++) { 665 VssRay *newRay = vssRays[i];666 if (newRay->mPvsContribution) {667 // add this ray668 newRay->Ref();669 if (mRays.size() < mMaxRays)696 if (vssRays[i]->mPvsContribution) { 697 if (mRays.size() < mMaxRays) { 698 VssRay *newRay = new VssRay(*vssRays[i]); 699 // add this ray 700 newRay->Ref(); 670 701 mRays.push_back(RayEntry(newRay)); 671 else {702 } else { 672 703 // unref the old ray 673 VssRay *oldRay = mRays[mBufferStart].mRay; 674 oldRay->Unref(); 675 if (oldRay->RefCount() == 0) 676 delete oldRay; 677 mRays[mBufferStart] = RayEntry(newRay); 704 *mRays[mBufferStart].mRay = *vssRays[i]; 705 mRays[mBufferStart].mSamples = 0; 706 // mRays[mBufferStart] = RayEntry(newRay); 678 707 mBufferStart++; 679 708 if (mBufferStart >= mMaxRays) … … 682 711 } 683 712 } 713 cerr<<"Mutation update done."<<endl; 714 684 715 } 685 716 … … 688 719 { 689 720 float r[5]; 690 sHalton.GetNext(5, r);691 721 692 722 if (mRays.size() == 0) { 693 723 // use direction based distribution 694 724 Vector3 origin, direction; 725 static HaltonSequence halton; 726 727 halton.GetNext(5, r); 695 728 mPreprocessor.mViewCellsManager->GetViewPoint(origin, 696 729 Vector3(r[0], r[1], r[2])); 697 730 731 698 732 direction = UniformRandomVector(r[3], r[4]); 699 733 … … 727 761 mRays[index].mSamples++; 728 762 mLastIndex = index; 763 764 mRays[index].mHalton.GetNext(4, r); 729 765 730 766 Vector3 v; … … 732 768 Vector3 d = ray->GetDir(); 733 769 if (d.DrivingAxis() == 0) 734 v = Vector3(0, r[ 1]-0.5f, r[2]-0.5f);770 v = Vector3(0, r[0]-0.5f, r[1]-0.5f); 735 771 else 736 772 if (d.DrivingAxis() == 1) 737 v = Vector3(r[ 1]-0.5f, 0, r[2]-0.5f);773 v = Vector3(r[0]-0.5f, 0, r[1]-0.5f); 738 774 else 739 v = Vector3(r[ 1]-0.5f, r[2]-0.5f, 0);775 v = Vector3(r[0]-0.5f, r[1]-0.5f, 0); 740 776 741 777 v=v*mOriginMutationSize; … … 745 781 // mutate the termination 746 782 if (d.DrivingAxis() == 0) 747 v = Vector3(0, r[ 3]-0.5f, r[4]-0.5f);783 v = Vector3(0, r[2]-0.5f, r[3]-0.5f); 748 784 else 749 785 if (d.DrivingAxis() == 1) 750 v = Vector3(r[ 3]-0.5f, 0, r[4]-0.5f);786 v = Vector3(r[2]-0.5f, 0, r[3]-0.5f); 751 787 else 752 v = Vector3(r[3]-0.5f, r[4]-0.5f, 0); 753 754 float size = 1.5f*Magnitude(ray->mTerminationObject->GetBox().Diagonal()); 788 v = Vector3(r[2]-0.5f, r[3]-0.5f, 0); 789 790 AxisAlignedBox3 box = ray->mTerminationObject->GetBox(); 791 float size = 2.0f*Magnitude(box.Diagonal()); 755 792 if (size < Limits::Small) 756 793 return false; … … 767 804 v = v*size; 768 805 769 Vector3 termination = ray->mTermination + v; 806 // Vector3 termination = ray->mTermination + v; 807 Vector3 termination = box.Center() + v; 770 808 771 809 Vector3 direction = termination - origin; … … 775 813 776 814 // shift the origin a little bit 777 origin += direction*0. 05f;778 815 origin += direction*0.5f; 816 779 817 direction.Normalize(); 780 818 … … 786 824 } 787 825 788 MutationBasedDistribution::MutationBasedDistribution(Preprocessor &preprocessor) : 826 MutationBasedDistribution::MutationBasedDistribution(Preprocessor &preprocessor 827 ) : 789 828 SamplingStrategy(preprocessor) 790 829 { 791 830 mType = MUTATION_BASED_DISTRIBUTION; 792 831 mBufferStart = 0; 793 mMaxRays = 1000000;794 795 mOriginMutationSize = 2.0f;832 mMaxRays = 500000; 833 mRays.reserve(mMaxRays); 834 mOriginMutationSize = 10.0f; 796 835 mLastIndex = 0; 797 836 // mOriginMutationSize = Magnitude(preprocessor.mViewCellsManager-> -
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.h
r1964 r1966 79 79 80 80 int mTotalRays; 81 int mGeneratedRays; 81 82 float mTotalContribution; 82 83 … … 231 232 private: 232 233 virtual bool GenerateSample(SimpleRay &ray); 233 static HaltonSequence sHalton; 234 234 235 struct RayEntry { 236 // halton sequence for generatin gmutations of this ray 235 237 VssRay *mRay; 236 238 int mSamples; 237 RayEntry(); 238 RayEntry(VssRay *r):mRay(r), mSamples(0) {} 239 HaltonSequence mHalton; 240 241 RayEntry() {} 242 RayEntry(VssRay *r):mRay(r), mSamples(0), mHalton() {} 239 243 }; 240 244 … … 296 300 // container for the distributions 297 301 vector<SamplingStrategy *> mDistributions; 298 302 299 303 MixtureDistribution(Preprocessor &preprocessor): 300 304 SamplingStrategy(preprocessor) … … 330 334 return false; 331 335 } 332 336 337 virtual int GenerateSamples(const int number, SimpleRayContainer &rays); 338 333 339 private: 334 340 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1952 r1966 697 697 int histoMaxVal; 698 698 Environment::GetSingleton()->GetIntValue("Preprocessor.histogram.maxValue", histoMaxVal); 699 maxRenderCost = m ax((float)histoMaxVal, maxRenderCost);699 maxRenderCost = min((float)histoMaxVal, maxRenderCost); 700 700 701 701 … … 2039 2039 PvsFilterStatistics fstat = ApplyFilter2(viewcell, 2040 2040 false, 2041 4.0f,2041 1.0f, 2042 2042 filteredPvs); 2043 2043 … … 2305 2305 { 2306 2306 // copy viewcells memory efficiently 2307 #if VSS_STORE_VIEWCELLS 2307 2308 ray.mViewCells.reserve(viewCells.size()); 2308 2309 ray.mViewCells = viewCells; 2310 #else 2311 cerr<<"Vss store viewcells not supported."<<endl; 2312 exit(1); 2313 #endif 2309 2314 } 2310 2315 … … 2966 2971 #else 2967 2972 radius = 0.5f*globalRadius + 0.5f*localRadius; 2968 stats.mLocalFilterCount++; 2969 stats.mGlobalFilterCount++; 2973 2974 if (localRadius > globalRadius) 2975 stats.mLocalFilterCount++; 2976 else 2977 stats.mGlobalFilterCount++; 2970 2978 #endif 2971 2979 -
GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.cpp
r1883 r1966 29 29 { 30 30 // this should increase coherence of the samples 31 Environment::GetSingleton()->GetIntValue("VssPreprocessor.samplesPerPass", mSamplesPerPass);32 Environment::GetSingleton()->GetIntValue("VssPreprocessor.initialSamples", mInitialSamples);33 Environment::GetSingleton()->GetIntValue("VssPreprocessor.vssSamples", mVssSamples);34 Environment::GetSingleton()->GetIntValue("VssPreprocessor.vssSamplesPerPass", mVssSamplesPerPass);31 // Environment::GetSingleton()->GetIntValue("VssPreprocessor.samplesPerPass", mSamplesPerPass); 32 // Environment::GetSingleton()->GetIntValue("VssPreprocessor.initialSamples", mInitialSamples); 33 // Environment::GetSingleton()->GetIntValue("VssPreprocessor.vssSamples", mVssSamples); 34 // Environment::GetSingleton()->GetIntValue("VssPreprocessor.vssSamplesPerPass", mVssSamplesPerPass); 35 35 Environment::GetSingleton()->GetBoolValue("VssPreprocessor.useImportanceSampling", mUseImportanceSampling); 36 36 -
GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.cpp
r1942 r1966 26 26 mFlags(0), 27 27 mPass(pass), 28 #if VSS_STORE_VIEWCELLS 28 29 mViewCells(0), 30 #endif 29 31 mWeightedPvsContribution(0), 30 32 mPdf(pdf), … … 43 45 mOriginObject(ray.sourceObject.mObject), 44 46 mPass(0), 47 #if VSS_STORE_VIEWCELLS 45 48 mViewCells(0), 49 #endif 46 50 mPdf(1.0f), 47 51 mTerminationNode(NULL), -
GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.h
r1900 r1966 15 15 16 16 #define ABS_CONTRIBUTION_WEIGHT 0.0f 17 17 #define VSS_STORE_VIEWCELLS 1 18 18 19 class VssRay { 19 20 public: … … 59 60 Intersectable *mTerminationObject; 60 61 62 #if VSS_STORE_VIEWCELLS 61 63 ViewCellContainer mViewCells; 62 64 #endif 63 65 64 66 //////////////////////// -
GTP/trunk/Lib/Vis/Preprocessing/src/default.env
r1952 r1966 37 37 38 38 Preprocessor { 39 totalSamples 250000000 40 samplesPerPass 1000000 41 # initialSamples 2000000 42 samplesPerEvaluation 5000000 43 39 44 delayVisibilityComputation false 40 45 # stored sample rays … … 69 74 histogram { 70 75 intervals 20 71 maxValue 100076 maxValue 600000 72 77 file histogram.log 73 78 } 74 79 Export { 75 rays false80 rays true 76 81 numRays 5000 77 82 } … … 89 94 90 95 SamplingPreprocessor { 91 totalSamples 10000000092 samplesPerPass 500000093 96 } 94 97 … … 98 101 # distributions rss+spatial+object_direction 99 102 # distributions rss+object_direction+spatial+object+direction 100 distributions object_direction+spatial+object+direction103 distributions mutation+spatial+object_direction 101 104 # distributions rss+object_direction 102 105 # distributions object_direction 103 106 104 samplesPerPass 1000000105 initialSamples 2000000106 vssSamples 500000000107 vssSamplesPerPass 5000000108 107 useImportanceSampling true 109 108 -
GTP/trunk/Lib/Vis/Preprocessing/src/run_test2
r1942 r1966 29 29 VIEWCELLS=../data/vienna/vienna_cropped-gradient-viewcells.xml.gz 30 30 31 PREFIX=../work/plots/osp -rss2-1e531 PREFIX=../work/plots/osp2-1e5 32 32 33 33 #SCENE=../data/atlanta/atlanta2.x3d … … 35 35 36 36 37 #$COMMAND -preprocessor=sampling -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \38 #-view_cells_filter_max_size=1 -preprocessor_stats=$PREFIX-r-reference.log \39 #-preprocessor_histogram_file=$PREFIX-r-reference.hlog40 37 41 42 #$COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 43 #-rss_update_subdivision+ -rss_split=hybrid -hybrid_depth=10 \ 44 #-view_cells_filter_max_size=1 -preprocessor_stats=$PREFIX-i-combined-update-ccb12-nn.log \ 45 #-preprocessor_histogram_file=$PREFIX-i-combined-update-ccb12-nn.hlog 38 $COMMAND -preprocessor=sampling -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 39 -preprocessor_visibility_file=$PREFIX-r-reference.xml \ 40 -view_cells_filter_max_size=1 -preprocessor_stats=$PREFIX-r-reference.log \ 41 -preprocessor_histogram_file=$PREFIX-r-reference.hlog 46 42 47 43 # $COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 48 # -rss_update_subdivision- -rss_split=hybrid -hybrid_depth=10 \ 49 # -view_cells_filter_max_size=1 -preprocessor_stats=$PREFIX-i-combined-ccb12-nn.log \ 50 # -preprocessor_histogram_file=$PREFIX-i-combined-ccb12-nn22.hlog 51 52 53 # ####### 54 # ####### 55 # $COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 56 # -rss_use_importance- -rss_object_based_sampling- -rss_directional_sampling+ \ 57 # -view_cells_filter_max_size=1 -preprocessor_stats=$PREFIX-r-directional-based-b3.log \ 58 # -preprocessor_histogram_file=$PREFIX-r-directional-based-b3.hlog 44 # -rss_distributions=direction -view_cells_filter_max_size=1 \ 45 # -preprocessor_visibility_file=$PREFIX-r-reference-global.xml \ 46 # -preprocessor_stats=$PREFIX-r-reference-global.log \ 47 # -preprocessor_histogram_file=$PREFIX-r-reference-global.hlog 59 48 60 49 # $COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 61 # -rss_use_importance- -rss_object_based_sampling- -rss_directional_sampling- \ 62 # -view_cells_filter_max_size=1 -preprocessor_stats=$PREFIX-r-spatial-based-bb3.log \ 63 # -preprocessor_histogram_file=$PREFIX-r-spatial-based-bb3.hlog 64 65 66 $COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 67 -rss_distributions=rss+object_direction+spatial+object+direction -view_cells_filter_max_size=1 \ 68 -preprocessor_stats=$PREFIX-i-mixed-b1-n4.log \ 69 -preprocessor_histogram_file=$PREFIX-i-mixed-b1-n4.hlog 50 # -rss_distributions=mutation+object_direction+spatial -view_cells_filter_max_size=1 \ 51 # -preprocessor_visibility_file=$PREFIX-i-mixed-b1-n4c.xml \ 52 # -preprocessor_stats=$PREFIX-i-mixed-b1-n4c.log \ 53 # -preprocessor_histogram_file=$PREFIX-i-mixed-b1-n4c.hlog 70 54 71 55 # $COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ … … 75 59 76 60 77 # $COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \78 # -rss_use_importance+ -rss_use_rss_tree- -view_cells_filter_max_size=1 \79 # -rss_initial_samples=500000 -rss_vss_samples_per_pass=500000 -preprocessor_ray_cast_method=0 \80 # -preprocessor_stats=$PREFIX-i-global-b1.log \81 # -preprocessor_histogram_file=$PREFIX-i-global-b1.hlog82 61
Note: See TracChangeset
for help on using the changeset viewer.