Ignore:
Timestamp:
12/05/05 13:47:58 (19 years ago)
Author:
mattausch
Message:

added viewcellsmanager to rsspreprocessor

Location:
trunk/VUT/GtpVisibilityPreprocessor/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/RssPreprocessor.cpp

    r450 r451  
    99#include "VssRay.h" 
    1010#include "RssTree.h" 
    11 #include "ViewCellBsp.h" 
     11#include "ViewCellsManager.h" 
    1212 
    1313static bool useViewSpaceBox = true;//true; 
     
    378378  int totalSamples = 0; 
    379379 
     380  /// Rays used for post processing and visualizations. 
     381  RayContainer storedRays; 
    380382 
    381383  AxisAlignedBox3 *box = new AxisAlignedBox3(mKdTree->GetBox()); 
     
    407409  RssTree *rssTree = NULL; 
    408410 
    409   RayContainer bspRays; 
    410  
    411411  while (totalSamples < mInitialSamples) { 
    412412        int passContributingSamples = 0; 
     
    423423          Vector3 direction = GetDirection(viewpoint, mViewSpaceBox); 
    424424                         
    425           sampleContributions = CastRay(viewpoint, direction, mVssRays); 
     425          CastRay(viewpoint, direction, mVssRays); 
    426426                         
    427427                         
     
    473473        ExportPvs("rss-pvs-initial.x3d", rssTree); 
    474474  } 
    475    
     475 
     476  // construct view cells 
     477  mViewCellsManager->Construct(mObjects, mVssRays, mViewSpaceBox); 
     478 
    476479  rssTree = new RssTree; 
    477480  // viewcells = Construct(mVssRays); 
     
    550553        } 
    551554 
     555        //-- prepare traversal rays for view cell intersections 
     556        RayContainer passRays; 
     557 
     558        VssRayContainer::const_iterator it, it_end = vssRays.end(); 
     559         
     560        for (it = vssRays.begin(); it != it_end; ++ it) 
     561                passRays.push_back(new Ray(*(*it))); 
     562         
     563        int sampleContributions = 0; 
     564        int contributingSamples = 0; 
     565 
     566        /// compute view cell contribution of rays 
     567        mViewCellsManager->ComputeSampleContributions(passRays, 
     568                                                                                                  sampleContributions,  
     569                                                                                                  contributingSamples); 
     570         
     571        //-- save rays for post processing 
     572        if (((int)storedRays.size() < mViewCellsManager->GetPostProcessSamples()) || 
     573                ((int)storedRays.size() < mViewCellsManager->GetVisualizationSamples())) 
     574        { 
     575                RayContainer::const_iterator it, it_end = passRays.end(); 
     576 
     577                for (it = passRays.begin(); it != it_end; ++ it) 
     578                        storedRays.push_back(new Ray(*(*it))); 
     579        } 
     580        else 
     581        { 
     582                CLEAR_CONTAINER(passRays); 
     583        } 
     584 
    552585        samples+=num; 
    553586        float pvs = rssTree->GetAvgPvsSize(); 
     
    575608} 
    576609 
    577 void 
    578 RssPreprocessor::CastRay(const BspTree &tree, const VssRay & vssRay) 
    579 { 
    580   //-- cast ray to BSP tree to get intersection with view cells 
    581   Ray ray(vssRay); 
    582   mBspTree->CastRay(ray); 
    583                                  
    584   //if (0 && ray.sourceObject.mObject) 
    585   //sampleContributions +=  
    586   //AddObjectSamples(ray.sourceObject.mObject, ray); 
    587                          
    588   if (!ray.intersections.empty()) // second intersection found 
    589   { 
    590           //sampleContributions +=  
    591           AddObjectSamples(ray.intersections[0].mObject, ray); 
    592   } 
    593 } 
    594  
    595 int 
    596 RssPreprocessor::AddObjectSamples(Intersectable *obj, const Ray &ray) 
    597 { 
    598   int contributingSamples = 0; 
    599   int j; 
    600   
    601   // object can be seen from the view cell => add to view cell pvs 
    602   for (j=0; j < ray.bspIntersections.size(); ++ j) 
    603         {        
    604           BspLeaf *leaf = ray.bspIntersections[j].mLeaf; 
    605           // if ray not in unbounded space 
    606 /*        if (leaf->GetViewCell() != &mUnbounded) 
    607                 contributingSamples +=  
    608                   leaf->GetViewCell()->GetPvs().AddSample(obj);*/ 
    609         } 
    610   
    611   // rays passing through this viewcell 
    612   if (mPass > 1) 
    613         for (j=1; j < ((int)ray.bspIntersections.size() - 1); ++ j)  
    614           { 
    615                 BspLeaf *leaf = ray.bspIntersections[j].mLeaf; 
    616                  
    617         /*      if (leaf->GetViewCell() != &mUnbounded) 
    618                   leaf->GetViewCell()-> 
    619                         AddPassingRay(ray, contributingSamples ? 1 : 0);*/ 
    620           } 
    621    
    622   return contributingSamples; 
    623 } 
  • trunk/VUT/GtpVisibilityPreprocessor/src/RssPreprocessor.h

    r450 r451  
    104104                        ); 
    105105 
    106   void 
    107   CastRay(const BspTree &tree, const VssRay & vssRay); 
    108  
    109   int 
    110   AddObjectSamples(Intersectable *obj, const Ray &ray); 
    111  
    112  
    113          
    114106}; 
    115107 
  • trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp

    r448 r451  
    361361                 
    362362                float avgRayContrib = (passContributingSamples > 0) ?  
    363                         passSampleContributions/(float)passContributingSamples : 0; 
     363                        passSampleContributions / (float)passContributingSamples : 0; 
    364364 
    365365                cout << "#Pass " << mPass << " : t = " << TimeDiff(startTime, GetTime())*1e-3 << "s" << endl; 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp

    r448 r451  
    489489  int pass = 0; 
    490490 
    491   /// Rays used for post processing and visualizations. 
     491  /// Rays used for post processing and visualizations 
    492492  RayContainer storedRays; 
    493493  // cast view cell samples 
  • trunk/VUT/GtpVisibilityPreprocessor/src/default.env

    r446 r451  
    144144 
    145145ViewCells { 
    146         #hierarchy kdTree 
    147         hierarchy vspTree 
    148         #hierarchy bspTree 
    149         # hierarchy sceneDependent 
     146        loadFromFile false 
     147        #type kdTree 
     148        type vspKdTree 
     149        #type bspTree 
     150        #type vspBspTree 
     151         
     152        #type sceneDependent 
    150153         
    151154        height 5.0 
     
    156159                minPvs 10 
    157160                maxPvs 150 
    158                 samples 100000 
    159         } 
    160  
     161                # how much samples are used for post processing 
     162                samples 10 
     163        } 
     164 
     165        Visualization { 
     166                # how much samples are be used for visualization 
     167                samples 90000 
     168        } 
    161169         
    162170#       filename ../data/atlanta/atlanta_viewcells_large.x3d 
     
    168176BspTree { 
    169177        Construction { 
    170                 input fromSamples 
    171         #       input fromViewCells 
    172         #       input fromSceneGeometry 
    173                 samples 150000 
    174                 sideTolerance 0.005 
     178                samples 50000 
     179                epsilon 0.005 
    175180        } 
    176181 
     
    209214        #splitPlaneStrategy 130 
    210215         
    211         splitPlaneStrategy 12 
    212          
    213         maxPolyCandidates 70 
    214         maxRayCandidates 100 
     216        splitPlaneStrategy 1024 
     217         
     218        maxPolyCandidates 50 
     219        maxRayCandidates 50 
     220         
     221        maxTests 10000 
    215222         
    216223        # factors for evaluating split plane costs 
     
    221228                leastRaySplits 1.0 
    222229                balancedRays 1.0 
    223                 pvsFactor 1.0 
     230                pvs 1.0 
    224231                leastSplits 1.0 
    225232                balancedPolys 1.0 
     
    232239                minPolygons -1 
    233240                maxDepth 40 
    234                 minPvs 35 
     241                minPvs 100 
    235242                minArea 0.01 
    236243                maxRayContribution 0.005 
     
    258265        # x3d visualization of the split planes 
    259266        exportSplits true 
    260                 # how much samples should be used in visualization 
    261                 samples 20000 
    262267        } 
    263268} 
     
    274279 
    275280        Construction { 
    276                 samples 500000 
    277         } 
    278          
    279         Termination { 
    280                 maxDepth        30 
    281                 minPvs          60 
     281                samples 100000 
     282        } 
     283         
     284        Termination { 
     285                maxDepth                40 
     286                minPvs                  50 
    282287                minRays         1 
    283288                minSize         0.1 
     
    286291        } 
    287292         
    288         maxTotalMemory  600 
    289         maxStaticMemory 600 
     293        maxTotalMemory  400 
     294        maxStaticMemory 200 
    290295 
    291296        splitType regular 
     
    293298        ct_div_ci       0.0 
    294299} 
     300 
     301VspBspTree { 
     302        Construction { 
     303                samples 100000 
     304                epsilon 0.005 
     305        } 
     306 
     307 
     308        # random polygon       = 1 
     309        # axis aligned         = 2 
     310        # least ray splits     = 256 
     311        # balanced rays        = 512 
     312        # pvs                  = 1024 
     313 
     314        splitPlaneStrategy 1024 
     315         
     316        # maximal candidates for split planes 
     317        maxPolyCandidates 50 
     318        maxRayCandidates 50 
     319         
     320        # maximal tested rays for split cost heuristics 
     321        maxTests 10000 
     322         
     323        # factors for evaluating split plane costs 
     324        Factor { 
     325                leastRaySplits 1.0 
     326                balancedRays 1.0 
     327                pvs 1.0 
     328        } 
     329         
     330        Termination { 
     331                # parameters used for autopartition 
     332                minRays 200 
     333                minPolygons -1 
     334                maxDepth 40 
     335                minPvs 100 
     336                minArea 0.01 
     337                maxRayContribution 0.005 
     338                #maxAccRayLength 100 
     339                 
     340                # used for pvs criterium 
     341                ct_div_ci 0.0 
     342         
     343                # axis aligned splits 
     344                AxisAligned { 
     345                        minPolys 5000 
     346                        minRays 500 
     347                        minObjects 10 
     348                        maxCostRatio 0.9 
     349                        ct_div_ci 0.5 
     350                } 
     351        } 
     352         
     353        AxisAligned { 
     354                splitBorder 0.01 
     355        } 
     356         
     357         
     358        Visualization { 
     359                # x3d visualization of the split planes 
     360                exportSplits true 
     361        } 
     362} 
Note: See TracChangeset for help on using the changeset viewer.