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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 
Note: See TracChangeset for help on using the changeset viewer.