Changeset 2586


Ignore:
Timestamp:
01/09/08 18:46:51 (16 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/demo1.env

    r2529 r2586  
    4141#       totalSamples 2000000 
    4242        samplesPerPass 500000 
    43         samplesPerEvaluation 5000000 
     43#       samplesPerEvaluation 5000000 
     44        samplesPerEvaluation 1000000 
    4445 
    4546 
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/run_demo_arena

    r2572 r2586  
    88VIEWCELLS=../data/Arena/arena-high-lods-57000-viewcells.xml.gz 
    99 
     10#-rss_distributions=mutation+object_direction+spatial \ 
     11#-preprocessor_stats=$PREFIX-i-mixed-b1-n4a.log \ 
     12 
    1013PREFIX=../work/plots/osp-TEST 
    1114 
    1215$COMMAND -preprocessor=combined -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 
    13 -rss_distributions=mutation+object_direction+spatial \ 
     16-rss_distributions=spatial \ 
    1417-view_cells_use_kd_pvs+ -af_use_kd_pvs+ \ 
    1518-preprocessor_visibility_file=$PREFIX-i-mixed-b1-n4a.xml \ 
    1619-preprocessor_ray_cast_method=1 \ 
    17 -preprocessor_stats=$PREFIX-i-mixed-b1-n4a.log \ 
     20-preprocessor_stats=$PREFIX-i-spatial-b1-n4a.log \ 
    1821-preprocessor_histogram_file=$PREFIX-i-mixed-b1-n4a.hlog \ 
    1922demo1.env 
  • GTP/trunk/Lib/Vis/Preprocessing/src/CombinedPreprocessor.cpp

    r2580 r2586  
    9090 
    9191        cerr<<"Casting rays..."<<endl; 
    92         //      bool doubleRays = true; 
     92         
    9393        bool doubleRays = true; 
    9494        CastRays(rays, vssRays, doubleRays, pruneInvalidRays); 
    9595        mTotalRaysCast += (int)vssRays.size(); 
     96 
    9697        cerr<<"Done..."<<endl; 
    9798 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp

    r2582 r2586  
    211211                const float importance = log10(1e3*ray->mWeightedPvsContribution)/3.0f; 
    212212                 
    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); 
    215215                glVertex3fv(&ray->mOrigin.x); 
    216216                glVertex3fv(&ray->mTermination.x); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r2583 r2586  
    12301230        { 
    12311231 
    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; 
    12341234        } 
    12351235 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp

    r2582 r2586  
    7575                                ++ samples; 
    7676                                rays.push_back(ray); 
     77                                //cout << "d " << ray.mDirection << " "; 
    7778                        } 
    7879                } 
     
    228229 
    229230        direction = mPreprocessor.sceneBox.GetRandomPoint(Vector3(r[3], 
    230                                                                                                                                            r[4], 
    231                                                                                                                                            r[5]) 
    232                                                                                                                            ) - origin; 
     231                                                                                                          r[4], 
     232                                                                                                          r[5])) - origin; 
    233233         
    234234        const float c = Magnitude(direction); 
    235  
     235         
    236236        if (c <= Limits::Small)  
    237237                return false; 
     
    242242        ray = SimpleRay(origin, direction, SPATIAL_BOX_BASED_DISTRIBUTION, pdf); 
    243243   
     244        //cout << "d " << direction << " o: " << origin; 
     245         
    244246        return true; 
    245247} 
     
    576578        } 
    577579 
    578         for(; it != vssRays.end(); ++it) { 
     580        for(; it != vssRays.end(); ++it)  
     581        { 
    579582                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                { 
    581588                        if (mDistributions[i]->mType == ray->mDistribution) 
    582589                                break; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r2583 r2586  
    3737 
    3838 
     39#define MYSTATS 1 
     40 
    3941 
    4042namespace GtpVisibilityPreprocessor { 
     
    113115        mViewCellsTree->SetViewCellsManager(this); 
    114116        mSamplesStat.Reset(); 
    115         mStats.open("mystats.log"); 
     117        //mStats.open("mystats.log"); 
    116118} 
    117119 
     
    146148        PrintPvsStatistics(mStats); 
    147149         
    148         mStats << 
     150        /*mStats << 
    149151                "#Pass\n" << pass ++ <<endl<< 
    150152                "#Time\n" << time <<endl<< 
    151153                "#TotalSamples\n" << totalRays << endl; 
    152          
     154        */       
    153155 
    154156        totalRays += samplesPerPass; 
     
    204206        else 
    205207        { 
    206                 //mStrategies.push_back(SamplingStrategy::REVERSE_VIEWSPACE_BORDER_BASED_DISTRIBUTION); 
    207  
    208208                mStrategies.push_back(SamplingStrategy::OBJECT_BASED_DISTRIBUTION); 
    209209                mStrategies.push_back(SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION); 
    210210                         
    211211                mStrategies.push_back(SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION); 
     212                //mStrategies.push_back(SamplingStrategy::REVERSE_VIEWSPACE_BORDER_BASED_DISTRIBUTION); 
    212213        } 
    213214                 
     
    25542555  s<<"#RATIO\n"<<pvsStat.renderCost / (pvsStat.mem + Limits::Small)<<endl; 
    25552556  s<<"#CONTRIBUTING_RAYS\n"<<mSamplesStat.mContributingRays<<endl; 
    2556  
     2557   
    25572558  if (mSamplesStat.mRays) { 
    25582559        s<<"#AVG_VIEWCELLS_PER_RAY\n"<<mSamplesStat.mViewCells/(float)mSamplesStat.mRays<<endl; 
     2560    s<<"#AVG_RAY_LENGTHS\n"<<mSamplesStat.mRayLengths << endl; 
     2561 
    25592562  } else { 
    25602563        s<<"#AVG_VIEWCELLS_PER_RAY\n 1 \n"; 
     2564        s<<"#AVG_RAY_LENGTHS\n 1 \n"; 
    25612565  } 
    25622566  mSamplesStat.Reset(); 
     
    27182722 
    27192723 
    2720 void ViewCellsManager::ComputeViewCellContribution(ViewCell *viewCell, 
     2724bool ViewCellsManager::ComputeViewCellContribution(ViewCell *viewCell, 
    27212725                                                                                                   VssRay &ray,  
    27222726                                                                                                   Intersectable *obj, 
     
    27282732#if 0 
    27292733        if (!obj || !viewCell->GetValid()) 
    2730                 return; 
     2734                return false; 
    27312735#endif 
    27322736 
     2737        bool hasContri = false; 
    27332738        // if ray not outside of view space 
    27342739        float relContribution = 0.0f; 
     
    27412746                hasAbsContribution = viewCell->GetPvs().AddSampleDirtyCheck(obj, ray.mPdf); 
    27422747                //hasAbsContribution = viewCell->GetPvs().AddSample(obj,ray.mPdf); 
    2743 #if 1 
     2748#if MYSTATS 
     2749                 
    27442750                if (hasAbsContribution) 
    27452751                { 
    27462752                        UpdateStatsForViewCell(viewCell, obj); 
    2747                         mVizBuffer.AddRay(&ray); 
     2753                        hasContri = true; 
    27482754                } 
    27492755#endif 
     
    27552761                        viewCell->GetPvs().GetSampleContribution(obj, ray.mPdf, relContribution); 
    27562762        } 
     2763 
     2764        //cout << "here6: " << ray.GetDir() << " "; 
    27572765 
    27582766        // $$ clear the relative contribution as it is currently not correct anyway 
     
    27872795                ray.mRelativePvsContribution = relContribution; 
    27882796#endif 
     2797 
     2798        return hasContri; 
    27892799} 
    27902800 
     
    28322842 
    28332843        terminationObj = ray.mTerminationObject; 
    2834  
     2844        //cout << "rayd: " << ray.GetDir() << " "; 
    28352845        ComputeViewCellContribution(currentViewCell,  
    28362846                                                                ray,  
     
    28642874        ++ mSamplesStat.mRays; 
    28652875 
     2876#if MYSTATS 
     2877        mSamplesStat.mRayLengths += ray.Length(); 
     2878#endif 
    28662879        if (!ray.mTerminationObject) 
    28672880                return 0.0f; 
     
    29072920        viewCellCastTimer.Exit(); 
    29082921#endif 
     2922 
    29092923        mSamplesStat.mViewCells += (int)viewCells.size(); 
    29102924 
     
    29362950#endif 
    29372951         
     2952        bool contri = false; 
    29382953        ViewCellContainer::const_iterator it = viewCells.begin(); 
    2939  
     2954//cout << "rayd: " << ray.GetDir() << " "; 
    29402955        for (; it != viewCells.end(); ++ it)  
    29412956        { 
    2942                 ComputeViewCellContribution(*it,  
     2957                if (ComputeViewCellContribution(*it,  
    29432958                                                ray,  
    29442959                                                                        terminationObj,  
    29452960                                                                        ray.mTermination,  
    2946                                                                         addRays); 
     2961                                                                        addRays)) 
     2962                { 
     2963                        contri = true; 
     2964                }        
     2965 
    29472966                (*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 
    29502978#ifdef PERFTIMER   
    29512979        pvsTimer.Exit(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h

    r2575 r2586  
    127127                int mContributingRays; 
    128128                int mPvsContributions; 
     129                float mRayLengths; 
     130 
    129131                void Reset()  
    130132                { 
     133                        mRayLengths = 0.0f; 
    131134                        mRays = 0; 
    132135                        mViewCells = 0; 
     
    654657protected: 
    655658 
    656         void ComputeViewCellContribution(ViewCell *viewCell, 
     659        bool ComputeViewCellContribution(ViewCell *viewCell, 
    657660                                                                         VssRay &ray,  
    658661                                                                         Intersectable *obj, 
Note: See TracChangeset for help on using the changeset viewer.