Changeset 2586 for GTP/trunk/Lib/Vis/Preprocessing
- Timestamp:
- 01/09/08 18:46:51 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/demo1.env
r2529 r2586 41 41 # totalSamples 2000000 42 42 samplesPerPass 500000 43 samplesPerEvaluation 5000000 43 # samplesPerEvaluation 5000000 44 samplesPerEvaluation 1000000 44 45 45 46 -
GTP/trunk/Lib/Vis/Preprocessing/scripts/run_demo_arena
r2572 r2586 8 8 VIEWCELLS=../data/Arena/arena-high-lods-57000-viewcells.xml.gz 9 9 10 #-rss_distributions=mutation+object_direction+spatial \ 11 #-preprocessor_stats=$PREFIX-i-mixed-b1-n4a.log \ 12 10 13 PREFIX=../work/plots/osp-TEST 11 14 12 15 $COMMAND -preprocessor=combined -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 13 -rss_distributions= mutation+object_direction+spatial \16 -rss_distributions=spatial \ 14 17 -view_cells_use_kd_pvs+ -af_use_kd_pvs+ \ 15 18 -preprocessor_visibility_file=$PREFIX-i-mixed-b1-n4a.xml \ 16 19 -preprocessor_ray_cast_method=1 \ 17 -preprocessor_stats=$PREFIX-i- mixed-b1-n4a.log \20 -preprocessor_stats=$PREFIX-i-spatial-b1-n4a.log \ 18 21 -preprocessor_histogram_file=$PREFIX-i-mixed-b1-n4a.hlog \ 19 22 demo1.env -
GTP/trunk/Lib/Vis/Preprocessing/src/CombinedPreprocessor.cpp
r2580 r2586 90 90 91 91 cerr<<"Casting rays..."<<endl; 92 // bool doubleRays = true;92 93 93 bool doubleRays = true; 94 94 CastRays(rays, vssRays, doubleRays, pruneInvalidRays); 95 95 mTotalRaysCast += (int)vssRays.size(); 96 96 97 cerr<<"Done..."<<endl; 97 98 -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r2582 r2586 211 211 const float importance = log10(1e3*ray->mWeightedPvsContribution)/3.0f; 212 212 213 glColor3f(1.0f, 0.0f, 0.0f);214 //glColor3f(importance, importance, importance);213 //glColor3f(1.0f, 0.0f, 0.0f); 214 glColor3f(importance, importance, importance); 215 215 glVertex3fv(&ray->mOrigin.x); 216 216 glVertex3fv(&ray->mTermination.x); -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2583 r2586 1230 1230 { 1231 1231 1232 mRayCaster->SortRays(rays);1233 cout<<"Rays sorted in "<<TimeDiff(t1, GetTime())<<" ms."<<endl;1232 //mRayCaster->SortRays(rays); 1233 // cout<<"Rays sorted in "<<TimeDiff(t1, GetTime())<<" ms."<<endl; 1234 1234 } 1235 1235 -
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp
r2582 r2586 75 75 ++ samples; 76 76 rays.push_back(ray); 77 //cout << "d " << ray.mDirection << " "; 77 78 } 78 79 } … … 228 229 229 230 direction = mPreprocessor.sceneBox.GetRandomPoint(Vector3(r[3], 230 r[4], 231 r[5]) 232 ) - origin; 231 r[4], 232 r[5])) - origin; 233 233 234 234 const float c = Magnitude(direction); 235 235 236 236 if (c <= Limits::Small) 237 237 return false; … … 242 242 ray = SimpleRay(origin, direction, SPATIAL_BOX_BASED_DISTRIBUTION, pdf); 243 243 244 //cout << "d " << direction << " o: " << origin; 245 244 246 return true; 245 247 } … … 576 578 } 577 579 578 for(; it != vssRays.end(); ++it) { 580 for(; it != vssRays.end(); ++it) 581 { 579 582 VssRay *ray = *it; 580 for (i=0; i < mDistributions.size()-1; i++) { 583 584 //cout << " here4 " << ray->GetDir(); 585 586 for (i=0; i < mDistributions.size()-1; i++) 587 { 581 588 if (mDistributions[i]->mType == ray->mDistribution) 582 589 break; -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r2583 r2586 37 37 38 38 39 #define MYSTATS 1 40 39 41 40 42 namespace GtpVisibilityPreprocessor { … … 113 115 mViewCellsTree->SetViewCellsManager(this); 114 116 mSamplesStat.Reset(); 115 mStats.open("mystats.log");117 //mStats.open("mystats.log"); 116 118 } 117 119 … … 146 148 PrintPvsStatistics(mStats); 147 149 148 mStats <<150 /*mStats << 149 151 "#Pass\n" << pass ++ <<endl<< 150 152 "#Time\n" << time <<endl<< 151 153 "#TotalSamples\n" << totalRays << endl; 152 154 */ 153 155 154 156 totalRays += samplesPerPass; … … 204 206 else 205 207 { 206 //mStrategies.push_back(SamplingStrategy::REVERSE_VIEWSPACE_BORDER_BASED_DISTRIBUTION);207 208 208 mStrategies.push_back(SamplingStrategy::OBJECT_BASED_DISTRIBUTION); 209 209 mStrategies.push_back(SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION); 210 210 211 211 mStrategies.push_back(SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION); 212 //mStrategies.push_back(SamplingStrategy::REVERSE_VIEWSPACE_BORDER_BASED_DISTRIBUTION); 212 213 } 213 214 … … 2554 2555 s<<"#RATIO\n"<<pvsStat.renderCost / (pvsStat.mem + Limits::Small)<<endl; 2555 2556 s<<"#CONTRIBUTING_RAYS\n"<<mSamplesStat.mContributingRays<<endl; 2556 2557 2557 2558 if (mSamplesStat.mRays) { 2558 2559 s<<"#AVG_VIEWCELLS_PER_RAY\n"<<mSamplesStat.mViewCells/(float)mSamplesStat.mRays<<endl; 2560 s<<"#AVG_RAY_LENGTHS\n"<<mSamplesStat.mRayLengths << endl; 2561 2559 2562 } else { 2560 2563 s<<"#AVG_VIEWCELLS_PER_RAY\n 1 \n"; 2564 s<<"#AVG_RAY_LENGTHS\n 1 \n"; 2561 2565 } 2562 2566 mSamplesStat.Reset(); … … 2718 2722 2719 2723 2720 voidViewCellsManager::ComputeViewCellContribution(ViewCell *viewCell,2724 bool ViewCellsManager::ComputeViewCellContribution(ViewCell *viewCell, 2721 2725 VssRay &ray, 2722 2726 Intersectable *obj, … … 2728 2732 #if 0 2729 2733 if (!obj || !viewCell->GetValid()) 2730 return ;2734 return false; 2731 2735 #endif 2732 2736 2737 bool hasContri = false; 2733 2738 // if ray not outside of view space 2734 2739 float relContribution = 0.0f; … … 2741 2746 hasAbsContribution = viewCell->GetPvs().AddSampleDirtyCheck(obj, ray.mPdf); 2742 2747 //hasAbsContribution = viewCell->GetPvs().AddSample(obj,ray.mPdf); 2743 #if 1 2748 #if MYSTATS 2749 2744 2750 if (hasAbsContribution) 2745 2751 { 2746 2752 UpdateStatsForViewCell(viewCell, obj); 2747 mVizBuffer.AddRay(&ray);2753 hasContri = true; 2748 2754 } 2749 2755 #endif … … 2755 2761 viewCell->GetPvs().GetSampleContribution(obj, ray.mPdf, relContribution); 2756 2762 } 2763 2764 //cout << "here6: " << ray.GetDir() << " "; 2757 2765 2758 2766 // $$ clear the relative contribution as it is currently not correct anyway … … 2787 2795 ray.mRelativePvsContribution = relContribution; 2788 2796 #endif 2797 2798 return hasContri; 2789 2799 } 2790 2800 … … 2832 2842 2833 2843 terminationObj = ray.mTerminationObject; 2834 2844 //cout << "rayd: " << ray.GetDir() << " "; 2835 2845 ComputeViewCellContribution(currentViewCell, 2836 2846 ray, … … 2864 2874 ++ mSamplesStat.mRays; 2865 2875 2876 #if MYSTATS 2877 mSamplesStat.mRayLengths += ray.Length(); 2878 #endif 2866 2879 if (!ray.mTerminationObject) 2867 2880 return 0.0f; … … 2907 2920 viewCellCastTimer.Exit(); 2908 2921 #endif 2922 2909 2923 mSamplesStat.mViewCells += (int)viewCells.size(); 2910 2924 … … 2936 2950 #endif 2937 2951 2952 bool contri = false; 2938 2953 ViewCellContainer::const_iterator it = viewCells.begin(); 2939 2954 //cout << "rayd: " << ray.GetDir() << " "; 2940 2955 for (; it != viewCells.end(); ++ it) 2941 2956 { 2942 ComputeViewCellContribution(*it,2957 if (ComputeViewCellContribution(*it, 2943 2958 ray, 2944 2959 terminationObj, 2945 2960 ray.mTermination, 2946 addRays); 2961 addRays)) 2962 { 2963 contri = true; 2964 } 2965 2947 2966 (*it)->IncNumPiercingRays(); 2948 } 2949 2967 2968 } 2969 2970 #if MYSTATS 2971 if (contri) 2972 { 2973 if (rand() < (RAND_MAX / 10)) 2974 cout << "rayd: " /*<< ray.GetOrigin() << " " << ray.GetTermination() << " "*/ << Normalize(ray.GetDir()) << " " << endl; 2975 mVizBuffer.AddRay(&ray); 2976 } 2977 #endif 2950 2978 #ifdef PERFTIMER 2951 2979 pvsTimer.Exit(); -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r2575 r2586 127 127 int mContributingRays; 128 128 int mPvsContributions; 129 float mRayLengths; 130 129 131 void Reset() 130 132 { 133 mRayLengths = 0.0f; 131 134 mRays = 0; 132 135 mViewCells = 0; … … 654 657 protected: 655 658 656 voidComputeViewCellContribution(ViewCell *viewCell,659 bool ComputeViewCellContribution(ViewCell *viewCell, 657 660 VssRay &ray, 658 661 Intersectable *obj,
Note: See TracChangeset
for help on using the changeset viewer.