Changeset 2227


Ignore:
Timestamp:
03/11/07 02:17:58 (17 years ago)
Author:
mattausch
Message:

added render cost bound for objects, improved undersampling compensation

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

Legend:

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

    r2211 r2227  
    1414 
    1515NUM_SAMPLE_RAYS=200000000 
    16 #NUM_SAMPLE_RAYS=50000000 
     16NUM_SAMPLE_RAYS=50000000 
    1717 
    1818$PREPROCESSOR -total_samples=$NUM_SAMPLE_RAYS \ 
  • GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp

    r2224 r2227  
    634634 
    635635 
     636static float AvgRaysPerObject(const int pvs, const int nRays) 
     637{ 
     638        return (float)nRays / ((float)pvs + Limits::Small); 
     639} 
     640 
     641 
    636642void BvHierarchy::EvalSubdivisionCandidate(BvhSubdivisionCandidate &splitCandidate,  
    637643                                                                                   const bool computeSplitPlane, 
     
    689695        // avg contribution of a ray to a pvs 
    690696        const float pvs = (float)CountViewCells(*tData.mSampledObjects); 
    691         const float avgRayContri = AvgRayContribution((int)pvs, tData.mNumRays); 
     697        //const float avgRayContri = AvgRayContribution((int)pvs, tData.mNumRays); 
     698        const float avgRaysPerObject = AvgRaysPerObject((int)pvs, tData.mNumRays); 
    692699 
    693700        // high avg ray contri, the result is influenced by undersampling 
    694         splitCandidate.SetAvgRayContribution(avgRayContri); 
     701        splitCandidate.SetAvgRaysPerObject(avgRaysPerObject); 
    695702        const float viewSpaceVol = GetViewSpaceVolume(); 
    696703 
     
    699706        const float parentVol = tData.mCorrectedVolume * oldRatio; 
    700707 
     708        //cout << "h " << avgRaysPerObject << " "; 
    701709        // this leaf is a pvs entry in all the view cells 
    702710        // that see one of the objects. 
     
    708716 
    709717        splitCandidate.mCorrectedFrontVolume =  
    710                 mHierarchyManager->EvalCorrectedPvs(splitCandidate.mVolumeFrontViewCells, parentVol, avgRayContri); 
     718                mHierarchyManager->EvalCorrectedPvs(splitCandidate.mVolumeFrontViewCells, parentVol, avgRaysPerObject); 
    711719         
    712720        splitCandidate.mCorrectedBackVolume =  
    713                 mHierarchyManager->EvalCorrectedPvs(splitCandidate.mVolumeBackViewCells, parentVol, avgRayContri); 
     721                mHierarchyManager->EvalCorrectedPvs(splitCandidate.mVolumeBackViewCells, parentVol, avgRaysPerObject); 
    714722         
    715723        const float relfrontCost = splitCandidate.mCorrectedFrontVolume *  
     
    727735        // increase in pvs entries 
    728736        const int pvsEntriesIncr = EvalPvsEntriesIncr(splitCandidate,  
    729                                                                                                   avgRayContri,  
     737                                                                                                  avgRaysPerObject,  
    730738                                                                                                  (int)pvs,  
    731739                                                                                                  splitCandidate.mNumFrontViewCells,  
     
    737745        { 
    738746                cout << "bvh volume cost" 
    739                  << " avg ray contri: " << avgRayContri << " ratio: " << oldRatio  
     747                 << " avg rays per object: " << avgRaysPerObject << " ratio: " << oldRatio  
    740748                 << " parent: " << parentVol << " old vol: " << oldVolume  
    741749                 << " frontvol: " << splitCandidate.mVolumeFrontViewCells << " corr. " << splitCandidate.mCorrectedFrontVolume  
     
    766774 
    767775int BvHierarchy::EvalPvsEntriesIncr(BvhSubdivisionCandidate &splitCandidate,  
    768                                                                         const float avgRayContri, 
     776                                                                        const float avgRaysPerObjects, 
    769777                                                                        const int numParentViewCells, 
    770778                                                                        const int numFrontViewCells, 
     
    780788         
    781789        splitCandidate.mCorrectedFrontPvs =  
    782                 mHierarchyManager->EvalCorrectedPvs((float)frontViewCells, parentPvs, avgRayContri); 
     790                mHierarchyManager->EvalCorrectedPvs((float)frontViewCells, parentPvs, avgRaysPerObjects); 
    783791        splitCandidate.mCorrectedBackPvs = 
    784                 mHierarchyManager->EvalCorrectedPvs((float)backViewCells, parentPvs, avgRayContri); 
     792                mHierarchyManager->EvalCorrectedPvs((float)backViewCells, parentPvs, avgRaysPerObjects); 
    785793 
    786794        if (0) 
    787795        cout << "bvh pvs" 
    788                  << " avg ray contri: " << avgRayContri << " ratio: " << oldPvsRatio  
     796                 << " avg ray contri: " << avgRaysPerObjects << " ratio: " << oldPvsRatio  
    789797                 << " parent: " << parentPvs << " " << " old vol: " << oldPvsSize 
    790798                 << " frontpvs: " << frontViewCells << " corr. " << splitCandidate.mCorrectedFrontPvs  
     
    10141022#endif 
    10151023 
    1016 #if 1 
    10171024 
    10181025float BvHierarchy::EvalSah(const BvhTraversalData &tData, 
     
    11111118                ar = rbox.SurfaceArea(); 
    11121119 
     1120#if BOUND_RENDERCOST 
    11131121                const float sum = noValidSplit ? 1e25f : objectsLeft * al + objectsRight * ar; 
    1114        
     1122#else 
     1123                const float rcLeft = std::max(objectsLeft, MIN_RENDERCOST); 
     1124                const float rcRight = std::max(objectsRight, MIN_RENDERCOST); 
     1125 
     1126                const float sum = noValidSplit ? 1e25f : objectsLeft * al + objectsRight * ar; 
     1127 
     1128#endif 
    11151129                /*cout << "pos=" << (*cit).mPos << "\t q=(" << objectsLeft << "," << objectsRight <<")\t r=("  
    11161130                         << lbox.SurfaceArea() << "," << rbox.SurfaceArea() << ")" << endl; 
     
    11531167} 
    11541168 
    1155 #else 
    1156  
    1157 float BvHierarchy::EvalSah(const BvhTraversalData &tData, 
    1158                                                   const int axis, 
    1159                                                   ObjectContainer &objectsFront, 
    1160                                                   ObjectContainer &objectsBack) 
     1169 
     1170 
     1171float BvHierarchy::EvalSahWithTigherBbox(const BvhTraversalData &tData, 
     1172                                                                                const int axis, 
     1173                                                                                ObjectContainer &objectsFront, 
     1174                                                                                ObjectContainer &objectsBack) 
    11611175{ 
    11621176        // go through the lists, count the number of objects left and right 
     
    12941308} 
    12951309 
    1296 #endif 
    12971310 
    12981311static bool PrepareOutput(const int axis, 
     
    14231436                const bool noValidSplit = (nObjectsRight <= Limits::Small); 
    14241437 
     1438#if BOUND_RENDERCOST 
    14251439                // the heuristics 
    14261440            const float sum = noValidSplit ?  
    14271441                        1e25f : volLeft * (float)nObjectsLeft + volRight * (float)nObjectsRight; 
    1428  
     1442#else 
     1443                const float rcLeft = max(nObjectsLeft, MIN_RENDERCOST); 
     1444                const float rcRight = max(nObjectsRight, MIN_RENDERCOST); 
     1445 
     1446                // the heuristics 
     1447            const float sum = noValidSplit ?  
     1448                        1e25f : volLeft * (float)rcLeft + volRight * (float)rcRight; 
     1449 
     1450#endif 
     1451                 
    14291452#ifdef GTP_DEBUG 
    14301453                if (printStats) 
     
    18421865float BvHierarchy::EvalAbsCost(const ObjectContainer &objects) 
    18431866{ 
     1867        float result; 
    18441868#if USE_BETTER_RENDERCOST_EST 
    18451869        ObjectContainer::const_iterator oit, oit_end = objects.end(); 
     
    18471871        for (oit = objects.begin(); oit != oit_end; ++ oit) 
    18481872        { 
    1849                 objRenderCost += ViewCellsManager::GetRendercost(*oit); 
     1873                result += ViewCellsManager::GetRendercost(*oit); 
    18501874        } 
    18511875#else 
    1852         return (float)objects.size(); 
     1876        result = (float)objects.size(); 
    18531877#endif 
     1878 
     1879#if BOUND_RENDERCOST 
     1880        result = max(result, MIN_RENDERCOST); 
     1881#endif 
     1882 
     1883        return result; 
    18541884} 
    18551885 
     
    18751905        /////////////// 
    18761906        //-- render cost heuristics 
     1907 
    18771908        const float objRenderCost = EvalAbsCost(objects); 
    18781909 
  • GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h

    r2224 r2227  
    1414#include "IntersectableWrapper.h" 
    1515#include "HierarchyManager.h" 
    16 #include "PerfTimer.h" 
     16#include "Timer/PerfTimer.h" 
    1717 
    1818 
     
    736736                                  ObjectContainer &objectsBack); 
    737737 
     738        float EvalSahWithTigherBbox(const BvhTraversalData &tData, 
     739                                                                const int axis, 
     740                                                                ObjectContainer &objectsFront, 
     741                                                                ObjectContainer &objectsBack); 
    738742 
    739743        /** Evaluates render cost of the bv induced by these objects 
     
    910914        */ 
    911915        int EvalPvsEntriesIncr(BvhSubdivisionCandidate &splitCandidate,  
    912                                                    const float avgRayContri, 
     916                                                   const float raysPerObjects, 
    913917                                                   const int numParentViewCells, 
    914918                                                   const int numFrontViewCells, 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp

    r2130 r2227  
    27752775                                        "true"); 
    27762776 
    2777         RegisterOption("Hierarchy.Construction.maxAvgRayContri", 
    2778                                         optFloat, 
    2779                                         "hierarchy_construction_max_avg_raycontri=", 
    2780                                         "99999.0"); 
    2781          
    2782         RegisterOption("Hierarchy.Construction.minAvgRayContri", 
    2783                                         optFloat, 
    2784                                         "hierarchy_construction_min_avg_raycontri=", 
    2785                                         "99990.0"); 
     2777        RegisterOption("Hierarchy.Construction.maxAvgRaysPerObject", 
     2778                                        optFloat, 
     2779                                        "hierarchy_construction_max_avg_rays_per_object=", 
     2780                                        "2"); 
     2781         
     2782        RegisterOption("Hierarchy.Construction.minAvgRaysPerObject", 
     2783                                        optFloat, 
     2784                                        "hierarchy_construction_min_avg_rays_per_object=", 
     2785                                        "1"); 
    27862786         
    27872787        RegisterOption("Hierarchy.useTraversalTree", 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Halton.cpp

    r2105 r2227  
    11#include "Halton.h" 
    2 #include "PerfTimer.h" 
     2#include "Timer/PerfTimer.h" 
     3 
    34 
    45#define PREGENERATE_HALTON 0 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp

    r2224 r2227  
    155155 
    156156        Environment::GetSingleton()->GetFloatValue( 
    157                 "Hierarchy.Construction.maxAvgRayContri", mMaxAvgRayContri); 
     157                "Hierarchy.Construction.maxAvgRaysPerObject", mMaxAvgRaysPerObject); 
    158158 
    159159        Environment::GetSingleton()->GetFloatValue( 
    160                 "Hierarchy.Construction.minAvgRayContri", mMinAvgRayContri); 
     160                "Hierarchy.Construction.minAvgRaysPerObject", mMinAvgRaysPerObject); 
    161161 
    162162        Environment::GetSingleton()->GetBoolValue( 
     
    177177        Debug << "max steps of same kind: " << mMaxStepsOfSameType << endl; 
    178178        Debug << "max repairs: " << mMaxRepairs << endl; 
    179         Debug << "max avg ray contribution: " << mMaxAvgRayContri << endl; 
     179        Debug << "max avg rays per object: " << mMaxAvgRaysPerObject << endl; 
     180        Debug << "mín avg rays per object: " << mMinAvgRaysPerObject << endl; 
    180181 
    181182        // for comparing it with byte - value 
     
    830831float HierarchyManager::EvalCorrectedPvs(const float childPvs,  
    831832                                                                                 const float totalPvs,  
    832                                                                                  const float avgRayContri) const 
     833                                                                                 const float avgRaysPerObjects) const 
    833834{ 
    834835        // assume pvs sampled sufficiently => take child pvs 
    835         if (avgRayContri < mMinAvgRayContri) 
     836        if (avgRaysPerObjects > mMaxAvgRaysPerObject) 
    836837        { 
    837838                return childPvs; 
    838839        } 
    839  
    840840        // assume pvs not sampled sufficiently => take total pvs 
    841         if (avgRayContri >= mMaxAvgRayContri) 
    842         { 
     841        else if (avgRaysPerObjects <= mMinAvgRaysPerObject) 
     842        { 
     843                cout << "b ";// << avgRaysPerObjects << " "; 
    843844                return totalPvs; 
    844845        } 
    845846 
    846         const float alpha = (mMaxAvgRayContri - avgRayContri) /  
    847                                                 (mMaxAvgRayContri - mMinAvgRayContri); 
    848  
    849         const float beta = (1.0f - alpha) * (totalPvs - childPvs); 
     847        const float alpha = (mMaxAvgRaysPerObject - avgRaysPerObjects) /  
     848                                                (mMaxAvgRaysPerObject - mMinAvgRaysPerObject); 
     849 
     850        /// rays per object == max threshold => alpha == 0 => newPvs is childPvs 
     851        /// rays per object == min threshold => alpha == 1 => newPvs is totalPvs 
     852         
     853        const float beta = alpha * (totalPvs - childPvs); 
    850854#if 1 
    851855        const float newPvs = childPvs + beta; 
     
    853857        const float newPvs = alpha * childPvs + (1.0f - alpha) * totalPvs; 
    854858#endif 
    855 cout<<"a"; 
     859cout << "c ";// << avgRaysPerObjects << " "; 
    856860        //cout << "alpha " << alpha << " beta: " << beta << " child: " << childPvs << " parent: " << totalPvs << endl; 
    857861         
    858862        if ((newPvs < childPvs - Limits::Small) || (newPvs > totalPvs + Limits::Small)) 
    859                 cout << "Error!! " << newPvs << endl; 
     863                cout << "Error! " << newPvs << " smaller than child pvs or larger than parent pvs" << endl; 
     864 
    860865        return newPvs; 
    861866} 
     
    892897        } 
    893898         
    894         cout << sc->Type() << " "; 
    895                  
    896899        ///////////// 
    897900        // update stats 
     
    907910        float mem = (float)ObjectPvs::GetEntrySizeByte() * pvsEntriesIncr; 
    908911 
     912#if USE_AVGRAYCONTRI 
    909913        // high avg ray contri, the result is influenced by undersampling 
    910914        // => decrease priority 
    911         if (0 && USE_AVGRAYCONTRI && (sc->GetAvgRayContribution() > mMaxAvgRayContri)) 
     915 
     916        if (sc->GetAvgRayContribution() > mMaxAvgRayContri) 
    912917        { 
    913918                const float factor = 1.0f + sc->GetAvgRayContribution() - mMaxAvgRayContri; 
     
    916921                mem *= factor; 
    917922        } 
    918          
     923#endif 
     924 
    919925        mHierarchyStats.mMemory += mem; 
    920926        mHierarchyStats.mRenderCostDecrease = sc->GetRenderCostDecrease(); 
     
    11481154 
    11491155                SubdivisionCandidate *sc = NextSubdivisionCandidate(splitQueue);  
     1156 
     1157                const bool success = ApplySubdivisionCandidate(sc, splitQueue, dirtyCandidates); 
     1158 
     1159                if (success) 
     1160                { 
     1161                        //sc->CollectDirtyCandidates(dirtyCandidates, true); 
     1162                        //if (steps % 10 == 0) 
     1163                                cout << sc->Type() << " "; 
    11501164                         
    1151                 const bool success = ApplySubdivisionCandidate(sc, splitQueue, dirtyCandidates); 
    1152  
    1153                 if (success) 
    1154                 { 
    1155                         //sc->CollectDirtyCandidates(dirtyCandidates, true); 
    11561165                        ++ steps; 
    11571166                } 
     
    14901499        SubdivisionCandidateContainer::const_iterator sit, sit_end = dirtyList.end(); 
    14911500         
    1492         for (sit = dirtyList.begin(); sit != sit_end; ++ sit) 
     1501        int i = 0; 
     1502        for (sit = dirtyList.begin(); sit != sit_end; ++ sit, ++ i) 
    14931503        { 
    14941504                // only repair a certain number of candidates 
     
    15071517                 
    15081518                ++ repaired; 
    1509                 cout << "."; 
     1519                //if (i % 10 == 0) 
     1520                        cout << "."; 
    15101521 
    15111522#ifdef GTP_DEBUG 
     
    23602371                        { 
    23612372                                ++ subStats.mViewSpaceSplits; 
    2362                                 cout << "v"; 
     2373                                //cout << "v"; 
    23632374                                //cout << "vsp t: " << timeStamp << " rc: " << rcDecr << " pvs: " << entriesIncr << endl; 
    23642375                        } 
     
    23662377                        { 
    23672378                                ++ subStats.mObjectSpaceSplits; 
    2368                                 cout << "o"; 
     2379                                //cout << "o"; 
    23692380                                //"osp t: " << timeStamp << " rc: " << rcDecr << " pvs: " << entriesIncr << endl; 
    23702381                        } 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h

    r2224 r2227  
    4747 
    4848#define COUNT_ORIGIN_OBJECTS 1 
    49 #define USE_AVGRAYCONTRI 1 
     49#define USE_AVGRAYCONTRI 0 
     50 
     51#define BOUND_RENDERCOST 0 
     52 
     53static const float MIN_RENDERCOST = 100.0f; 
     54 
    5055 
    5156 
     
    308313        float EvalCorrectedPvs(const float pvsFront,  
    309314                                                   const float totalPvs, 
    310                                                    const float avgRayContri) const; 
     315                                                   const float raysPerObjects) const; 
    311316 
    312317 
     
    607612        float mInitialRenderCost; 
    608613         
    609         float mMaxAvgRayContri; 
    610  
    611         float mMinAvgRayContri; 
     614        //float mMaxAvgRayContri; 
     615        //float mMinAvgRayContri; 
     616 
     617        float mMaxAvgRaysPerObject; 
     618        float mMinAvgRaysPerObject; 
    612619 
    613620        // quick hack: 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp

    r2210 r2227  
    77#include "RssTree.h" 
    88#include "Mutation.h" 
    9 #include "PerfTimer.h" 
     9#include "Timer/PerfTimer.h" 
    1010 
    1111 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SubdivisionCandidate.h

    r2224 r2227  
    4040        /** Evaluate this candidate and put results into queue for further traversal. 
    4141        */ 
    42         virtual bool Apply(SplitQueue &splitQueue, bool terminationCriteriaMet, SubdivisionCandidateContainer &dirtyList) = 0; 
     42        virtual bool Apply(SplitQueue &splitQueue,  
     43                                           bool terminationCriteriaMet,  
     44                                           SubdivisionCandidateContainer &dirtyList) = 0; 
    4345         
    4446        /** Returns true of the global termination criteria of this split were met, 
     
    7476        } 
    7577         
     78        /** The average ray contribution of this candidate . 
     79                This is somewhat of a confidence value into the computed values. If 
     80                it is high, there is likely to be a lot of undersampling. 
     81        */ 
     82        inline void SetAvgRaysPerObject(const float raysPerObject) 
     83        { 
     84                mAvgRaysPerObject = raysPerObject; 
     85 
     86        } 
    7687        inline float GetAvgRayContribution() const 
    7788        { 
    7889                return mAvgRayContribution; 
     90        } 
     91 
     92        /** Returns average rays per object. 
     93        */ 
     94        float GetAvgRaysPerObject() const 
     95        { 
     96                return (float)mAvgRaysPerObject; 
    7997        } 
    8098 
     
    165183        float mAvgRayContribution; 
    166184 
     185        /// the average ray contribution of this candidate  
     186        float mAvgRaysPerObject; 
     187 
    167188        int mMailbox; 
    168189 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp

    r2210 r2227  
    17661766float ViewCellsTree::GetPvsCostForLeafStorage(ViewCell *vc) const 
    17671767{ 
    1768         // pvs is always stored directly in leaves 
     1768        // pvs is already stored in the leaves 
    17691769        if (vc->IsLeaf()) 
    17701770        { 
     
    17721772        } 
    17731773         
     1774        ///////////////////////////////// 
     1775 
    17741776        // interior nodes: pvs is either stored as a  
    17751777        // scalar or has to be reconstructed from the leaves 
     
    19581960        //////////////////////////////////////////////// 
    19591961        //-- for interiors, pvs can be stored using different methods 
    1960         // 
    19611962 
    19621963        switch (mViewCellsStorage) 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r2224 r2227  
    2424#include "SamplingStrategy.h" 
    2525#include "SceneGraph.h" 
    26 #include "PerfTimer.h" 
     26#include "Timer/PerfTimer.h" 
    2727 
    2828 
     
    25172517  s<<"#AVG_REL_PVS_INCREASE\n"<<pvsStat.avgRelPvsIncrease<<endl; 
    25182518  s<<"#DEV_REL_PVS_INCREASE\n"<<pvsStat.devRelPvsIncrease<<endl; 
    2519   s<<"#MEMROY\n"<<pvsStat.mem<<endl; 
     2519  s<<"#MEMORY\n"<<pvsStat.mem<<endl; 
    25202520 
    25212521  s<<"#CONTRIBUTING_RAYS\n"<<mSamplesStat.mContributingRays<<endl; 
     
    60196019 
    60206020        ResetViewCells(); 
    6021         Debug << "\nView cells after construction:\n" << mCurrentViewCellsStats << endl; 
     6021        //Debug << "\nView cells after construction:\n" << mCurrentViewCellsStats << endl; 
    60226022 
    60236023        ////////////// 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h

    r2224 r2227  
    127127 
    128128                float mem; 
     129                float renderCostRatio; 
    129130        }; 
    130131   
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParserXerces.h

    r2176 r2227  
    1010#include <hash_map> 
    1111 
    12 #include "PerfTimer.h" 
     12#include "Timer/PerfTimer.h" 
    1313 
    1414namespace GtpVisibilityPreprocessor { 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp

    r2210 r2227  
    559559                || (data.mPvs <= mTermMinPvs) 
    560560                || (data.mProbability <= mTermMinProbability) 
    561                 //|| (data.GetAvgRayContribution() > mTermMaxRayContribution) 
    562561                || (data.mDepth >= mTermMaxDepth) 
    563562                ); 
     
    811810 
    812811        splitCandidate.SetAvgRayContribution(avgRayContri); 
    813          
     812 
     813        const float avgRaysPerObject =  
     814                (float)splitCandidate.mParentData.mRays->size() / ((float)pvs + Limits::Small); 
     815 
     816        splitCandidate.SetAvgRayContribution(avgRayContri); 
     817        splitCandidate.SetAvgRaysPerObject(avgRaysPerObject); 
     818 
    814819        // compute global decrease in render cost 
    815820        float oldRenderCost; 
     
    875880                mHierarchyManager->EvalCorrectedPvs(fPvsSize,  
    876881                                                                                        correctedOldPvs,  
    877                                                                                         splitCandidate.GetAvgRayContribution()); 
     882                                                                                        splitCandidate.GetAvgRaysPerObject()); 
    878883        splitCandidate.mCorrectedBackPvs =  
    879884                mHierarchyManager->EvalCorrectedPvs(bPvsSize,  
    880885                                                                                        correctedOldPvs,  
    881                                                                                         splitCandidate.GetAvgRayContribution()); 
     886                                                                                        splitCandidate.GetAvgRaysPerObject()); 
    882887         
    883888        splitCandidate.mFrontPvs = fPvsSize; 
     
    15361541         
    15371542        const AxisAlignedPlane &candidatePlane = sc.mSplitPlane; 
    1538         const float avgRayContri = sc.GetAvgRayContribution(); 
     1543        //const float avgRayContri = sc.GetAvgRayContribution(); 
     1544        const float avgRaysPerObject = sc.GetAvgRaysPerObject(); 
    15391545 
    15401546        ////////////////////////////////////////////// 
     
    15631569                // and back pvs with respect to the classification 
    15641570                UpdateContributionsToPvs(*ray, true, cf, pvsFront, pvsBack, totalPvs); 
     1571 
    15651572#if COUNT_ORIGIN_OBJECTS 
    15661573                UpdateContributionsToPvs(*ray, false, cf, pvsFront, pvsBack, totalPvs); 
     
    15851592        //-- evaluate render cost heuristics 
    15861593 
    1587         const float oldRenderCostRatio = (tData.mRenderCost > 0)?  
    1588                 (totalPvs / tData.mRenderCost) : 1; 
     1594        const float oldRenderCostRatio = (tData.mRenderCost > 0)? (totalPvs / tData.mRenderCost) : 1; 
    15891595 
    15901596        const float penaltyOld = tData.mCorrectedRenderCost * oldRenderCostRatio; 
    15911597 
    1592         sc.mCorrectedFrontRenderCost = mHierarchyManager->EvalCorrectedPvs(pvsFront, penaltyOld, avgRayContri); 
    1593         sc.mCorrectedBackRenderCost = mHierarchyManager->EvalCorrectedPvs(pvsBack, penaltyOld, avgRayContri); 
     1598        sc.mCorrectedFrontRenderCost = mHierarchyManager->EvalCorrectedPvs(pvsFront, penaltyOld, avgRaysPerObject); 
     1599        sc.mCorrectedBackRenderCost = mHierarchyManager->EvalCorrectedPvs(pvsBack, penaltyOld, avgRaysPerObject); 
    15941600 
    15951601        sc.mFrontRenderCost = pvsFront; 
     
    16081614        if (0) 
    16091615        cout << "vsp render cost" 
    1610                  << " avg ray contri: " << avgRayContri << " ratio: " << oldRenderCostRatio 
     1616                 << " avg rays per object: " << avgRaysPerObject << " ratio: " << oldRenderCostRatio 
    16111617                 << " parent: " << penaltyOld << " " << " old vol: " << totalPvs  
    16121618                 << " front cost: " << sc.mCorrectedFrontRenderCost << " corr. " << sc.mCorrectedFrontRenderCost 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.h

    r2224 r2227  
    1212#include "SubdivisionCandidate.h" 
    1313#include "HierarchyManager.h" 
    14 #include "PerfTimer.h" 
     14#include "Timer/PerfTimer.h" 
    1515 
    1616 
     
    393393 
    394394 
     395                /** Returns average rays per object. 
     396                */ 
     397                float GetAvgRaysPerObject() const 
     398                { 
     399                        return (float)mRays->size() / ((float)mPvs + Limits::Small); 
     400                } 
     401 
    395402                VspTraversalData(): 
    396403                        mNode(NULL), 
Note: See TracChangeset for help on using the changeset viewer.