Changeset 1642 for GTP/trunk


Ignore:
Timestamp:
10/19/06 03:53:51 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing
Files:
5 edited

Legend:

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

    r1640 r1642  
    225225        Construction { 
    226226 
    227                 samples 100000 
     227                samples 200000 
    228228 
    229229                # type 0 = sequential computation, 1 = interleaved, 2 = gradient 
     
    248248 
    249249                # number of iteration steps 
    250                 levels 4 
     250                levels 3 
    251251 
    252252                # minimal steps of same type: for interleaved, this is only valid for the first few splits 
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/vsposp_typical.sh

    r1640 r1642  
    2626 
    2727 
    28 METHOD=interleaved_full 
    29 echo "$SCENE $METHOD" 
     28# METHOD=interleaved_full 
     29# echo "$SCENE $METHOD" 
    3030 
    31 $PROGRAM $ENVIRONMENT \ 
    32 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 
    33 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 
    34 -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 
    35 -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 
    36 -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 
    37 -hierarchy_construction_type=1 \ 
    38 -hierarchy_construction_recompute_split_on_repair=true 
     31# $PROGRAM $ENVIRONMENT \ 
     32# -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 
     33# -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 
     34# -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 
     35# -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 
     36# -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 
     37# -hierarchy_construction_type=1 \ 
     38# -hierarchy_construction_recompute_split_on_repair=true 
    3939 
    40 mv debug.log $LOG_PREFIX-$METHOD-debug.log 
    41 mv view_cells.wrl $LOG_PREFIX-$METHOD-view_cells.wrl 
    42 mv final_object_partition.wrl $LOG_PREFIX-$METHOD-final_object_partition.wrl 
    43 mv final_view_cells.wrl $LOG_PREFIX-$METHOD-final_view_cells.wrl 
     40# mv debug.log $LOG_PREFIX-$METHOD-debug.log 
     41# mv view_cells.wrl $LOG_PREFIX-$METHOD-view_cells.wrl 
     42# mv final_object_partition.wrl $LOG_PREFIX-$METHOD-final_object_partition.wrl 
     43# mv final_view_cells.wrl $LOG_PREFIX-$METHOD-final_view_cells.wrl 
    4444 
    4545 
    46 METHOD=interleaved 
    47 echo "$SCENE $METHOD" 
     46# METHOD=interleaved 
     47# echo "$SCENE $METHOD" 
    4848 
    49 $PROGRAM $ENVIRONMENT \ 
    50 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 
    51 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 
    52 -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 
    53 -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 
    54 -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 
    55 -hierarchy_construction_type=1 \ 
    56 -hierarchy_construction_recompute_split_on_repair=false 
     49# $PROGRAM $ENVIRONMENT \ 
     50# -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 
     51# -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 
     52# -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 
     53# -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 
     54# -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 
     55# -hierarchy_construction_type=1 \ 
     56# -hierarchy_construction_recompute_split_on_repair=false 
    5757 
    58 mv debug.log $LOG_PREFIX-$METHOD-debug.log 
    59 mv view_cells.wrl $LOG_PREFIX-$METHOD-view_cells.wrl 
    60 mv final_object_partition.wrl $LOG_PREFIX-$METHOD-final_object_partition.wrl 
    61 mv final_view_cells.wrl $LOG_PREFIX-$METHOD-final_view_cells.wrl 
     58# mv debug.log $LOG_PREFIX-$METHOD-debug.log 
     59# mv view_cells.wrl $LOG_PREFIX-$METHOD-view_cells.wrl 
     60# mv final_object_partition.wrl $LOG_PREFIX-$METHOD-final_object_partition.wrl 
     61# mv final_view_cells.wrl $LOG_PREFIX-$METHOD-final_view_cells.wrl 
    6262 
    6363 
    64 METHOD=gradient 
    65 echo "$SCENE $METHOD" 
     64# METHOD=gradient 
     65# echo "$SCENE $METHOD" 
    6666 
    67 $PROGRAM $ENVIRONMENT \ 
    68 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 
    69 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 
    70 -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 
    71 -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 
    72 -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 
    73 -hierarchy_construction_type=2 \ 
    74 -hierarchy_construction_recompute_split_on_repair=true 
     67# $PROGRAM $ENVIRONMENT \ 
     68# -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 
     69# -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 
     70# -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 
     71# -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 
     72# -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 
     73# -hierarchy_construction_type=2 \ 
     74# -hierarchy_construction_recompute_split_on_repair=true 
    7575 
    76 mv debug.log $LOG_PREFIX-$METHOD-debug.log 
    77 mv view_cells.wrl $LOG_PREFIX-$METHOD-view_cells.wrl 
    78 mv final_object_partition.wrl $LOG_PREFIX-$METHOD-final_object_partition.wrl 
    79 mv final_view_cells.wrl $LOG_PREFIX-$METHOD-final_view_cells.wrl 
     76# mv debug.log $LOG_PREFIX-$METHOD-debug.log 
     77# mv view_cells.wrl $LOG_PREFIX-$METHOD-view_cells.wrl 
     78# mv final_object_partition.wrl $LOG_PREFIX-$METHOD-final_object_partition.wrl 
     79# mv final_view_cells.wrl $LOG_PREFIX-$METHOD-final_view_cells.wrl 
     80 
     81 METHOD=multilevel 
     82 echo "$SCENE $METHOD" 
     83 
     84 $PROGRAM $ENVIRONMENT \ 
     85 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 
     86 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 
     87 -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 
     88 -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 
     89 -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 
     90 -hierarchy_construction_type=2 \ 
     91 -hierarchy_construction_multilevel=true \ 
     92 -hierarchy_construction_samples=20000 \ 
     93 -hierarchy_term_max_leaves=500 \ 
     94 -hierarchy_construction_levels=1 \ 
     95 -hierarchy_construction_recompute_split_on_repair=true 
     96 
     97 mv debug.log $LOG_PREFIX-$METHOD-debug.log 
     98 mv view_cells.wrl $LOG_PREFIX-$METHOD-view_cells.wrl 
     99 mv final_object_partition.wrl $LOG_PREFIX-$METHOD-final_object_partition.wrl 
     100 mv final_view_cells.wrl $LOG_PREFIX-$METHOD-final_view_cells.wrl 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp

    r1640 r1642  
    24682468        RegisterOption("Hierarchy.Construction.samples", 
    24692469                                        optInt, 
    2470                                         "vsp_construction_samples=", 
     2470                                        "hierarchy_construction_samples=", 
    24712471                                        "100000"); 
    2472  
    24732472 
    24742473        RegisterOption("Hierarchy.subdivisionStats", 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp

    r1640 r1642  
    311311                break; 
    312312        } 
     313 
     314        // hack: should be different parameter name 
     315        if (mUseMultiLevelConstruction) 
     316        { 
     317                cout << "starting optimizing multilevel ... " << endl; 
     318                // try to optimize on the above hierarchy 
     319                OptimizeMultiLevel(sampleRays, objects, forcedViewSpace); 
     320                 
     321                cout << "finished" << endl; 
     322        } 
    313323} 
    314324 
     
    376386        viewSpaceQueue.Push(vsc); 
    377387         
    378         // view space subdivision was constructed 
     388        // view space subdivision started 
    379389        mViewSpaceSubdivisionType = mSavedViewSpaceSubdivisionType; 
    380390 
     
    828838void HierarchyManager::RunConstruction(const bool repairQueue) 
    829839{ 
    830         //int i = 0; 
    831840        // main loop 
    832841        while (!FinishedConstruction()) 
    833842        { 
    834843                SubdivisionCandidate *sc = NextSubdivisionCandidate(mTQueue);     
    835                          
     844                cout << "p=" << sc->GetPriority() << " "; 
     845 
    836846                //////// 
    837847                //-- subdivide leaf node of either type 
    838                 ApplySubdivisionCandidate(sc, mTQueue, repairQueue); 
     848        ApplySubdivisionCandidate(sc, mTQueue, repairQueue); 
     849        //cout << "\nhere45 " << sc->GetPriority() << " " << sc->GetRenderCostDecrease() << " " << mObjectSpaceSubdivisionType << " " << mViewSpaceSubdivisionType << endl; 
     850                 
    839851                DEL_PTR(sc); 
    840852        } 
     
    883895                                                                                                                                        const ObjectContainer &objects) 
    884896{        
    885         // no object space subdivision yet 
    886         if (!ObjectSpaceSubdivisionConstructed()) 
    887         { 
    888                 return PrepareObjectSpaceSubdivision(sampleRays, objects); 
    889         } 
    890  
    891897        SubdivisionCandidate *firstCandidate; 
    892898 
     
    898904                        cout << "\nreseting bv hierarchy" << endl; 
    899905                        Debug << "old bv hierarchy:\n " << mBvHierarchy->mBvhStats << endl; 
    900          
     906 
     907                        mBvHierarchy->Initialise(objects); 
     908 
     909                        // rather use this: remove previous nodes and add the two new ones 
     910                        //mHierarchyStats.mNodes -= mBvHierarchy->mBvhStats.nodes + 2; 
     911                        mHierarchyStats.mNodes = 2; 
     912 
    901913                        firstCandidate = mBvHierarchy->Reset(sampleRays, objects); 
    902914                 
    903915                        mHierarchyStats.mTotalCost = mBvHierarchy->mTotalCost; 
    904                          
    905                         // bug!! pvs entries could be much higher at this stage 
    906                         mHierarchyStats.mNodes = 2; 
     916                        mHierarchyStats.mRenderCostDecrease = 0; 
     917 
     918                        // bug!! pvs entries cab be much higher at this stage 
     919                        // (if view space was already subdivided) 
    907920                        mHierarchyStats.mPvsEntries = 1; 
    908                         mHierarchyStats.mRenderCostDecrease = 0; 
     921                        mHierarchyStats.mMemory = sizeof(PvsData) + sizeof(Intersectable *) / (1024.0f * 1024.0f); 
    909922 
    910923                        // evaluate stats before first subdivision 
     
    925938 
    926939SubdivisionCandidate *HierarchyManager::ResetViewSpaceSubdivision(const VssRayContainer &sampleRays,  
    927                                                                                                                                   const ObjectContainer &objects) 
     940                                                                                                                                  const ObjectContainer &objects, 
     941                                                                                                                                  AxisAlignedBox3 *forcedViewSpace) 
    928942{ 
    929943        ViewCellsManager *vc = mVspTree->mViewCellsManager; 
     
    933947        mVspTree = new VspTree(); 
    934948        mVspTree->mHierarchyManager = this; 
    935         mVspTree->mViewCellsManager = vc; 
    936  
    937         SubdivisionCandidate *vsc = PrepareViewSpaceSubdivision(sampleRays, objects); 
     949 
     950        mVspTree->Initialise(sampleRays, forcedViewSpace); 
     951         
     952        SubdivisionCandidate *vsc =  
     953                PrepareViewSpaceSubdivision(sampleRays, objects); 
    938954         
    939955        mHierarchyStats.mNodes = 2; 
     
    969985        // use sah for evaluating osp tree construction  
    970986        // in the first iteration of the subdivision 
    971          
     987 
    972988        mSavedViewSpaceSubdivisionType = mViewSpaceSubdivisionType; 
    973989        mViewSpaceSubdivisionType = NO_VIEWSPACE_SUBDIV; 
    974990 
    975         mSavedObjectSpaceSubdivisionType = mObjectSpaceSubdivisionType; 
    976         mObjectSpaceSubdivisionType = NO_OBJ_SUBDIV; 
     991        SubdivisionCandidate *osc =  
     992                PrepareObjectSpaceSubdivision(sampleRays, objects); 
     993        mTQueue.Push(osc); 
     994 
     995        //////////////////////////7 
     996 
    977997 
    978998        const int limit = mNumMultiLevels; 
     
    9911011 
    9921012                // subdivide object space first 
    993                 ResetObjectSpaceSubdivision(sampleRays, objects); 
     1013                osc = ResetObjectSpaceSubdivision(sampleRays, objects); 
     1014                mTQueue.Push(osc); 
    9941015 
    9951016                // process object space candidates 
     
    10121033                // subdivide view space with respect to the objects 
    10131034 
    1014                 SubdivisionCandidate *vspVc = ResetViewSpaceSubdivision(sampleRays, objects); 
     1035                SubdivisionCandidate *vspVc = ResetViewSpaceSubdivision(sampleRays, objects, forcedViewSpace); 
    10151036                mTQueue.Push(vspVc); 
    10161037 
     
    10181039                mViewSpaceSubdivisionType = mSavedViewSpaceSubdivisionType; 
    10191040                 
    1020  
    10211041                // process view space candidates 
    10221042                RunConstruction(false); 
     
    10311051         
    10321052        cout << "\nfinished in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 
    1033  
    1034 /*#if _DEBUG 
    1035         cout << "view space: " << GetViewSpaceBox() << endl; 
    1036         cout << "object space:  " << GetObjectSpaceBox() << endl; 
    1037 #endif*/ 
    10381053 
    10391054        mHierarchyStats.Stop(); 
     
    10471062                                                                                  AxisAlignedBox3 *forcedViewSpace) 
    10481063{ 
    1049         mHierarchyStats.Reset(); 
    1050         mHierarchyStats.Start(); 
    1051         mHierarchyStats.mNodes = 2; 
    1052          
    1053         mHierarchyStats.mTotalCost = (float)objects.size(); 
    1054         Debug << "setting total cost to " << mHierarchyStats.mTotalCost << endl; 
     1064        // assume object space subdivision constructed 
     1065        //mObjectSpaceSubdivisionType = mSavedObjectSpaceSubdivisionType; 
     1066 
     1067        // set the number of leaves 'evaluated' from the previous methods 
     1068        // we go for the same numbers, but we try to optimize both 
     1069        // subdivisions 
     1070        switch (mObjectSpaceSubdivisionType) 
     1071        { 
     1072        case BV_BASED_OBJ_SUBDIV: 
     1073                mBvHierarchy->mTermMaxLeaves = mBvHierarchy->mBvhStats.Leaves(); 
     1074                break; 
     1075        case KD_BASED_OBJ_SUBDIV: 
     1076                mOspTree->mTermMaxLeaves = mOspTree->mOspStats.Leaves(); 
     1077        default: 
     1078                break; 
     1079        } 
     1080         
     1081        mVspTree->mMaxViewCells = mVspTree->mVspStats.Leaves(); 
    10551082 
    10561083        const long startTime = GetTime(); 
    1057         cout << "Constructing view space / object space tree ... \n"; 
    1058          
    1059         // initialise view / object space 
    1060         mVspTree->Initialise(sampleRays, forcedViewSpace); 
    1061         InitialiseObjectSpaceSubdivision(objects); 
    1062  
    1063         // use sah for evaluating osp tree construction  
    1064         // in the first iteration of the subdivision 
    1065          
    1066         mSavedViewSpaceSubdivisionType = mViewSpaceSubdivisionType; 
    1067         mViewSpaceSubdivisionType = NO_VIEWSPACE_SUBDIV; 
    1068  
    1069         mSavedObjectSpaceSubdivisionType = mObjectSpaceSubdivisionType; 
    1070         mObjectSpaceSubdivisionType = NO_OBJ_SUBDIV; 
    1071  
    10721084        const int limit = mNumMultiLevels; 
    1073         int i = 0; 
     1085 
     1086        // open up new subdivision 
     1087        mSubdivisionStats.close(); 
     1088 
     1089        int steps = 0; 
    10741090 
    10751091        // This method subdivides view space / object space  
     
    10811097        { 
    10821098                char subdivisionStatsLog[100]; 
    1083                 sprintf(subdivisionStatsLog, "tests/i3d/subdivision-%04d.log", i); 
     1099                sprintf(subdivisionStatsLog, "tests/i3d/subdivision-%04d.log", steps); 
    10841100                mSubdivisionStats.open(subdivisionStatsLog); 
    10851101 
    10861102                // subdivide object space first 
    1087                 ResetObjectSpaceSubdivision(sampleRays, objects); 
     1103                SubdivisionCandidate *ospVc = ResetObjectSpaceSubdivision(sampleRays, objects); 
     1104                mTQueue.Push(ospVc); 
    10881105 
    10891106                // process object space candidates 
    10901107                RunConstruction(false); 
    10911108 
    1092                 // object space subdivision constructed 
    1093                 mObjectSpaceSubdivisionType = mSavedObjectSpaceSubdivisionType; 
    1094  
    1095                 cout << "iteration " << i << " of " << limit << " finished" << endl; 
     1109                cout << "iteration " << steps << " of " << limit << " finished" << endl; 
    10961110 
    10971111                mSubdivisionStats.close(); 
    10981112 
    1099                 if ((i ++) >= limit) 
     1113                if ((++ steps) >= limit) 
    11001114                        break; 
    11011115 
    1102                 sprintf(subdivisionStatsLog, "tests/i3d/subdivision-%04d.log", i); 
     1116                sprintf(subdivisionStatsLog, "tests/i3d/subdivision-%04d.log", steps); 
    11031117                mSubdivisionStats.open(subdivisionStatsLog); 
    11041118 
     
    11061120                // subdivide view space with respect to the objects 
    11071121 
    1108                 SubdivisionCandidate *vspVc = ResetViewSpaceSubdivision(sampleRays, objects); 
     1122                SubdivisionCandidate *vspVc = ResetViewSpaceSubdivision(sampleRays, objects, forcedViewSpace); 
    11091123                mTQueue.Push(vspVc); 
    1110  
    1111                 // view space subdivision constructed 
    1112                 mViewSpaceSubdivisionType = mSavedViewSpaceSubdivisionType; 
    1113                  
    11141124 
    11151125                // process view space candidates 
    11161126                RunConstruction(false); 
    11171127 
    1118                 cout << "iteration " << i << " of " << limit << " finished" << endl; 
     1128                cout << "iteration " << steps << " of " << limit << " finished" << endl; 
    11191129 
    11201130                mSubdivisionStats.close(); 
    11211131 
    1122                 if ((i ++) >= limit) 
     1132                if ((++ steps) >= limit) 
    11231133                        break; 
    11241134        } 
    11251135         
    11261136        cout << "\nfinished in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 
    1127  
    1128 /*#if _DEBUG 
    1129         cout << "view space: " << GetViewSpaceBox() << endl; 
    1130         cout << "object space:  " << GetObjectSpaceBox() << endl; 
    1131 #endif*/ 
    11321137 
    11331138        mHierarchyStats.Stop(); 
     
    11461151bool HierarchyManager::ObjectSpaceSubdivisionConstructed() const 
    11471152{ 
    1148         switch (mObjectSpaceSubdivisionType) 
     1153        /*switch (mObjectSpaceSubdivisionType) 
    11491154        { 
    11501155        case KD_BASED_OBJ_SUBDIV: 
     
    11541159        default: 
    11551160                return false; 
    1156         } 
     1161        }*/ 
     1162        return mObjectSpaceSubdivisionType != NO_OBJ_SUBDIV; 
    11571163} 
    11581164 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h

    r1640 r1642  
    427427 
    428428        SubdivisionCandidate *ResetViewSpaceSubdivision(const VssRayContainer &rays,  
    429                                                                                                         const ObjectContainer &objects); 
     429                                                                                                        const ObjectContainer &objects, 
     430                                                                                                        AxisAlignedBox3 *forcedViewSpace); 
    430431 
    431432 
Note: See TracChangeset for help on using the changeset viewer.