Changeset 663


Ignore:
Timestamp:
02/27/06 07:58:27 (18 years ago)
Author:
mattausch
Message:
 
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp

    r662 r663  
    11721172                                 "100000"); 
    11731173 
    1174  
    1175  
    11761174  RegisterOption("VssPreprocessor.useImportanceSampling", 
    11771175                                 optBool, 
     
    19921990                        "0.5"); 
    19931991 
    1994  
    19951992        RegisterOption("VspBspTree.Construction.randomize",  
    19961993                optBool,  
     
    19981995                "false"); 
    19991996 
    2000          
     1997        RegisterOption("VspBspTree.simulateOctree",  
     1998                optBool,  
     1999                "vsp_bsp_simulate_octree=",  
     2000                "false"); 
     2001 
    20012002        RegisterOption("VspBspTree.maxTotalMemory",  
    20022003                optFloat,  
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r660 r663  
    277277        if (SAMPLE_AFTER_SUBDIVISION) 
    278278                ComputeSampleContributions(postProcessSamples, true, storeViewCells); 
     279 
    279280        // merge the view cells 
    280281        PostProcess(preprocessor->mObjects, postProcessSamples); 
     
    310311        environment->GetIntValue("ViewCells.Evaluation.samples", numSamples); 
    311312 
     313        Debug << "view cells evaluation samples per pass: " << samplesPerPass << endl; 
     314        Debug << "view cells evaluation samples: " << numSamples << endl; 
     315 
    312316        while (castSamples < numSamples) 
    313317        { 
     318 
    314319        } 
    315320        //char s[64]; sprintf(s, "bsp-pvs%04d.x3d", i); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp

    r660 r663  
    3737int VspBspTree::sFrontAndBackId = 0; 
    3838 
    39  
     39bool VspBspTraversalData::sBreathFirstSplits = false; 
    4040 
    4141 
     
    129129        environment->GetBoolValue("VspBspTree.useCostHeuristics", mUseCostHeuristics); 
    130130        environment->GetBoolValue("VspBspTree.useSplitCostQueue", mUseSplitCostQueue); 
     131        environment->GetBoolValue("VspBspTree.simulateOctree", mSimulateOctree); 
     132        environment->GetBoolValue("VspBspTree.breathFirstSplits", VspBspTraversalData::sBreathFirstSplits); 
    131133 
    132134        char subdivisionStatsLog[100]; 
     
    143145        Debug << "min rays: " << mTermMinRays << endl; 
    144146        Debug << "max ray contri: " << mTermMaxRayContribution << endl; 
    145         //Debug << "VSP BSP mininam accumulated ray lenght: ", mTermMinAccRayLength) << endl; 
    146147        Debug << "max cost ratio: " << mTermMaxCostRatio << endl; 
    147148        Debug << "miss tolerance: " << mTermMissTolerance << endl; 
    148149        Debug << "max view cells: " << mMaxViewCells << endl; 
    149150        Debug << "max polygon candidates: " << mMaxPolyCandidates << endl; 
    150         Debug << "max plane candidates: " << mMaxRayCandidates << endl; 
     151        //Debug << "max plane candidates: " << mMaxRayCandidates << endl; 
    151152        Debug << "randomize: " << randomize << endl; 
    152153 
    153154        Debug << "using area for pvs: " << mUseAreaForPvs << endl; 
    154155        Debug << "render cost weight: " << mRenderCostWeight << endl; 
     156        Debug << "min global cost ratio: " << mTermMinGlobalCostRatio << endl; 
     157        Debug << "global cost miss tolerance: " << mTermGlobalCostMissTolerance << endl; 
     158        Debug << "only driving axis: " << mOnlyDrivingAxis << endl; 
     159        Debug << "max memory: " << mMaxMemory << endl; 
     160        Debug << "use poly split if available: " << mUsePolygonSplitIfAvailable << endl; 
     161        Debug << "use cost heuristics: " << mUseCostHeuristics << endl; 
     162        Debug << "use split cost queue: " << mUseSplitCostQueue << endl; 
     163        Debug << "subdivision stats log: " << subdivisionStatsLog << endl; 
     164         
     165 
    155166        Debug << "Split plane strategy: "; 
    156167 
     
    163174                Debug << "axis aligned "; 
    164175        } 
    165         if (mSplitPlaneStrategy & LEAST_RAY_SPLITS) 
     176        /*if (mSplitPlaneStrategy & LEAST_RAY_SPLITS) 
    166177        { 
    167178                mCostNormalizer += mLeastRaySplitsFactor; 
     
    177188                mCostNormalizer += mPvsFactor; 
    178189                Debug << "pvs"; 
    179         } 
     190        }*/ 
    180191 
    181192 
     
    451462                                                          prop, 
    452463                                                          geom); 
    453 #if OCTREE_HACK 
    454 tData.mAxis = 0; 
    455 #endif 
     464 
     465        tData.mPriority = mBreathFirstSplits ?  
     466                (float)-frontData.mDepth : tData.mPvs * tData.mProbability; 
     467 
     468        if (mSimulateOctree) 
     469        tData.mAxis = 0; 
     470 
    456471        // first node is kd node, i.e. an axis aligned box 
    457472        if (1) 
     
    560575                                                          geom); 
    561576 
     577        tData.mPriority = mBreathFirstSplits ?  
     578                (float)-tData.mDepth : tData.mPvs * tData.mProbability; 
     579 
    562580        // compute first split candidate 
    563581        VspBspSplitCandidate splitCandidate; 
     
    684702                VspBspTraversalData tBackData; 
    685703 
    686 #if OCTREE_HACK 
    687                 //Debug << "new axis:" << (tData.mAxis + 1) % 3 << endl; 
    688                 tFrontData.mAxis = (tData.mAxis + 1) % 3; 
    689                 tBackData.mAxis = (tData.mAxis + 1) % 3; 
    690 #endif 
     704                if (mSimulateOctree) 
     705                {       // choose axes in circular motion 
     706                        tFrontData.mAxis = (tData.mAxis + 1) % 3; 
     707                        tBackData.mAxis = (tData.mAxis + 1) % 3; 
     708                } 
     709 
    691710                // create new interior node and two leaf nodes 
    692711                // or return leaf as it is (if maxCostRatio missed) 
    693  
    694712                int splitAxis; 
    695713                bool splitFurther = true; 
     
    721739 
    722740                        tFrontData.mIsKdNode = tBackData.mIsKdNode = (tData.mIsKdNode && splitAxis < 3); 
     741 
    723742                        // how often was max cost ratio missed in this branch? 
    724743                        tFrontData.mMaxCostMisses = maxCostMisses; 
    725744                        tBackData.mMaxCostMisses = maxCostMisses; 
     745 
     746                        ComputePriority(tFrontData); 
     747                        ComputePriority(tBackData); 
    726748 
    727749                        if (1) 
     
    843865                tBackData.mMaxCostMisses = maxCostMisses; 
    844866                 
    845  
     867                ComputePriority(tFrontData); 
     868                ComputePriority(tBackData); 
     869 
     870                frontData.mPriority = mBreathFirstSplits ?  
     871                (float)-frontData.mDepth : frontData.mPvs * frontData.mProbability; 
     872        backData.mPriority = mBreathFirstSplits ?  
     873                (float)-backData.mDepth : backData.mPvs * backData.mProbability; 
    846874                if (1) 
    847875                { 
     
    937965 
    938966        // compute locally best split plane 
    939         bool success = SelectPlane(splitData.mSplitPlane, leaf, tData, frontData, backData, splitAxis); 
     967        bool success = SelectPlane(splitData.mSplitPlane, leaf, tData,  
     968                                                           frontData, backData, splitAxis); 
    940969 
    941970        // TODO: reuse 
     
    10041033                } 
    10051034        } 
    1006          
     1035 
    10071036         
    10081037    // subdivide polygons 
     
    13241353                        box.Include((*ri).ExtrapTermination()); 
    13251354        } 
    1326 #if OCTREE_HACK 
    1327         //Debug << "choosing axis:" << tData.mAxis << endl; 
    1328         const int sAxis = tData.mAxis; 
    1329 #else 
    1330         const int sAxis = mUseRandomAxis ? Random(3) : box.Size().DrivingAxis(); 
    1331 #endif 
     1355 
     1356        int sAxis = 0; 
     1357 
     1358        bool useSpecialAxis = false; 
     1359 
     1360        if (mSimulateOctree) 
     1361        { 
     1362                sAxis = tData.mAxis; 
     1363                useSpecialAxis = true; 
     1364        } 
     1365        else if (mUseRandomAxis) 
     1366        { 
     1367                sAxis = Random(3); 
     1368                useSpecialAxis = true; 
     1369        } 
     1370        else if (mOnlyDrivingAxis) 
     1371        { 
     1372                sAxis = box.Size().DrivingAxis(); 
     1373                useSpecialAxis = true; 
     1374        } 
     1375 
    13321376        for (axis = 0; axis < 3; ++ axis) 
    13331377        { 
    1334                 if (!mOnlyDrivingAxis || (axis == sAxis)) 
     1378                if (!useSpecialAxis || (axis == sAxis)) 
    13351379                { 
    13361380                        if (!mUseCostHeuristics) 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.h

    r660 r663  
    2828struct BspRay; 
    2929 
    30 #define OCTREE_HACK 0 
     30//#define OCTREE_HACK 0 
    3131/** 
    3232        This is a view space partitioning specialised BSPtree.   
     
    4444        /** Additional data which is passed down the BSP tree during traversal. 
    4545        */ 
    46         struct VspBspTraversalData 
     46        class VspBspTraversalData 
    4747        {   
     48        public: 
    4849                /// the current node 
    4950                BspNode *mNode; 
     
    6465                /// if this node is a kd-node (i.e., boundaries are axis aligned 
    6566                bool mIsKdNode; 
    66  
    67  
    68 #if OCTREE_HACK // OCTREE HACK 
     67                // hack for octree 
    6968                int mAxis; 
    70 #endif 
    71                 /// bounding box of current view space. 
    72                 ///AxisAlignedBox3 mBbox; 
    73                  
     69                float mPriority; 
     70 
     71                static bool sBreathFirstSplits; 
     72 
    7473                /** Returns average ray contribution. 
    7574                */ 
     
    129128                float GetCost() const 
    130129                { 
    131 #if 1 
    132                         return mPvs * mProbability; 
    133 #endif 
    134 #if 0 
    135                         return (float) (-mDepth); // for regular grid 
    136 #endif 
    137 #if 0 
    138                         return (float)(mPvs * (int)mRays->size()); 
    139 #endif 
    140 #if 0 
    141                         return (float)mPvs; 
    142 #endif 
    143 #if 0 
    144                         return mProbabiliy * (float)mRays->size(); 
    145 #endif 
     130                        if (sBreathFirstSplits) 
     131                                return mPvs * mProbability; 
     132                        else 
     133                                return (float) (-mDepth); // for kd tree 
    146134                } 
    147135 
     
    160148    }; 
    161149         
     150 
    162151        typedef std::priority_queue<VspBspTraversalData> VspBspTraversalQueue; 
    163152         
     
    788777 
    789778        //int mSplits; 
    790  
     779        /// subdivision stats output file 
    791780        ofstream mSubdivsionStats; 
    792  
     781        /// if random split axis should be used 
    793782        bool mUseRandomAxis; 
    794  
     783        /// use polygon split whenever there are polys left 
    795784        bool mUsePolygonSplitIfAvailable; 
    796  
     785        /// current time stamp (used for keeping split history) 
    797786        int mTimeStamp; 
    798  
     787        /// number of currenly generated view cells 
    799788        int mCreatedViewCells; 
     789        /// if vsp bsp tree should simulate octree 
     790        bool mSimulateOctree; 
     791 
     792        int mBreathFirstSplits; 
    800793 
    801794private: 
  • OGRE/trunk/ogrenew/Samples/Common/bin/Release/resources.cfg

    r657 r663  
    1515FileSystem=../../../Media/particle 
    1616FileSystem=../../../Media/gui 
    17 FileSystem=D:/svn/gametools/OGRE/trunk/resources/materials/scripts 
    18 FileSystem=D:/svn/gametools/OGRE/trunk/resources/materials/textures 
    19 FileSystem=D:/svn/gametools/OGRE/trunk/resources/models 
    20 FileSystem=D:/svn/gametools/OGRE/trunk/resources/models/trees 
    21 FileSystem=D:/svn/gametools/OGRE/trunk/resources/overlays 
    22 FileSystem=D:/svn/gametools/OGRE/trunk/resources/media 
     17FileSystem=E:/svn/gametools/OGRE/trunk/resources/materials/scripts 
     18FileSystem=E:/svn/gametools/OGRE/trunk/resources/materials/textures 
     19FileSystem=E:/svn/gametools/OGRE/trunk/resources/models 
     20FileSystem=E:/svn/gametools/OGRE/trunk/resources/models/trees 
     21FileSystem=E:/svn/gametools/OGRE/trunk/resources/overlays 
     22FileSystem=E:/svn/gametools/OGRE/trunk/resources/media 
    2323Zip=../../../Media/packs/cubemap.zip 
    2424Zip=../../../Media/packs/cubemapsJS.zip 
Note: See TracChangeset for help on using the changeset viewer.