Changeset 501


Ignore:
Timestamp:
01/05/06 10:56:50 (18 years ago)
Author:
mattausch
Message:
 
Location:
trunk/VUT/GtpVisibilityPreprocessor
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env

    r498 r501  
    1313#;../data/vienna/vienna-plane.x3d 
    1414#       filename ../data/vienna/viewcells-25-sel.x3d 
    15         filename ../data/atlanta/atlanta2.x3d 
     15#       filename ../data/atlanta/atlanta2.x3d 
    1616#       filename ../data/soda/soda.dat 
    17 #       filename ../data/soda/soda5.dat 
     17        filename ../data/soda/soda5.dat 
    1818} 
    1919 
     
    3535        loadInitialSamples  false 
    3636        storeInitialSamples false 
     37        useViewSpaceBox true 
    3738} 
    3839 
     
    195196                colorCode Random 
    196197                exportRays false 
    197                 exportGeometry false 
     198                exportGeometry true 
    198199        } 
    199200         
     
    222223        Termination { 
    223224                maxDepth                40 
    224                 minPvs                  50 
    225                 minRays                 300 
    226                 minSize                 0.001 
    227                 maxCostRatio            0.9 
     225                minPvs                  1 
     226                minRays                 100 
     227                minSize                 0.0001 
     228                maxCostRatio            0.95 
    228229                missTolerance           4 
    229230                maxRayContribution      0.5 
     
    231232         
    232233        maxTotalMemory  100 
    233         maxStaticMemory 50 
     234        maxStaticMemory 80 
    234235 
    235236        splitType       regular 
     
    285286                minPolygons             -1 
    286287                maxDepth                30 
    287                 minPvs                  20 
     288                minPvs                  2 
    288289                #minArea                0.0001 
    289290                minArea                 0.000 
     
    293294                #maxAccRayLength        100 
    294295                 
    295                 maxViewCells            20000 
     296                maxViewCells            8000 
    296297                 
    297298                # used for pvs criterium 
     
    308309        PostProcess { 
    309310                maxCostRatio 0.1 
    310                 minViewCells 500 
     311                minViewCells 200 
    311312                maxPvsSize   1000 
    312313                useRaysForMerge false 
  • trunk/VUT/GtpVisibilityPreprocessor/src/Environment.cpp

    r492 r501  
    11881188    
    11891189 
     1190    RegisterOption("VssPreprocessor.useViewSpaceBox", 
     1191          optBool, 
     1192          "-vss_use_viewspace_box=", 
     1193          "true"); 
     1194    
     1195 
    11901196  /************************************************************************************/ 
    11911197  /*                         View cells related options                               */ 
  • trunk/VUT/GtpVisibilityPreprocessor/src/MutualVisibility.h

    r359 r501  
    8787  bool mUseBoxes; 
    8888 
    89   MutualVisibilitySampler(SceneGraph *sceneGraph, 
    90                                                                                                         KdTree *kdTree, 
    91                                                                                                         const AxisAlignedBox3 &source, 
    92                                                                                                         const AxisAlignedBox3 &target, 
    93                                                                                                         const float solidAngleThreshold); 
     89  MutualVisibilitySampler( 
     90                                                  SceneGraph *sceneGraph, 
     91                                                  KdTree *kdTree, 
     92                                                  const AxisAlignedBox3 &source, 
     93                                                  const AxisAlignedBox3 &target, 
     94                                                  const float solidAngleThreshold 
     95                                                  ); 
    9496  int 
    9597  ComputeVisibility(); 
    9698 
    9799  void 
    98   ConstructInitialSamples( 
    99                                                                                                         const AxisAlignedBox3 &source, 
    100                                                                                                         const AxisAlignedBox3 &target, 
    101                                                                                                         vector<RayShaft *> &samples 
    102                                                                                                         ); 
     100  ConstructInitialSamples(const AxisAlignedBox3 &source, 
     101                                                  const AxisAlignedBox3 &target, 
     102                                                  vector<RayShaft *> &samples 
     103                                                  ); 
    103104         
    104105  void 
    105106  ConstructInitialSamples2( 
    106                                                                                                         const AxisAlignedBox3 &source, 
    107                                                                                                         const AxisAlignedBox3 &target, 
    108                                                                                                         vector<RayShaft *> &samples 
    109                                                                                                         ); 
     107                                                  const AxisAlignedBox3 &source, 
     108                                                  const AxisAlignedBox3 &target, 
     109                                                  vector<RayShaft *> &samples 
     110                                                  ); 
    110111         
    111112  void 
    112113  ConstructInitialSamples3( 
    113                                                                                                         const AxisAlignedBox3 &source, 
    114                                                                                                         const AxisAlignedBox3 &target, 
    115                                                                                                         vector<RayShaft *> &samples 
    116                                                                                                         ); 
     114                                                  const AxisAlignedBox3 &source, 
     115                                                  const AxisAlignedBox3 &target, 
     116                                                  vector<RayShaft *> &samples 
     117                                                  ); 
    117118         
    118119  void 
    119120  AddInitialSamples( 
    120                                                                                 const Rectangle3 &sourceRect, 
    121                                                                                 const Rectangle3 &targetRect, 
    122                                                                                 vector<RayShaft *> &samples 
    123                                                                                 ); 
     121                                        const Rectangle3 &sourceRect, 
     122                                        const Rectangle3 &targetRect, 
     123                                        vector<RayShaft *> &samples 
     124                                        ); 
    124125         
    125126  void 
    126127  AddInitialSamples2( 
    127                                                                                 const Rectangle3 &sourceRect, 
    128                                                                                 const Rectangle3 &targetRect, 
    129                                                                                 vector<RayShaft *> &samples 
    130                                                                                 ); 
     128                                        const Rectangle3 &sourceRect, 
     129                                        const Rectangle3 &targetRect, 
     130                                        vector<RayShaft *> &samples 
     131                                        ); 
    131132         
    132133  // the split sample method contains a methodology to create new samples 
     
    134135  bool 
    135136  SplitSample( 
    136                                                         const RayShaft &source, 
    137                                                         RayShaft &sample1, 
    138                                                         RayShaft &sample2 
    139                                                         ); 
     137                        const RayShaft &source, 
     138                        RayShaft &sample1, 
     139                        RayShaft &sample2 
     140                        ); 
    140141  void 
    141142  PerformSplit( 
    142                                                          const RayShaft &sample, 
    143                                                          const bool splitSource, 
    144                                                          const int axis, 
    145                                                          RayShaft &sample1, 
    146                                                          RayShaft &sample2 
    147                                                         ); 
     143                                const RayShaft &sample, 
     144                                const bool splitSource, 
     145                                const int axis, 
     146                                RayShaft &sample1, 
     147                                RayShaft &sample2 
     148                                ); 
    148149   
    149150         
    150151  bool 
    151152  SampleTerminationCriteriaMet( 
    152                                                                                                                         const RayShaft &sample); 
     153                                                                const RayShaft &sample); 
    153154   
    154155  float 
    155156  GetSpatialAngle(const RayShaft &sample, 
    156                                                                         const Vector3 &point 
    157                                                                         ); 
     157                                  const Vector3 &point 
     158                                 ); 
    158159         
    159160  int 
  • trunk/VUT/GtpVisibilityPreprocessor/src/RssPreprocessor.cpp

    r496 r501  
    1313#include "GlRenderer.h" 
    1414 
    15 static bool useViewSpaceBox = false; 
     15static bool useViewSpaceBox = true; 
    1616static bool use2dSampling = false; 
    1717static bool fromBoxVisibility = false; 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp

    r498 r501  
    9595        return mSceneBox.IsInside(viewPoint); 
    9696} 
     97 
    9798 
    9899void ViewCellsManager::ComputeSampleContributions(const VssRayContainer &rays) 
     
    17651766        cout << "collapsing invalid tree regions ... "; 
    17661767        long startTime = GetTime(); 
    1767         mVspBspTree->CollapseTree();  
    1768         Debug << "tree collapsed in " << TimeDiff(startTime, GetTime()) * 1e-3 << " seconds" << endl; 
     1768        int collapsedLeaves = mVspBspTree->CollapseTree();  
     1769        Debug << "collapsed in " << TimeDiff(startTime, GetTime()) * 1e-3 << " seconds" << endl; 
    17691770    cout << "finished" << endl; 
    17701771         
  • trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp

    r500 r501  
    21112111} 
    21122112 
    2113 BspNode *VspBspTree::CollapseTree(BspNode *node) 
     2113BspNode *VspBspTree::CollapseTree(BspNode *node, int &collapsed) 
    21142114{ 
    21152115        if (node->IsLeaf()) 
     
    21182118        BspInterior *interior = dynamic_cast<BspInterior *>(node); 
    21192119 
    2120         BspNode *front = CollapseTree(interior->GetFront()); 
    2121         BspNode *back = CollapseTree(interior->GetBack()); 
     2120        BspNode *front = CollapseTree(interior->GetFront(), collapsed); 
     2121        BspNode *back = CollapseTree(interior->GetBack(), collapsed); 
    21222122 
    21232123        if (front->IsLeaf() && back->IsLeaf()) 
     
    21372137                        if (leaf->GetParent()) 
    21382138                                leaf->GetParent()->ReplaceChildLink(node, leaf); 
    2139  
     2139                                                 
     2140                        ++ collapsed; 
    21402141                        delete interior; 
    21412142 
     
    21482149 
    21492150 
    2150 void VspBspTree::CollapseTree() 
    2151 { 
    2152         CollapseTree(mRoot); 
     2151int VspBspTree::CollapseTree() 
     2152{ 
     2153        int collapsed = 0; 
     2154        (void)CollapseTree(mRoot, collapsed); 
    21532155        // revalidate leaves 
    21542156        RepairVcLeafLists(); 
     2157 
     2158        return collapsed; 
    21552159} 
    21562160 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.h

    r497 r501  
    258258 
    259259        /** Collapses the tree with respect to the view cell partition. 
    260         */ 
    261         void CollapseTree(); 
    262  
    263   ViewCell * 
    264   GetViewCell(const Vector3 &point); 
     260                @returns number of collapsed nodes 
     261        */ 
     262        int CollapseTree(); 
     263 
     264        /** Returns view cell the current point is located in. 
     265        */ 
     266        ViewCell *GetViewCell(const Vector3 &point); 
    265267 
    266268        /** Constructs bsp rays for post processing and visualization. 
     
    314316        /** Collapses the tree with respect to the view cell partition, 
    315317                i.e. leaves having the same view cell are collapsed. 
     318                @param node the root of the subtree to be collapsed 
     319                @param collapsed returns the number of collapsed nodes 
    316320                @returns node of type leaf if the node could be collapsed,  
    317321                this node otherwise 
    318322        */ 
    319         BspNode *CollapseTree(BspNode *node); 
     323        BspNode *CollapseTree(BspNode *node, int &collapsed); 
    320324        /** Shuffles the leaves, i.e., tests if exchanging 
    321325                the leaves helps in improving the view cells. 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.cpp

    r500 r501  
    951951        pvsFront = nPvsFront[bestAxis]; 
    952952 
    953         if (bestAxis == 1) 
    954                 Debug << "y axis!" << endl; 
    955953        return nCostRatio[bestAxis]; 
    956954} 
     
    12111209                parent->ReplaceChildLink(leaf, node); 
    12121210        } 
     1211 
    12131212        // and setup child links 
    12141213        node->SetupChildLinks(back, front); 
     
    23982397 
    23992398 
    2400 VspKdNode *VspKdTree::CollapseTree(VspKdNode *node) 
    2401 { 
    2402     if (node->IsLeaf()) 
     2399VspKdNode *VspKdTree::CollapseTree(VspKdNode *node, int &collapsed) 
     2400{ 
     2401        if (node->IsLeaf()) 
    24032402                return node; 
    24042403 
    24052404        VspKdInterior *interior = dynamic_cast<VspKdInterior *>(node); 
    24062405 
    2407         VspKdNode *front = CollapseTree(interior->GetFront()); 
    2408         VspKdNode *back = CollapseTree(interior->GetBack()); 
     2406        VspKdNode *front = CollapseTree(interior->GetFront(), collapsed); 
     2407        VspKdNode *back = CollapseTree(interior->GetBack(), collapsed); 
    24092408 
    24102409        if (front->IsLeaf() && back->IsLeaf()) 
     
    24202419                        VspKdLeaf *leaf = new VspKdLeaf(interior->GetParent(), 0); 
    24212420                        leaf->SetViewCell(vc); 
    2422  
    2423                         VspKdInterior *parent =  
    2424                                 dynamic_cast<VspKdInterior *>(leaf->mParent); 
     2421                        //leaf->SetTreeValid(frontLeaf->TreeValid()); 
     2422 
    24252423                        // replace a link from node's parent 
    2426                         if (parent) 
     2424                        if (leaf->mParent) 
     2425                        { 
     2426                                // replace a link from node's parent 
     2427                                VspKdInterior *parent =  
     2428                                        dynamic_cast<VspKdInterior *>(leaf->mParent); 
    24272429                                parent->ReplaceChildLink(node, leaf); 
    2428  
     2430                        } 
     2431                        ++ collapsed; 
    24292432                        delete interior; 
    24302433 
     
    24372440 
    24382441 
    2439 void VspKdTree::CollapseTree() 
    2440 { 
    2441         CollapseTree(mRoot); 
     2442int VspKdTree::CollapseTree() 
     2443{ 
     2444        int collapsed = 0; 
     2445        CollapseTree(mRoot, collapsed); 
    24422446        // revalidate leaves 
    24432447        RepairVcLeafLists(); 
    2444 } 
     2448 
     2449        return collapsed; 
     2450} 
     2451 
    24452452 
    24462453int VspKdTree::RefineViewCells(const VssRayContainer &rays) 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.h

    r500 r501  
    669669 
    670670        /** Collapses the tree with respect to the view cell partition. 
    671         */ 
    672         void CollapseTree(); 
     671                @returns number of collapsed nodes 
     672        */ 
     673        int CollapseTree(); 
    673674 
    674675protected: 
    675676 
    676         /** Collapses the tree with respect to the view cell partition. 
     677        /** Collapses the tree with respect to the view cell partition, 
     678                i.e. leaves having the same view cell are collapsed. 
     679                @param node the root of the subtree to be collapsed 
     680                @param collapsed returns the number of collapsed nodes 
    677681                @returns node of type leaf if the node could be collapsed,  
    678682                this node otherwise 
    679683        */ 
    680         VspKdNode *CollapseTree(VspKdNode *node); 
     684        VspKdNode *CollapseTree(VspKdNode *node, int &collapsed); 
     685 
    681686        // incremental construction 
    682687        virtual void UpdateRays(VssRayContainer &remove, VssRayContainer &add); 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp

    r499 r501  
    1212#include "RenderSimulator.h" 
    1313 
    14 bool useViewSpaceBox = false; 
    1514bool use2dSampling = false; 
    16 bool useViewspacePlane = false; 
     15bool useViewspacePlane = true; 
    1716 
    1817VssPreprocessor::VssPreprocessor(): 
     
    2928  environment->GetBoolValue("VssPreprocessor.loadInitialSamples", mLoadInitialSamples); 
    3029  environment->GetBoolValue("VssPreprocessor.storeInitialSamples", mStoreInitialSamples); 
     30  environment->GetBoolValue("VssPreprocessor.useViewSpaceBox", mUseViewSpaceBox); 
    3131 
    3232  mStats.open("stats.log"); 
     
    389389        box->SetMax(1, box->Min(1)); 
    390390 
    391   if (useViewSpaceBox) 
     391  if (mUseViewSpaceBox) 
    392392  { 
    393393        mViewSpaceBox = box; 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.h

    r490 r501  
    3232  /// if initial samples should be stored in file 
    3333  bool mStoreInitialSamples; 
    34  
     34  /// if box around view space should be used 
     35  bool mUseViewSpaceBox; 
    3536  // rays cast during the processing 
    3637  VssRayContainer mVssRays; 
Note: See TracChangeset for help on using the changeset viewer.