Changeset 736


Ignore:
Timestamp:
04/08/06 23:35:12 (18 years ago)
Author:
mattausch
Message:

completed histogram

Location:
GTP/trunk/Lib/Vis
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp

    r726 r736  
    332332                InitVisibilityCulling(mCameraInProgress); 
    333333 
    334                 std::stringstream d; d << "here34\n"; 
    335                 LogManager::getSingleton().logMessage(d.str()); 
    336  
     334         
    337335                /**  
    338336                * the hierarchical culling algorithm 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreSolidBoundingBox.cpp

    r722 r736  
    158158Real SolidBoundingBox::getSquaredViewDepth(const Camera* cam) const 
    159159{ 
    160         Ogre::LogManager::getSingleton().logMessage("here3"); 
    161160        const Vector3 &min = mBox.getMinimum(); 
    162161        const Vector3 &max = mBox.getMaximum(); 
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/default.env

    r728 r736  
    378378        useRandomAxis false 
    379379        usePolygonSplitIfAvailable false 
    380         useBreathFirstSplits false 
     380        nodePriorityQueueType 0 
    381381 
    382382        Visualization { 
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/egsr_test_script

    r711 r736  
    117117-vsp_bsp_use_cost_heuristics=false \ 
    118118-vsp_bsp_max_poly_candidates=0 \ 
    119 -vsp_bsp_breath_first_splits=true \ 
     119-vsp_bsp_node_queue_type=0 \ 
    120120-vsp_bsp_term_min_pvs=50 \ 
    121121-view_cells_construction_samples=0 \ 
     
    153153-vsp_bsp_max_poly_candidates=0 \ 
    154154-vsp_bsp_use_split_cost_queue=false \ 
    155 -vsp_bsp_breath_first_splits=true \ 
     155-vsp_bsp_node_queue_type=0 \ 
    156156-view_cells_filename=$LOG_PREFIX-$METHOD-viewCells.x3d 
    157157 
     
    181181-vsp_bsp_use_cost_heuristics=false \ 
    182182-vsp_bsp_max_poly_candidates=0 \ 
    183 -vsp_bsp_breath_first_splits=true \ 
     183-vsp_bsp_node_queue_type=0 \ 
    184184-view_cells_construction_samples=0 \ 
    185185-vsp_bsp_simulate_octree=true \ 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp

    r735 r736  
    12341234                                        "5"); 
    12351235 
    1236  
    12371236        RegisterOption("ViewCells.renderCostEvaluationType", 
    12381237                                        optString, 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp

    r734 r736  
    401401 
    402402 
    403 int ViewCellsTree::GetSize(ViewCell *vc) const 
     403int ViewCellsTree::GetNumInitialViewCells(ViewCell *vc) const 
    404404{ 
    405405        int vcSize = 0; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h

    r734 r736  
    270270        ViewCellLeaf<T>(): mLeaf(NULL) { SetActive(); } 
    271271        ViewCellLeaf<T>(Mesh *mesh): 
    272                 ViewCell(mesh), mLeaf(NULL) { SetActive(); } 
    273  
     272        ViewCell(mesh), mLeaf(NULL) { SetActive(); } 
    274273         
    275274 
     
    299298        /** Returns number of leaves this view cell consists of. 
    300299        */ 
    301         int GetSize(ViewCell *vc) const; 
     300        int GetNumInitialViewCells(ViewCell *vc) const; 
    302301 
    303302        /** Collects leaves corresponding to a view cell. 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r735 r736  
    552552        maxRenderCost = viewCells.back()->GetRenderCost(); 
    553553 
     554        Debug << "histogram minrc: " << minRenderCost << " maxrc: " << maxRenderCost << endl; 
     555 
    554556        const int intervals = min(10000, (int)viewCells.size()); 
    555557 
     
    561563        const float totalRenderCost = mViewCellsTree->GetRoot()->GetRenderCost(); 
    562564        const float totalVol = GetViewSpaceBox().GetVolume(); 
    563  
    564         float vol = 0; 
    565         int smallerCost = 0; 
     565        //const float totalVol = mViewCellsTree->GetRoot()->GetVolume(); 
     566 
     567        //float vol = 0; 
     568        //int smallerCost = 0; 
     569        int j = 0; 
    566570        int i = 0; 
    567         int j = 0; 
    568  
    569571         
    570572        ViewCellContainer::const_iterator it = viewCells.begin(), it_end = viewCells.end();              
     
    574576    while (1) 
    575577        { 
     578                float vol = 0; 
     579                int smallerCost = 0; 
     580 
    576581                while ((i < (int)viewCells.size()) && (viewCells[i]->GetRenderCost() < currentRenderCost)) 
    577582                { 
     
    580585                        ++ smallerCost; 
    581586                } 
    582  
    583                 if ((i >= (int)viewCells.size()) || (currentRenderCost >= maxRenderCost)) 
     587                 
     588                if (i < (int)viewCells.size()) 
     589                        Debug << "new rc increase: " << viewCells[i]->GetRenderCost() / totalVol << " " << currentRenderCost / totalVol << endl; 
     590 
     591                if ((smallerCost >= (int)viewCells.size()) || (currentRenderCost >= maxRenderCost)) 
    584592                        break; 
    585  
     593                 
    586594                float rcRatio = currentRenderCost / maxRenderCost; 
    587595                float volRatio = vol / totalVol; 
    588596 
    589                 outstream << "#Pass\n" << j ++ << endl; 
    590                 outstream << "#RenderCost\n" << rcRatio << endl; 
    591                 //fprintf(outstream, "#RenderCost\n%3.3f", rcRatio); 
    592                 outstream << "#ViewCells\n" << i << endl;                
     597                outstream << "#Pass\n" << j << endl; 
     598                outstream << "#RenderCostRatio\n" << rcRatio << endl; 
     599                outstream << "#WeightedCost\n" << currentRenderCost / totalVol << endl; 
     600                outstream << "#ViewCells\n" << smallerCost << endl;              
    593601                outstream << "#Volume\n" << volRatio << endl << endl; 
    594602 
    595603                // increase current render cost 
    596604                currentRenderCost += stepSize; 
     605                ++ j; 
    597606        } 
    598607 
     
    617626        minPvsSize = viewCells.front()->GetPvs().GetSize(); 
    618627        maxPvsSize = viewCells.back()->GetPvs().GetSize(); 
     628         
     629        Debug << "histogram minpvssize: " << minPvsSize << " maxpvssize: " << maxPvsSize << endl; 
    619630 
    620631        const int intervals = min(10000, (int)viewCells.size()); 
     
    629640        int currentPvsSize = minPvsSize;//(int)ceil(minRenderCost); 
    630641 
    631         float vol = 0; 
    632         int smallerCost = 0; 
    633  
     642        //float vol = 0; 
    634643        int i = 0; 
    635644        int j = 0; 
    636645 
    637          
    638646        ViewCellContainer::const_iterator it = viewCells.begin(), it_end = viewCells.end();              
    639647         
    640         // note can skip computations for view cells already evaluated and delete them from vector ... 
    641     while (1) 
    642         { 
     648        while (1) 
     649        { 
     650                float vol = 0; 
     651                int smaller = 0; 
     652 
    643653                while ((i < (int)viewCells.size()) && (viewCells[i]->GetPvs().GetSize() < currentPvsSize)) 
    644654                { 
    645655                        vol += viewCells[i]->GetVolume(); 
    646656                        ++ i; 
    647                         ++ smallerCost; 
    648                 } 
     657                        ++ smaller; 
     658                } 
     659                 
     660                if (i < (int)viewCells.size()) 
     661                        Debug << "new pvs size increase: " << viewCells[i]->GetPvs().GetSize() << " " << currentPvsSize << endl; 
    649662 
    650663                if ((i >= (int)viewCells.size()) || (currentPvsSize >= maxPvsSize)) 
     
    655668                outstream << "#Pass\n" << j ++ << endl; 
    656669                outstream << "#Pvs\n" << currentPvsSize << endl; 
    657                 //fprintf(outstream, "#RenderCost\n%3.3f", rcRatio); 
    658                 outstream << "#ViewCells\n" << i << endl;                
     670                outstream << "#ViewCells\n" << smaller << endl;          
    659671                outstream << "#Volume\n" << volRatio << endl << endl; 
    660672 
     
    756768        environment->GetIntValue("ViewCells.Evaluation.histoPasses", histoPasses); 
    757769 
     770        int numLeaves = mViewCellsTree->GetNumInitialViewCells(mViewCellsTree->GetRoot()); 
     771 
     772        Debug << "number of leaves: " << numLeaves << endl; 
     773        cout << "number of leaves: " << numLeaves << endl; 
     774 
    758775        if (useHisto) 
    759776        { 
     
    763780                for (int passes = 1; passes <= histoPasses; ++ passes) 
    764781                { 
    765                         int n = (int)mViewCells.size() * passes / histoPasses; 
     782                        int n = numLeaves * passes / histoPasses; 
    766783                 
    767784                        cout << "computing histogram for " << n << " view cells" << endl; 
     
    22922309        case 2: // merges 
    22932310                { 
    2294             int lSize = mViewCellsTree->GetSize(vc); 
     2311            int lSize = mViewCellsTree->GetNumInitialViewCells(vc); 
    22952312                        importance = (float)lSize / (float)mCurrentViewCellsStats.maxLeaves; 
    22962313                } 
     
    32183235        case 2: // merged leaves 
    32193236                { 
    3220                 int lSize = mViewCellsTree->GetSize(vc); 
     3237                int lSize = mViewCellsTree->GetNumInitialViewCells(vc); 
    32213238                        importance = (float)lSize / 
    32223239                                (float)mCurrentViewCellsStats.maxLeaves; 
     
    41464163        case 2: // merges 
    41474164                { 
    4148             int lSize = mViewCellsTree->GetSize(vc); 
     4165            int lSize = mViewCellsTree->GetNumInitialViewCells(vc); 
    41494166                        importance = (float)lSize / (float)mCurrentViewCellsStats.maxLeaves; 
    41504167                } 
  • GTP/trunk/Lib/Vis/shared/EvalStats/EvalStats.cpp

    r733 r736  
    110110} 
    111111 
     112 
    112113void EvalNumViewCells(ofstream &outstream, 
    113114                                          const StatsContainer &firstStats,  
    114                                           const StatsContainer &currentStats, 
    115                                           vector<float> &ratios) 
     115                                          const StatsContainer &currentStats) 
     116                //                        vector<float> &ratios) 
    116117{ 
    117118        //const int n = min((int)firstStats.size(), (int)currentStats.size()); 
     
    126127        // compare render cost of current view cell with render cost  
    127128        // of other view cells. 
    128         for (it = currentStats.begin(); it != it_end; ++ it) 
     129        for (it = currentStats.begin(); it != it_end; ++ it, ++ i) 
    129130        { 
    130131                int j = 0; 
     
    141142                float ratio = (float)i / (float)j; 
    142143 
    143                 outstream << "#RenderCost " << renderCost << endl; 
    144                 outstream << "#ViewCellsRatio " << ratio << endl; 
    145  
     144                outstream << "#Pass\n" << i << endl; 
     145                outstream << "#RenderCost\n" << renderCost << endl; 
     146                outstream << "#ViewCellsRatio\n" << ratio << endl << endl;       
     147 
     148                //cout << "#Pass " << i ++ << endl; 
     149                //cout << "#RenderCost " << renderCost << endl; 
     150                //cout << "#ViewCellsRatio " << ratio << endl;   
    146151        } 
    147152} 
     
    159164 
    160165        vector<string> outFilenames; 
     166        vector<string> outFilenames2; 
    161167 
    162168        // read input files from command line 
     
    182188                        //sscanf(argv[i], "%s.log", fn); 
    183189                        string outFilename = string(fn) + string("-ratio.log"); 
     190                        string outFilename2 = string(fn) + string("-reverse.log"); 
    184191 
    185192                        outFilenames.push_back(outFilename); 
     193                        outFilenames2.push_back(outFilename2); 
     194                        cout << "new filen: " << outFilename2 << endl; 
    186195                } 
    187196                else 
     
    193202        //statsOut << "rc1 size: " << (int)renderCosts1.size() << " " << (int)renderCosts2.size() << endl << endl; 
    194203        vector<StatsContainer>::const_iterator it = renderStats.begin(), it_end = renderStats.end(); 
     204 
    195205        vector<string>::const_iterator sit, sit_end = outFilenames.end(); 
     206        vector<string>::const_iterator sit2, sit2_end = outFilenames2.end(); 
    196207 
    197208        sit = outFilenames.begin(); 
    198          
     209        sit2 = outFilenames2.begin(); 
     210 
    199211        // compare all values with this vector 
    200212        StatsContainer &firstStats = renderStats[0]; 
     
    204216        //++ sit; 
    205217 
    206         for (it; it != it_end; ++ it) 
     218        for (it; it != it_end; ++ it, ++ sit, ++ sit2) 
    207219        { 
    208220                cout << "now writing output to file " << *sit << endl; 
    209221                ofstream statsOut; 
    210222                statsOut.open((*sit).c_str()); 
    211  
     223                ofstream statsOut2; 
     224                statsOut2.open((*sit2).c_str()); 
     225 
     226                cout << "opening new file: " << (*sit2).c_str() << endl; 
    212227                // compute size of output vector 
    213228                const int n = min((int)firstStats.size(), (int)(*it).size()); 
     
    221236                cout << "need " << vc << " view cells to reach rendercost of method " << i << " with " << n << " view cells" << endl; 
    222237#endif 
     238                EvalNumViewCells(statsOut2, firstStats, (*it)); 
     239 
    223240                statsOut.close(); 
    224                  
    225                 ++ sit; 
     241                statsOut2.close(); 
    226242        } 
    227243 
Note: See TracChangeset for help on using the changeset viewer.