Changeset 489


Ignore:
Timestamp:
01/02/06 13:42:43 (18 years ago)
Author:
mattausch
Message:

valid view point regions working now for bsp view cells (crit: maxpvs)

Location:
trunk/VUT/GtpVisibilityPreprocessor
Files:
8 edited

Legend:

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

    r487 r489  
    155155        height 5.0 
    156156        maxViewCells 100 
    157         maxPvs 70 
     157        maxPvs 130 
    158158         
    159159         
     
    168168        Visualization { 
    169169                # how much samples are be used for visualization 
    170                 samples 90000 
     170                samples 1000 
    171171                #colorCode PVS 
    172172                #colorCode MergedLeaves 
     
    219219        # maximal cost for merging a view cell 
    220220        PostProcess { 
    221 <<<<<<< .mine 
    222221                maxCostRatio 0.005 
    223222                minViewCells 200 
    224  
    225223                maxPvsSize   50000 
    226224        } 
     
    289287                maxCostRatio 0.1 
    290288                minViewCells 200 
    291  
    292289                maxPvsSize   500 
    293290                useRaysForMerge false 
  • trunk/VUT/GtpVisibilityPreprocessor/src/Environment.cpp

    r487 r489  
    16801680        RegisterOption("VspBspTree.Termination.maxViewCells", 
    16811681                optInt, 
    1682                 "-vsp_bsp_term_axis_aligned_max_view_cells=", 
     1682                "-vsp_bsp_term_max_view_cells=", 
    16831683                "1000"); 
    16841684 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp

    r487 r489  
    3939int BspTree::sFrontAndBackId = 0; 
    4040 
     41 
    4142/****************************************************************/ 
    4243/*                  class BspNode implementation                */ 
    4344/****************************************************************/ 
    4445 
     46 
    4547BspNode::BspNode():  
    46 mParent(NULL) 
     48mParent(NULL), mTreeValid(true) 
    4749{} 
    4850 
    4951BspNode::BspNode(BspInterior *parent):  
    50 mParent(parent) 
     52mParent(parent), mTreeValid(true) 
    5153{} 
    5254 
     
    210212mGenerateViewCells(true) 
    211213{ 
    212          
    213  
    214214        Randomize(); // initialise random generator for heuristics 
    215215 
     
    428428        DEL_PTR(mRoot); 
    429429 
    430         // root cell not used 
     430        // HACK: view cells not generated => root cell not used 
    431431        if (mGenerateViewCells) 
    432432                DEL_PTR(mRootCell); 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp

    r487 r489  
    4545        environment->GetBoolValue("ViewCells.Visualization.exportGeometry", mExportGeometry); 
    4646 
     47        //Debug << "export rays: " << mExportRays << endl; 
     48        //Debug << "export geometry: " << mExportGeometry << endl; 
    4749        char buf[50]; 
    4850         
     
    17321734} 
    17331735 
     1736 
    17341737// matt TODO: remove 
    17351738int VspBspViewCellsManager::MergeViewCells(const VssRayContainer &rays) const 
     
    18751878    Debug << ss << endl; 
    18761879 
    1877         cout << "Refining the view cells ... "; 
     1880        cout << "Refining the merged view cells ... "; 
    18781881        startTime = GetTime(); 
    18791882 
     
    19221925                        if (mExportGeometry) 
    19231926                                exporter->ExportGeometry(objects); 
     1927 
     1928                        // export rays 
     1929                        /*if (mExportRays) 
     1930                        { 
     1931                                exporter->SetWireframe(); 
     1932                                exporter->ExportRays(visRays, RgbColor(1, 1, 0)); 
     1933                                exporter->SetFilled(); 
     1934                        }*/ 
    19241935                        ExportViewCells(exporter); 
    19251936                        delete exporter; 
     
    19311942        //-- visualization of the BSP splits 
    19321943        bool exportSplits = false; 
    1933         environment->GetBoolValue("BspTree.Visualization.exportSplits", exportSplits); 
    1934          
     1944        environment->GetBoolValue("VspBspTree.Visualization.exportSplits", exportSplits); 
     1945        Debug << "export splits: " << exportSplits << endl; 
     1946 
    19351947        if (exportSplits) 
    19361948        { 
     
    19501962                return ViewCellsManager::GetViewPoint(viewPoint); 
    19511963 
     1964        // TODO: set reasonable limit 
    19521965        const int limit = 10; 
    1953  
     1966cout << "===" << endl; 
    19541967        for (int i = 0; i < limit; ++ i) 
    19551968        { 
     1969                cout << i << " " << endl; 
    19561970                viewPoint = mSceneBox.GetRandomPoint(); 
    19571971                if (mVspBspTree->ViewPointValid(viewPoint)) 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h

    r488 r489  
    258258        virtual void ExportVcGeometry(Exporter *exporter, ViewCell *vc) const = 0; 
    259259 
    260         /// the view cell corresponding to unbounded space 
    261         //ViewCell *mUnbounded; 
     260        /// the view cell corresponding to space ouside the valid view space 
     261        //ViewCell *mOutOfBoundsCell; 
    262262 
    263263        /// Renders the view cells. 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp

    r487 r489  
    4545mViewCellsManager(NULL), 
    4646mStoreRays(false), 
    47 mOnlyDrivingAxis(false) 
     47mOnlyDrivingAxis(false), 
     48mOutOfBoundsCell(NULL) 
    4849{ 
    4950        bool randomize = false; 
     
    128129        } 
    129130 
     131 
    130132        mSplitCandidates = new vector<SortableEntry>; 
    131133 
    132134        Debug << endl; 
     135} 
     136 
     137 
     138BspViewCell *VspBspTree::GetOrCreateOutOfBoundsCell() 
     139{ 
     140        if (!mOutOfBoundsCell) 
     141                mOutOfBoundsCell = new BspViewCell(); 
     142 
     143        return mOutOfBoundsCell; 
    133144} 
    134145 
     
    401412        { 
    402413                BspLeaf *leaf = dynamic_cast<BspLeaf *>(newNode); 
     414                BspViewCell *viewCell; 
    403415 
    404416                if (!CheckValid(tData)) 
     
    406418                        leaf->SetTreeValid(false); 
    407419                        PropagateUpValidity(leaf); 
    408                 } 
    409  
    410                 // create new view cell for this leaf 
    411                 BspViewCell *viewCell = new BspViewCell(); 
     420                        // view cell for invalid view space 
     421                        viewCell = GetOrCreateOutOfBoundsCell(); 
     422                } 
     423                else 
     424                { 
     425                        // create new view cell for this leaf 
     426                        viewCell = new BspViewCell(); 
     427                } 
     428                 
    412429                leaf->SetViewCell(viewCell); 
    413430         
     
    12061223        { 
    12071224                BspNode *node = nodeStack.top(); 
    1208  
    12091225                nodeStack.pop(); 
     1226                 
     1227                // this subtree is not valid view space 
     1228                if (!node->TreeValid()) 
     1229                        continue; 
    12101230 
    12111231                if (node->IsLeaf()) 
     
    12241244} 
    12251245 
     1246 
    12261247AxisAlignedBox3 VspBspTree::GetBoundingBox() const 
    12271248{ 
     
    12291250} 
    12301251 
     1252 
    12311253BspNode *VspBspTree::GetRoot() const 
    12321254{ 
    12331255        return mRoot; 
    12341256} 
     1257 
     1258 
     1259BspViewCell *VspBspTree::GetOutOfBoundsCell() const 
     1260{ 
     1261        return mOutOfBoundsCell; 
     1262} 
     1263 
    12351264 
    12361265void VspBspTree::EvaluateLeafStats(const VspBspTraversalData &data) 
     
    13991428                BspNode *node = nodeStack.top(); 
    14001429                nodeStack.pop(); 
     1430                // this subtree is not valid view space 
     1431                if (!node->TreeValid()) 
     1432                        continue; 
    14011433 
    14021434                if (node->IsLeaf()) 
     
    16351667                nodeStack.pop(); 
    16361668 
     1669                // view space not valid 
     1670                if (!node->TreeValid()) 
     1671                        continue; 
     1672 
    16371673                if (node->IsLeaf()) 
    16381674                { 
     
    16871723        return (int)neighbors.size(); 
    16881724} 
     1725 
    16891726 
    16901727BspLeaf *VspBspTree::GetRandomLeaf(const Plane3 &halfspace) 
     
    20022039 
    20032040                        BspLeaf *leaf = new BspLeaf(interior->GetParent(), vc); 
     2041                        leaf->SetTreeValid(frontLeaf->TreeValid()); 
    20042042 
    20052043                        // replace a link from node's parent 
     
    21702208           
    21712209                iit = ray->intersections.begin(); 
    2172                 BspLeaf *prevLeaf = (*(iit ++)).mLeaf; 
     2210                BspLeaf *leaf = (*(iit ++)).mLeaf; 
    21732211                 
    21742212                // create leaf pvs (needed for post processing) 
    2175                 if (!prevLeaf->mPvs) 
    2176                 { 
    2177                         prevLeaf->mPvs =  
    2178                                 new ObjectPvs(prevLeaf->GetViewCell()->GetPvs()); 
     2213                if (!leaf->mPvs) 
     2214                { 
     2215                        leaf->mPvs =  
     2216                                new ObjectPvs(leaf->GetViewCell()->GetPvs()); 
    21792217 
    21802218                        BspMergeCandidate::sOverallCost +=  
    2181                                 prevLeaf->mArea * prevLeaf->mPvs->GetSize(); 
     2219                                leaf->mArea * leaf->mPvs->GetSize(); 
    21822220                         
    21832221                        ++ leaves; 
     
    21852223                 
    21862224                // traverse intersections  
    2187                 // consecutive leaves are neighbors =>  
    2188                 // add them to queue 
     2225                // consecutive leaves are neighbors => add them to queue 
    21892226                for (; iit != ray->intersections.end(); ++ iit) 
    21902227                { 
    2191             BspLeaf *leaf = (*iit).mLeaf; 
    2192              
     2228                        // next pair 
     2229                        BspLeaf *prevLeaf = leaf; 
     2230            leaf = (*iit).mLeaf; 
     2231 
     2232                        // view space does not correspond to valid space 
     2233                        if (!leaf->TreeValid() || !prevLeaf->TreeValid()) 
     2234                                continue; 
     2235 
     2236            // create leaf pvs (needed for post processing) 
    21932237                        if (!leaf->mPvs) 
    21942238                        { 
     
    22292273                                mMergeQueue.push(BspMergeCandidate(leaf, prevLeaf)); 
    22302274                        } 
    2231  
    2232                         prevLeaf = leaf; 
    22332275        } 
    22342276        } 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.h

    r487 r489  
    278278        bool ViewPointValid(const Vector3 &viewPoint) const; 
    279279 
     280        /** Returns the view cell corresponding to  
     281                the space outside the valid view space. 
     282        */ 
     283        BspViewCell *GetOutOfBoundsCell() const; 
    280284 
    281285protected: 
     
    550554        */ 
    551555        void PropagateUpValidity(BspNode *node); 
     556 
     557        /** Creates or returns view cell corresponding to  
     558                the space outside the valid view space. 
     559        */ 
     560        BspViewCell *GetOrCreateOutOfBoundsCell(); 
    552561 
    553562        /// Pointer to the root of the tree 
     
    644653        int mMaxPvs; 
    645654 
     655        /// View cell corresponding to the space outside the valid view space 
     656        BspViewCell *mOutOfBoundsCell; 
    646657 
    647658private: 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp

    r487 r489  
    1212#include "RenderSimulator.h" 
    1313 
    14 bool useViewSpaceBox = true;//true; 
     14bool useViewSpaceBox = true; 
    1515bool use2dSampling = false; 
    16 bool useViewspacePlane = true;//true; 
     16bool useViewspacePlane = true; 
    1717 
    1818VssPreprocessor::VssPreprocessor(): 
Note: See TracChangeset for help on using the changeset viewer.