Changeset 1664


Ignore:
Timestamp:
10/23/06 01:36:17 (18 years ago)
Author:
mattausch
Message:

changed priority computation:
taking ratio render cost decrease / pvs size increase rather
then render cost decrease alone
this should rather emphasise object space splits, as they
seem to cost less memory.

Location:
GTP/trunk/Lib/Vis/Preprocessing
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/vsposp_typical.sh

    r1663 r1664  
    1212 
    1313#SCENE=vsposp_typical 
    14 SCENE=soda5_vsposp 
    15 #SCENE=soda_vsposp 
     14#SCENE=soda5_vsposp 
     15SCENE=soda_vsposp 
    1616#SCENE=vienna_vsposp 
    1717#SCENE=arena_vsposp 
     
    133133 
    134134 
     135############################################################### 
     136 
     137 METHOD=gradient-2 
     138 echo ********" $SCENE $METHOD ************" 
     139 
     140 $PROGRAM $ENVIRONMENT \ 
     141 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 
     142 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 
     143 -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 
     144 -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 
     145 -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 
     146 -hierarchy_construction_type=2 \ 
     147 -hierarchy_construction_multilevel=false \ 
     148 -hierarchy_construction_levels=4 \ 
     149 -hierarchy_construction_consider_memory=true \ 
     150 -bvh_construction_render_cost_decrease_weight=0.99 \ 
     151 -vsp_construction_render_cost_decrease_weight=0.99 \ 
     152 -hierarchy_construction_recompute_split_on_repair=true 
     153 
     154sh movefiles.sh $LOG_PREFIX-$METHOD 
     155 
     156 
    135157######################################################################## 
    136158 
     
    138160echo "$SCENE $METHOD" 
    139161 
    140 #$PROGRAM $ENVIRONMENT \ 
     162$PROGRAM $ENVIRONMENT \ 
    141163 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 
    142164 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 
     
    148170  -hierarchy_construction_type=2 \ 
    149171  -hierarchy_construction_recompute_split_on_repair=true 
    150  
    151 sh movefiles.sh $LOG_PREFIX-$METHOD 
    152  
    153 ############################################################### 
    154  
    155  METHOD=gradient-multi 
    156  echo ********" $SCENE $METHOD ************" 
    157  
    158  $PROGRAM $ENVIRONMENT \ 
    159  -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 
    160  -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 
    161  -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 
    162  -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 
    163  -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 
    164  -hierarchy_construction_type=2 \ 
    165  -hierarchy_construction_multilevel=true \ 
    166  -hierarchy_construction_levels=4 \ 
    167  -bvh_construction_render_cost_decrease_weight=0.6 \ 
    168  -vsp_construction_render_cost_decrease_weight=0.6 \ 
    169  -hierarchy_construction_recompute_split_on_repair=true 
    170172 
    171173sh movefiles.sh $LOG_PREFIX-$METHOD 
  • GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp

    r1663 r1664  
    2525#define PROBABILIY_IS_BV_VOLUME 1 
    2626#define USE_FIXEDPOINT_T 0 
    27  
    2827#define USE_VOLUMES_FOR_HEURISTICS 1 
    29  
    30 #define CONSIDER_MEMORY 1 
    3128 
    3229int BvhNode::sMailId = 10000; //2147483647; 
     
    429426                         
    430427                // create new interior node and two leaf node 
    431                 currentNode = SubdivideNode( 
    432                         *sc,  
    433                         tFrontData,  
    434                         tBackData); 
     428                currentNode = SubdivideNode(*sc, tFrontData, tBackData); 
    435429         
    436430                // decrease the weighted average cost of the subdivisoin 
     
    457451                tBackData.mNode->SetSubdivisionCandidate(backCandidate); 
    458452 
     453                //cout << "f: " << frontCandidate->GetPriority() << " b: " << backCandidate->GetPriority() << endl; 
    459454                tQueue.Push(frontCandidate); 
    460455                tQueue.Push(backCandidate); 
     
    466461        if (currentNode->IsLeaf()) 
    467462        { 
    468                 ////////////////////////////////////// 
     463                ///////////////////// 
    469464                //-- store additional info 
    470465                EvaluateLeafStats(tData); 
     
    530525#endif 
    531526 
    532 #if 1 
    533527        float priority; 
    534          
     528 
    535529        if (mHierarchyManager->GetViewSpaceSubdivisionType() ==  
    536530                HierarchyManager::NO_VIEWSPACE_SUBDIV) 
     
    551545                // take render cost of node into account  
    552546                // otherwise danger of being stuck in a local minimum!! 
    553                 #if CONSIDER_MEMORY 
    554                         const float priority = factor * renderCostDecr - (1.0f - factor) * splitCandidate.GetPvsEntriesIncr(); 
    555                 #else 
    556                         const float priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 
    557                 #endif 
    558         } 
    559  
    560 #else 
    561         const float priority = (float)-splitCandidate.mParentData.mDepth; 
    562 #endif 
     547                if (mHierarchyManager->mConsiderMemory) 
     548                { 
     549                        //cout << "here7 rc: " << factor * renderCostDecr << " pvs: " << (1.0f - factor) * splitCandidate.GetPvsEntriesIncr() << endl; 
     550                        //priority = factor * renderCostDecr - (1.0f - factor) * splitCandidate.GetPvsEntriesIncr();// / mBvhStats.Leaves(); 
     551                        priority = renderCostDecr / ((float)splitCandidate.GetPvsEntriesIncr() + 1.0f); 
     552                } 
     553                else 
     554                { 
     555                        priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 
     556                } 
     557        } 
     558 
     559        // compute global decrease in render cost 
     560        splitCandidate.SetPriority(priority); 
     561} 
     562 
     563 
     564float BvHierarchy::EvalPriority(const BvhSubdivisionCandidate &splitCandidate) const 
     565{ 
     566        BvhLeaf *leaf = splitCandidate.mParentData.mNode; 
     567 
     568        const float oldRenderCost = EvalRenderCost(leaf->mObjects); 
    563569 
    564570        // compute global decrease in render cost 
    565         splitCandidate.SetPriority(priority); 
    566 } 
    567  
    568  
    569 float BvHierarchy::EvalPriority(const BvhSubdivisionCandidate &splitCandidate) const 
    570 { 
    571         BvhLeaf *leaf = splitCandidate.mParentData.mNode; 
    572  
    573         const float oldRenderCost = EvalRenderCost(leaf->mObjects); 
    574  
    575         // compute global decrease in render cost 
    576         const float newRenderCost =  
    577                 EvalRenderCost(splitCandidate.mFrontObjects) + 
    578                 EvalRenderCost(splitCandidate.mBackObjects); 
     571        const float newRenderCost = EvalRenderCost(splitCandidate.mFrontObjects) + 
     572                                                                EvalRenderCost(splitCandidate.mBackObjects); 
    579573 
    580574        const float renderCostDecr = oldRenderCost - newRenderCost; 
     
    586580#endif 
    587581 
    588 #if 1 
    589582        // take render cost of node into account  
    590583        // otherwise danger of being stuck in a local minimum!! 
    591584        const float factor = mRenderCostDecreaseWeight; 
     585         
     586        float priority; 
     587 
    592588        // $$ matt temp 
    593 #if CONSIDER_MEMORY 
    594         const float priority = factor * renderCostDecr - (1.0f - factor) * splitCandidate.GetPvsEntriesIncr(); 
    595 #else 
    596         const float priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 
    597 #endif 
    598 #else 
    599         const float priority = (float)-splitCandidate.mParentData.mDepth; 
    600 #endif 
     589        if (mHierarchyManager->mConsiderMemory) 
     590        { 
     591                //cout << "here5 rc: " << factor * renderCostDecr << " pvs: " << (1.0f - factor) * splitCandidate.GetPvsEntriesIncr() << endl; 
     592                //const float priority = factor * renderCostDecr - (1.0f - factor) * (float)splitCandidate.GetPvsEntriesIncr(); 
     593                priority = renderCostDecr / ((float)splitCandidate.GetPvsEntriesIncr() + 1.0f); 
     594        } 
     595        else 
     596        { 
     597                priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 
     598        } 
    601599 
    602600        return priority; 
     
    620618                        || ((int)data.mNode->mObjects.size() <= mTermMinObjects) 
    621619                        //|| (data.mProbability <= mTermMinProbability) 
    622                         //|| (data.mNumRays <= mTermMinRays) 
     620                        || (data.mNumRays <= mTermMinRays) 
    623621                 ); 
    624622} 
     
    952950        cout << "\n\nobjects=(" << (int)objectsBack.size() << "," << (int)objectsFront.size() << " of "  
    953951                 << (int)tData.mNode->mObjects.size() << ")\t area=("  
    954                  << areaLeft << "," << areaRight << ")" << endl; 
    955         cout << "cost= " << minSum << endl; 
     952                 << areaLeft << "," << areaRight << ")" << endl 
     953                << "cost= " << minSum << endl; 
    956954#endif 
     955 
    957956  return ratio; 
    958957} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h

    r1663 r1664  
    418418                bool Apply(SplitQueue &splitQueue, bool terminationCriteriaMet) 
    419419                { 
    420                         BvhNode *n = sBvHierarchy->Subdivide(splitQueue, this, terminationCriteriaMet); 
     420                        BvhNode *n =  
     421                                sBvHierarchy->Subdivide(splitQueue, this, terminationCriteriaMet); 
    421422                        // local or global termination criteria failed 
    422423                        return !n->IsLeaf();             
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp

    r1663 r1664  
    428428                        vspPriority = viewSpaceQueue.Top()->GetPriority(); 
    429429 
    430                         if (mConsiderMemory) 
     430                        // rather take this into account directly when computing priority 
     431                        if (0 && mConsiderMemory) 
    431432                                vspPriority /= ((float)viewSpaceQueue.Top()->GetPvsEntriesIncr() + Limits::Small); 
    432433                } 
     
    436437                } 
    437438 
    438                 float ospPriority = 0; 
     439                float ospPriority; 
    439440                 
    440441                if (!objectSpaceQueue.Empty()) 
    441442                { 
    442443                        ospPriority = objectSpaceQueue.Top()->GetPriority(); 
    443                  
    444                         if (mConsiderMemory) 
     444                         
     445                        // rather take this into account directly when computing priority 
     446                        if (0 && mConsiderMemory) 
    445447                                ospPriority /= ((float)objectSpaceQueue.Top()->GetPvsEntriesIncr() + Limits::Small); 
    446448                } 
     
    516518        mHierarchyStats.Reset(); 
    517519        mHierarchyStats.Start(); 
    518         mHierarchyStats.mNodes = 2; // two nodes for view space and object space 
     520 
     521        // two nodes for view space and object space 
     522        mHierarchyStats.mNodes = 2;  
    519523        mHierarchyStats.mPvsEntries = 1; 
    520524        mHierarchyStats.mMemory = sizeof(PvsData) + sizeof(Intersectable *) / (1024.0f * 1024.0f); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r1662 r1664  
    957957{ 
    958958        // always try to load the kd tree 
    959         cout << "loading kd tree file " << internKdTree << " ... "; 
     959        cout << "loading kd tree file " << internKdTree << " ... " << endl; 
    960960 
    961961        if (!LoadKdTree(internKdTree)) 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp

    r1663 r1664  
    2828 
    2929#define USE_FIXEDPOINT_T 0 
    30 #define CONSIDER_MEMORY 1 
    3130 
    3231///////////// 
     
    819818        splitCandidate.SetPvsEntriesIncr(pvsEntriesIncr); 
    820819 
    821 #if 0 
    822         const float priority = (float)-splitCandidate.mParentData.mDepth; 
    823 #else 
    824820        // take render cost of node into account  
    825821        // otherwise danger of being stuck in a local minimum!! 
    826822        const float factor = mRenderCostDecreaseWeight; 
    827823 
    828 #if CONSIDER_MEMORY 
    829         const float priority = factor * renderCostDecr - (1.0f - factor) * splitCandidate.GetPvsEntriesIncr(); 
    830 #else 
    831         const float priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 
    832 #endif 
    833 #endif 
     824        float priority; 
     825 
     826        if (mHierarchyManager->mConsiderMemory) 
     827        { 
     828                //cout << "here4 rc: " << factor * renderCostDecr << " pvs: " << (1.0f - factor) * splitCandidate.GetPvsEntriesIncr() << endl; 
     829                //const float priority = factor * renderCostDecr - (1.0f - factor) * splitCandidate.GetPvsEntriesIncr(); 
     830                priority = renderCostDecr / ((float)splitCandidate.GetPvsEntriesIncr() +  + 1.0f); 
     831        } 
     832        else 
     833        { 
     834                priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 
     835        } 
    834836         
    835837        splitCandidate.SetPriority(priority); 
     
    845847                                                                                                                oldRenderCost); 
    846848     
    847 #if 0 
    848         const float priority = (float)-splitCandidate.mParentData.mDepth; 
    849 #else 
    850849        // take render cost of node into account  
    851850        // otherwise danger of being stuck in a local minimum!! 
    852851        const float factor = mRenderCostDecreaseWeight; 
    853 #if CONSIDER_MEMORY 
    854         const float priority = factor * renderCostDecr - (1.0f - factor) * splitCandidate.GetPvsEntriesIncr(); 
    855 #else 
    856         const float priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 
    857 #endif 
    858  
    859 #endif 
    860          
     852 
     853        float priority; 
     854 
     855        if (mHierarchyManager->mConsiderMemory) 
     856        { 
     857                //cout << "here2 rc: " << factor * renderCostDecr << " pvs: " << (1.0f - factor) * splitCandidate.GetPvsEntriesIncr() << endl;  
     858                //const float priority = factor * renderCostDecr - (1.0f - factor) * splitCandidate.GetPvsEntriesIncr(); 
     859                priority = renderCostDecr / ((float)splitCandidate.GetPvsEntriesIncr() + 1.0f); 
     860        } 
     861        else 
     862        { 
     863                priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 
     864        } 
     865 
    861866        return priority; 
    862867} 
     
    917922 
    918923        //-- subdivide rays 
    919         SplitRays(splitPlane, 
    920                           *tData.mRays, 
    921                           *frontData.mRays, 
    922                           *backData.mRays); 
     924        SplitRays(splitPlane, *tData.mRays, *frontData.mRays, *backData.mRays); 
    923925 
    924926        //-- compute pvs 
     
    946948        // two more leaves per split 
    947949        mVspStats.nodes += 2; 
    948         /// and a new split 
     950        // and a new split 
    949951        ++ mVspStats.splits[splitPlane.mAxis]; 
    950952 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.h

    r1663 r1664  
    10861086        float mEpsilon; 
    10871087 
    1088  
    10891088        /// subdivision stats output file 
    10901089        ofstream  mSubdivisionStats; 
Note: See TracChangeset for help on using the changeset viewer.