Ignore:
Timestamp:
05/03/07 23:23:31 (18 years ago)
Author:
mattausch
Message:

fixed new evaluation method

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

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/gi_final.env

    r2255 r2350  
    173173        } 
    174174 
    175         #showVisualization true 
    176         showVisualization false 
     175        showVisualization true 
     176        #showVisualization false 
    177177        #evaluateViewCells false 
    178178        evaluateViewCells true 
    179179         
    180180        Evaluation { 
    181                 samples         100000000 
    182                 samplesForStats 100000000 
    183                 #samples          10000000 
    184                 #samplesForStats  10000000 
     181                samples         6000000 
     182                samplesForStats 2000000 
    185183 
    186184                samplesPerPass  500000 
     
    233231        Construction {           
    234232                renderCostDecreaseWeight 0.999 
     233#               renderCostDecreaseWeight 1.0 
    235234        } 
    236235 
     
    265264        Construction { 
    266265 
    267                 samples 6000000 
     266                samples 100000 
    268267 
    269268                # type 0 = sequential computation, 1 = interleaved, 2 = gradient 
     
    280279                # minimal steps of same type: for interleaved, this is only valid for the first few splits 
    281280                minStepsOfSameType 100 
    282                 #maxStepsOfSameType 3000 
    283281                maxStepsOfSameType 900 
    284282 
     
    288286        Termination { 
    289287                # maximal number of leaves 
    290                 maxLeaves 300000 
    291 #               maxLeaves 6000 
     288                maxLeaves 10000 
    292289                # maximal memory in MB 
    293290#               maxMemory 4 
    294                 maxMemory 35 
     291                maxMemory 25 
    295292                # minimum ratio of global cost decrease 
    296293                minGlobalCostRatio -1 
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/gi_final.sh

    r2309 r2350  
    77TARGET=release 
    88 
    9 PROGRAM=../bin/$TARGET/Preprocessor.exe 
     9PROGRAM=../bin/$TARGET/Preprocessor2.exe 
     10#PROGRAM=../bin/$TARGET/Preprocessor_old.exe 
     11#PROGRAM=../bin/$TARGET/Preprocessor_itl.exe 
    1012 
    1113EXT=obj 
    12 #SCENE=vienna_cropped 
    13 #SCENE_PATH=../data/vienna 
     14SCENE=vienna_cropped 
     15SCENE_PATH=../data/vienna 
    1416 
    1517#SCENE=arena-high-lods 
    1618#SCENE_PATH=../data/Arena 
    1719 
    18 SCENE=PompeiiOne 
    19 SCENE_PATH=../data/Pompeii 
     20SCENE=soda 
     21SCENE_PATH=../data/soda 
    2022 
    2123ENVIRONMENT=gi_final.env 
    22  
    23 LOG_PREFIX=../scripts/tests/gi/$SCENE-speed 
     24LOG_PREFIX=../scripts/tests/gi/$SCENE-test 
    2425 
    2526echo "starting $TARGET mode for $SCENE scene ($PROGRAM)" 
     
    2930####################################################### 
    3031 
    31 USE_HEUR=true 
    32  METHOD=int 
    33  echo "$SCENE $METHOD" 
     32USE_HEUR=false 
     33METHOD=int-$USE_HEUR 
    3434 
    35  
     35echo "$SCENE $METHOD" 
    3636$PROGRAM $ENVIRONMENT \ 
    3737  -scene_filename=$SCENE_FILENAME \ 
     
    4040  -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 
    4141  -view_cells_filename=$LOG_PREFIX-$METHOD-viewcells.xml.gz \ 
     42  -view_cells_triangle_weight=1.0 \ 
     43  -view_cells_object_weight=0.0 \ 
    4244  -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 
    4345  -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 
     
    4648  -hierarchy_construction_min_avg_rays_per_object=0 \ 
    4749  -hierarchy_construction_max_avg_rays_per_object=0 \ 
    48   -bvh_use_sah=false \ 
     50  -bvh_use_sah=true \ 
    4951  -vsp_use_cost_heuristics=$USE_HEUR 
    5052 
    5153sh movefiles.sh $LOG_PREFIX-$METHOD 
    5254 
    53 ####################################################### 
    5455 
    55 USE_HEUR=true 
    56  METHOD=int-2 
    57  echo "$SCENE $METHOD" 
    58  
    59  
    60 $PROGRAM $ENVIRONMENT \ 
    61   -scene_filename=$SCENE_FILENAME \ 
    62   -view_cells_sampling_type=object_directional \ 
    63   -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 
    64   -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 
    65   -view_cells_filename=$LOG_PREFIX-$METHOD-viewcells.xml.gz \ 
    66   -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 
    67   -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 
    68   -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 
    69   -hierarchy_construction_type=2 \ 
    70   -hierarchy_construction_min_avg_rays_per_object=1 \ 
    71   -hierarchy_construction_max_avg_rays_per_object=10 \ 
    72   -bvh_use_sah=false \ 
    73   -vsp_use_cost_heuristics=$USE_HEUR 
    74  
    75 sh movefiles.sh $LOG_PREFIX-$METHOD 
    7656 
    7757####################################################### 
    7858 
    7959NODES=60000 
    80 #NODES=5000 
    81 USE_HEUR=true 
    82 #USE_HEUR=false 
    83    
    84 METHOD=seq-$NODES 
    85 echo "$SCENE $METHOD" 
     60USE_HEUR=false 
     61METHOD=seq-$NODES-$USE_HEUR 
     62  
     63#echo "$SCENE $METHOD" 
     64# $PROGRAM $ENVIRONMENT \ 
     65 -scene_filename=$SCENE_FILENAME \ 
     66 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 
     67 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 
     68 -view_cells_filename=$LOG_PREFIX-$METHOD-viewcells.xml.gz \ 
     69 -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 
     70 -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 
     71 -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 
     72 -hierarchy_construction_type=0 \ 
     73 -view_cells_triangle_weight=1.0 \ 
     74 -view_cells_object_weight=50.0 \ 
     75 -vsp_use_cost_heuristics=$USE_HEUR \ 
     76 -bvh_term_max_leaves=$NODES 
    8677 
    87 $PROGRAM $ENVIRONMENT \ 
    88   -scene_filename=$SCENE_FILENAME \ 
    89   -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 
    90   -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 
    91   -view_cells_filename=$LOG_PREFIX-$METHOD-viewcells.xml.gz \ 
    92   -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 
    93   -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 
    94   -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 
    95   -hierarchy_construction_type=0 \ 
    96   -hierarchy_construction_consider_memory=false \ 
    97   -vsp_use_cost_heuristics=$USE_HEUR \ 
    98   -bvh_term_max_leaves=$NODES 
     78#sh movefiles.sh $LOG_PREFIX-$METHOD 
    9979 
    100 sh movefiles.sh $LOG_PREFIX-$METHOD 
    101  
    102  
    103 ####################################################### 
    104  
    105 NODES=10000 
    106 USE_HEUR=true 
    107 #USE_HEUR=false 
    108    
    109 METHOD=seq-$NODES 
    110 echo "$SCENE $METHOD" 
    111  
    112 $PROGRAM $ENVIRONMENT \ 
    113   -scene_filename=$SCENE_FILENAME \ 
    114   -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 
    115   -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 
    116   -view_cells_filename=$LOG_PREFIX-$METHOD-viewcells.xml.gz \ 
    117   -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 
    118   -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 
    119   -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 
    120   -hierarchy_construction_type=0 \ 
    121   -hierarchy_construction_consider_memory=false \ 
    122   -vsp_use_cost_heuristics=$USE_HEUR \ 
    123   -bvh_term_max_leaves=$NODES 
    124  
    125 sh movefiles.sh $LOG_PREFIX-$METHOD 
  • GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp

    r2347 r2350  
    693693                AssociateViewCellsWithObjects(*tData.mSampledObjects); 
    694694 
    695                 EvalSubdivisionCandidate2(*frontCandidate, true, false); 
    696                 cout << "\nfc2: " << frontCandidate->GetPriority() << endl; 
    697695                EvalSubdivisionCandidate(*frontCandidate, true, false); 
    698                 cout << "fc1: " << frontCandidate->GetPriority() << endl; 
    699696                EvalSubdivisionCandidate(*backCandidate, true, false); 
    700697 
     
    789786 
    790787 
    791 void BvHierarchy::EvalSubdivisionCandidate2(BvhSubdivisionCandidate &splitCandidate,  
     788void BvHierarchy::EvalSubdivisionCandidate(BvhSubdivisionCandidate &splitCandidate,  
    792789                                                                                   const bool computeSplitPlane, 
    793790                                                                                   const bool preprocessViewCells) 
     
    890887        } 
    891888 
    892         //cout << "pvol: " << parentVol << " front: " << volFront << " back: " << volBack << " diff: " <<  parentVol - volFront - volBack << endl; 
    893          
    894889 
    895890        ///////////////////// 
     
    936931        const int backTri = (int)splitCandidate.mBackObjects.size(); 
    937932         
    938         if (totalTri - frontTri - backTri != 0) 
    939                 cout << "big error!!!" << endl; 
    940933 
    941934        // compute render cost decrease in the view cells which can see the object 
     
    980973                oldRenderCost += oldRc * vc->GetVolume() / viewSpaceVol; 
    981974                newRenderCost += newRc * vc->GetVolume() / viewSpaceVol; 
    982                 //cout << "old rc=" << oldRenderCost << " new rc " << newRenderCost << endl; 
    983         } 
    984  
    985  
    986         const float dummyFrontVol = EvalViewCellsVolume(splitCandidate.mSampledFrontObjects) / viewSpaceVol; 
    987         const float dummyBackVol = EvalViewCellsVolume(splitCandidate.mSampledBackObjects) / viewSpaceVol; 
    988         const float dummyParentVol = EvalViewCellsVolume(leaf->mObjects) / viewSpaceVol; 
    989  
    990         const int dummyNumFrontViewCells = CountViewCells(splitCandidate.mSampledFrontObjects); 
    991         const int dummyNumBackViewCells = CountViewCells(splitCandidate.mSampledBackObjects); 
    992         const int dummyPvs = CountViewCells(*tData.mSampledObjects); 
    993          
    994         const int dummyPvsEntriesIncr = - dummyPvs + dummyNumFrontViewCells + dummyNumBackViewCells; 
    995  
    996         const float relfrontCost = dummyFrontVol * (float)splitCandidate.mFrontObjects.size(); 
    997         const float relBackCost =  dummyBackVol * (float)splitCandidate.mBackObjects.size(); 
    998         const float relParentCost = dummyParentVol * (float)leaf->mObjects.size(); 
    999  
    1000         // compute global decrease in render cost 
    1001         const float dummyNewRenderCost = relfrontCost + relBackCost; 
    1002         const float dummyRenderCostDecr = relParentCost - dummyNewRenderCost; 
    1003  
     975        } 
    1004976 
    1005977 
     
    1011983        splitCandidate.SetRenderCostDecrease(renderCostDecr); 
    1012984         
    1013         float pseudoOldRenderCost = parentVol * (float)leaf->mObjects.size() / viewSpaceVol; 
    1014  
    1015         //cout << "cor. entries: " << dummyPvsEntriesIncr << " entries: " << frontAndBackViewCells << endl; 
    1016         cout << "\nv1: " << renderCostDecr << " " << pseudoOldRenderCost << " " << newRenderCost << endl; 
    1017         cout << "v2: " << dummyRenderCostDecr << " " << relParentCost << " " << dummyNewRenderCost << endl; 
     985        const float pseudoOldRenderCost = parentVol * (float)leaf->mObjects.size() / viewSpaceVol; 
    1018986 
    1019987        // at last computed priority based on render cost reduction / memory increase 
    1020988        const float priority = EvalPriority(splitCandidate, renderCostDecr,     pseudoOldRenderCost); 
    1021         cout << "\nfc0: " << priority << endl; 
    1022         const float priority2 = EvalPriority(splitCandidate, dummyRenderCostDecr, relParentCost); 
    1023         splitCandidate.SetPriority(priority2); 
    1024  
    1025 #if STORE_VIEWCELLS_WITH_BVH 
    1026         if (preprocessViewCells) 
    1027                 ReleaseViewCells(*splitCandidate.mParentData.mSampledObjects); 
    1028 #endif 
    1029  
    1030         mEvalTimer.Exit(); 
    1031 } 
    1032  
    1033  
    1034 void BvHierarchy::EvalSubdivisionCandidate(BvhSubdivisionCandidate &splitCandidate,  
    1035                                                                                    const bool computeSplitPlane, 
    1036                                                                                    const bool preprocessViewCells) 
    1037 { 
    1038         mPlaneTimer.Entry(); 
    1039  
    1040 #if STORE_VIEWCELLS_WITH_BVH 
    1041         if (preprocessViewCells) // fill view cells cache 
    1042                 AssociateViewCellsWithObjects(*splitCandidate.mParentData.mSampledObjects); 
    1043 #endif 
    1044  
    1045         if (computeSplitPlane) 
    1046         { 
    1047                 splitCandidate.mFrontObjects.clear(); 
    1048                 splitCandidate.mBackObjects.clear(); 
    1049                 splitCandidate.mSampledFrontObjects.clear(); 
    1050                 splitCandidate.mSampledBackObjects.clear(); 
    1051  
    1052                 const bool sufficientSamples =  
    1053                         splitCandidate.mParentData.mNumRays > mMinRaysForVisibility; 
    1054  
    1055                 //if (!sufficientSamples) cout << splitCandidate.mParentData.mNumRays << " "; 
    1056  
    1057                 const bool useVisibiliyBasedHeuristics =  
    1058                                         !mUseSah && 
    1059                                         (mHierarchyManager->GetViewSpaceSubdivisionType() ==  
    1060                                         HierarchyManager::KD_BASED_VIEWSPACE_SUBDIV) && 
    1061                                         sufficientSamples; 
    1062  
    1063                 // compute best object partition 
    1064                 const float ratio =     SelectObjectPartition(splitCandidate.mParentData,  
    1065                                                                                                   splitCandidate.mFrontObjects,  
    1066                                                                                                   splitCandidate.mBackObjects, 
    1067                                                                                                   useVisibiliyBasedHeuristics); 
    1068          
    1069                 // cost ratio violated? 
    1070                 const bool maxCostRatioViolated = mTermMaxCostRatio < ratio; 
    1071                 const int previousMisses = splitCandidate.mParentData.mMaxCostMisses; 
    1072  
    1073                 splitCandidate.SetMaxCostMisses(maxCostRatioViolated ?  
    1074                                                                                 previousMisses + 1 : previousMisses); 
    1075  
    1076                 StoreSampledObjects(splitCandidate.mSampledFrontObjects, splitCandidate.mFrontObjects); 
    1077                 StoreSampledObjects(splitCandidate.mSampledBackObjects, splitCandidate.mBackObjects); 
    1078         } 
    1079  
    1080         mPlaneTimer.Exit(); 
    1081  
    1082         mEvalTimer.Entry(); 
    1083  
    1084         const BvhTraversalData &tData = splitCandidate.mParentData; 
    1085         BvhLeaf *leaf = tData.mNode; 
    1086  
    1087         // avg contribution of a ray to a pvs 
    1088         const float pvs = (float)CountViewCells(*tData.mSampledObjects); 
    1089         //const float avgRayContri = AvgRayContribution((int)pvs, tData.mNumRays); 
    1090         const float avgRaysPerObject = AvgRaysPerObject((int)pvs, tData.mNumRays); 
    1091  
    1092         // high avg ray contri, the result is influenced by undersampling 
    1093         splitCandidate.SetAvgRaysPerObject(avgRaysPerObject); 
    1094         const float viewSpaceVol = GetViewSpaceVolume(); 
    1095  
    1096         const float oldVolume = EvalViewCellsVolume(*tData.mSampledObjects) / viewSpaceVol; 
    1097         const float oldRatio = (tData.mVolume > 0) ? oldVolume / tData.mVolume : 1; 
    1098         const float parentVol = tData.mCorrectedVolume * oldRatio; 
    1099  
    1100         // this leaf is a pvs entry in all the view cells 
    1101         // that see one of the objects. 
    1102         splitCandidate.mVolumeFrontViewCells = EvalViewCellsVolume(splitCandidate.mSampledFrontObjects) / viewSpaceVol; 
    1103         splitCandidate.mVolumeBackViewCells = EvalViewCellsVolume(splitCandidate.mSampledBackObjects) / viewSpaceVol; 
    1104  
    1105         splitCandidate.mNumFrontViewCells = CountViewCells(splitCandidate.mSampledFrontObjects); 
    1106         splitCandidate.mNumBackViewCells = CountViewCells(splitCandidate.mSampledBackObjects); 
    1107  
    1108         splitCandidate.mCorrectedFrontVolume =  
    1109                 mHierarchyManager->EvalCorrectedPvs(splitCandidate.mVolumeFrontViewCells, parentVol, avgRaysPerObject); 
    1110          
    1111         splitCandidate.mCorrectedBackVolume =  
    1112                 mHierarchyManager->EvalCorrectedPvs(splitCandidate.mVolumeBackViewCells, parentVol, avgRaysPerObject); 
    1113  
    1114 #if 0 
    1115         const float relfrontCost = splitCandidate.mCorrectedFrontVolume * splitCandidate.mFrontObjects.size(); 
    1116         const float relBackCost =  splitCandidate.mCorrectedBackVolume * splitCandidate.mBackObjects.size(); 
    1117         const float relParentCost = parentVol * leaf->mObjects.size(); 
    1118 #else 
    1119         const float relfrontCost = splitCandidate.mVolumeFrontViewCells * splitCandidate.mFrontObjects.size(); 
    1120         const float relBackCost =  splitCandidate.mVolumeBackViewCells * splitCandidate.mBackObjects.size(); 
    1121         const float relParentCost = oldVolume * leaf->mObjects.size(); 
    1122 #endif 
    1123         // compute global decrease in render cost 
    1124         const float newRenderCost = relfrontCost + relBackCost; 
    1125         const float renderCostDecr = relParentCost - newRenderCost; 
    1126          
    1127         splitCandidate.SetRenderCostDecrease(renderCostDecr); 
    1128  
    1129         // increase in pvs entries 
    1130         const int pvsEntriesIncr = EvalPvsEntriesIncr(splitCandidate,  
    1131                                                                                                   avgRaysPerObject,  
    1132                                                                                                   (int)pvs,  
    1133                                                                                                   splitCandidate.mNumFrontViewCells,  
    1134                                                                                                   splitCandidate.mNumBackViewCells); 
    1135  
    1136         splitCandidate.SetPvsEntriesIncr(pvsEntriesIncr); 
    1137  
    1138 #ifdef GTP_DEBUG 
    1139         Debug << "old render cost: " << oldRenderCost << endl; 
    1140         Debug << "new render cost: " << newRenderCost << endl; 
    1141         Debug << "render cost decrease: " << renderCostDecr << endl; 
    1142 #endif 
    1143  
    1144         float priority = EvalPriority(splitCandidate,  
    1145                                                                   renderCostDecr, 
    1146                                                                   relParentCost); 
    1147  
    1148         // compute global decrease in render cost 
    1149989        splitCandidate.SetPriority(priority); 
    1150990 
  • GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h

    r2347 r2350  
    579579                                                                  const bool preprocessViewCells); 
    580580 
    581         void EvalSubdivisionCandidate2(BvhSubdivisionCandidate &splitData, 
    582                                                                   const bool computeSplitPlane, 
    583                                                                   const bool preprocessViewCells); 
    584  
    585581        /** Returns vector of leaves. 
    586582        */ 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp

    r2347 r2350  
    3131#define HACK_PERFORMANCE 1 
    3232 
    33 #define HAS_TO_BE_REDONE 0 
    3433 
    3534///////////// 
     
    849848        splitCandidate.mBackPvs = (float)sData.mBackObjects; 
    850849 
    851 #if HAS_TO_BE_REDONE 
    852850        return (int)(splitCandidate.mCorrectedFrontPvs + splitCandidate.mCorrectedBackPvs - correctedOldPvs); 
    853 #else 
    854         return sData.mFrontObjects + sData.mBackObjects - sData.mTotalObjects; 
    855 #endif 
    856851} 
    857852 
     
    16271622        sc.mBackRenderCost = sData.mBackRenderCost; 
    16281623 
    1629 #if HAS_TO_BE_REDONE // undersampling evalution does not work yet 
    1630  
    16311624        const float oldRenderCost = penaltyOld * pOverall; 
    16321625        const float newRenderCost = sc.mCorrectedFrontRenderCost * pFront +  
    16331626                                                                sc.mCorrectedBackRenderCost * pBack; 
    16341627 
    1635 #else 
    1636  
    1637         const float oldRenderCost = sData.mTotalRenderCost * pOverall; 
    1638         const float newRenderCost = sData.mFrontRenderCost * pFront + sData.mBackRenderCost * pBack; 
    1639  
    1640 #endif 
    16411628 
    16421629        // the normalized old render cost is needed for the priority 
Note: See TracChangeset for help on using the changeset viewer.