Changeset 1703


Ignore:
Timestamp:
10/31/06 10:57:14 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing
Files:
7 edited

Legend:

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

    r1687 r1703  
    2020#SCENE=vienna 
    2121 
    22 LOG_PREFIX=../scripts/tests/i3d/$SCENE 
     22LOG_PREFIX=../scripts/tests/i3d/$SCENE-heur 
    2323 
    2424ENVIRONMENT=$SCENE.env 
     
    6161 echo "$SCENE $METHOD" 
    6262 
    63   $PROGRAM $ENVIRONMENT \ 
     63 # $PROGRAM $ENVIRONMENT \ 
    6464  -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 
    6565  -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 
     
    7878 
    7979############################################################################ 
    80 NODES=1000 
     80OBJ_SPLITS=3000 
    8181 
    82   METHOD=sequential-$NODES 
     82  METHOD=sequential-$OBJ_SPLITS 
    8383  echo "$SCENE $METHOD" 
    8484 
    85 # $PROGRAM $ENVIRONMENT \ 
     85 $PROGRAM $ENVIRONMENT \ 
    8686  -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 
    8787  -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 
     
    9090  -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 
    9191  -hierarchy_construction_type=0 \ 
    92   -bvh_term_max_leaves=$NODES 
     92  -bvh_term_max_leaves=$OBJ_SPLITS 
    9393 
    9494sh movefiles.sh $LOG_PREFIX-$METHOD 
    9595 
    9696############################################################################ 
     97OBJ_SPLITS=2000 
    9798 
    98 NODES=10000 
    99  
    100   METHOD=sequential-$NODES 
     99  METHOD=sequential-$OBJ_SPLITS 
    101100  echo "$SCENE $METHOD" 
    102101 
    103  #$PROGRAM $ENVIRONMENT \ 
     102 $PROGRAM $ENVIRONMENT \ 
    104103  -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 
    105104  -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 
     
    108107  -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 
    109108  -hierarchy_construction_type=0 \ 
    110   -bvh_term_max_leaves=$NODES 
     109  -bvh_term_max_leaves=$OBJ_SPLITS 
    111110 
    112111sh movefiles.sh $LOG_PREFIX-$METHOD 
    113112 
     113############################################################################ 
     114OBJ_SPLITS=1000 
    114115 
    115 ######################################################################## 
     116  METHOD=sequential-$OBJ_SPLITS 
     117  echo "$SCENE $METHOD" 
    116118 
    117 METHOD=gradient_simplesplit 
    118 echo "$SCENE $METHOD" 
    119  
    120 #$PROGRAM $ENVIRONMENT \ 
    121  -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 
    122  -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 
     119 $PROGRAM $ENVIRONMENT \ 
     120  -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 
     121  -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 
    123122  -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 
    124123  -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 
    125   -bvh_use_sah=true \ 
    126   -vsp_use_cost_heuristics=true \ 
    127124  -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 
    128   -hierarchy_construction_type=2 \ 
    129   -hierarchy_construction_recompute_split_on_repair=true 
     125  -hierarchy_construction_type=0 \ 
     126  -bvh_term_max_leaves=$OBJ_SPLITS 
    130127 
    131128sh movefiles.sh $LOG_PREFIX-$METHOD 
    132  
    133  
  • GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp

    r1698 r1703  
    801801        } 
    802802 
    803         const float oldRenderCost = EvalRenderCost(tData.mNode->mObjects); 
    804         const float newRenderCost = EvalRenderCost(objectsFront) + EvalRenderCost(objectsBack); 
    805  
    806         const float ratio = newRenderCost / oldRenderCost; 
    807         return ratio; 
     803        float heur = 0; 
     804 
     805        if (tData.mNode->GetBoundingBox().Size().DrivingAxis() == axis) 
     806        { 
     807                heur = -1; 
     808        } 
     809 
     810        return heur; 
    808811} 
    809812#endif 
     
    11111114#ifdef _DEBUG 
    11121115        Debug << "\n§§§§ bvh eval const decrease §§§§" << endl 
    1113                   << "back pvs: " << (int)objectsBack.size() << " front pvs: " << (int)objectsFront.size() << " total pvs: " << nTotalObjects << endl  
    1114                   << "back p: " << volBack / viewSpaceVol << " front p " << volFront / viewSpaceVol << " p: " << totalVol / viewSpaceVol << endl 
    1115                   << "old rc: " << oldRenderCost / viewSpaceVol << " new rc: " << newRenderCost / viewSpaceVol << endl 
    1116                   << "render cost decrease: " << oldRenderCost / viewSpaceVol - newRenderCost / viewSpaceVol << endl; 
     1116                  << "back pvs: " << (int)objectsBack.size() << " front pvs: "  
     1117                  << (int)objectsFront.size() << " total pvs: " << nTotalObjects << endl  
     1118                  << "back p: " << volBack / viewSpaceVol << " front p "  
     1119                  << volFront / viewSpaceVol << " p: " << totalVol / viewSpaceVol << endl 
     1120                  << "old rc: " << oldRenderCost / viewSpaceVol << " new rc: "  
     1121                  << newRenderCost / viewSpaceVol << endl 
     1122                  << "render cost decrease: "  
     1123                  << oldRenderCost / viewSpaceVol - newRenderCost / viewSpaceVol << endl; 
    11171124#endif 
    11181125 
     
    13021309                                        //-- heuristics using objects weighted by view cells volume 
    13031310                                        nCostRatio[axis] = 
    1304                                                 EvalLocalCostHeuristics(tData, axis, nFrontObjects[axis], nBackObjects[axis]); 
     1311                                                EvalLocalCostHeuristics(tData,  
     1312                                                                                                axis,  
     1313                                                                                                nFrontObjects[axis],  
     1314                                                                                                nBackObjects[axis]); 
    13051315                                } 
    13061316                                else 
     
    13081318                                        ////////////////// 
    13091319                                        //-- view cells not constructed yet     => use surface area heuristic                    
    1310                                         nCostRatio[axis] = 
    1311                                                 EvalSah(tData, axis, nFrontObjects[axis], nBackObjects[axis]); 
     1320                                        nCostRatio[axis] = EvalSah(tData,  
     1321                                                                                           axis,  
     1322                                                                                           nFrontObjects[axis],  
     1323                                                                                           nBackObjects[axis]); 
    13121324                                } 
    13131325                        } 
     
    13191331                        } 
    13201332 
    1321                         if (bestAxis == -1) 
     1333                        if ((bestAxis == -1) || (nCostRatio[axis] < nCostRatio[bestAxis])) 
    13221334                        { 
    13231335                                bestAxis = axis; 
    13241336                        } 
    1325                         else if (nCostRatio[axis] < nCostRatio[bestAxis]) 
    1326                         { 
    1327                                 bestAxis = axis; 
    1328                         }  
    13291337                } 
    13301338        } 
     
    13361344        backObjects = nBackObjects[bestAxis]; 
    13371345 
    1338         //Debug << "val: " << nCostRatio[bestAxis] << " axis: " << bestAxis << endl; 
     1346        //cout << "val: " << nCostRatio[bestAxis] << " axis: " << bestAxis << endl; 
    13391347        return nCostRatio[bestAxis]; 
    13401348} 
     
    14191427 
    14201428 
    1421 float BvHierarchy::EvalAbsCost(const ObjectContainer &objects) const 
     1429float BvHierarchy::EvalAbsCost(const ObjectContainer &objects)// const 
    14221430{ 
    14231431#if USE_BETTER_RENDERCOST_EST 
     
    14261434        for (oit = objects.begin(); oit != oit_end; ++ oit) 
    14271435        { 
    1428                 objRenderCost += mViewCellsManager->GetRendercost(*oit); 
     1436                objRenderCost += ViewCellsManager::GetRendercost(*oit); 
    14291437        } 
    14301438#else 
  • GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h

    r1698 r1703  
    609609        ///////////////////////////////// 
    610610 
    611         float EvalAbsCost(const ObjectContainer &objects) const; 
     611        static float EvalAbsCost(const ObjectContainer &objects); 
    612612 
    613613protected: 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.cpp

    r1586 r1703  
    7676 
    7777 
    78 /** Returns the the number of different objects in the leaves of the node. 
    79         We eliminate already accounted kd nodes and objects using mailboxing.  
     78/** Returns the the number of new (unmailed) objects in the leaves of the node. 
     79        We eliminate already accounted bvh nodes and objects using mailboxing.  
    8080*/ 
    8181static int EvalBvhNodeContribution(BvhIntersectable *bvhobj) 
     
    115115 
    116116                                // add #objects exclusivly in this node 
    117                                 pvs += (int)leaf->mObjects.size(); 
     117                                pvs += BvHierarchy::EvalAbsCost(leaf->mObjects); 
    118118                        } 
    119119                        else // traverse tree 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1701 r1703  
    3333#define KD_PVS_AREA (5*1e-4f) 
    3434 
     35 
     36 
    3537namespace GtpVisibilityPreprocessor { 
    3638 
     
    3840// HACK 
    3941const static bool SAMPLE_AFTER_SUBDIVISION = true; 
    40 const static bool CLAMP_TO_BOX = true; 
     42const static bool CLAMP_TO_BOX = false; 
     43 
     44int ViewCellsManager::sRenderCostEvaluationType = 0; 
     45 
    4146 
    4247template <typename T> class myless 
     
    101106        Environment::GetSingleton()->GetIntValue("ViewCells.Filter.maxSize", mMaxFilterSize); 
    102107        Environment::GetSingleton()->GetFloatValue("ViewCells.Filter.width", mFilterWidth); 
    103         Environment::GetSingleton()->GetIntValue("ViewCells.renderCostEvaluationType", mRenderCostEvaluationType); 
     108        Environment::GetSingleton()->GetIntValue("ViewCells.renderCostEvaluationType", sRenderCostEvaluationType); 
    104109 
    105110        Environment::GetSingleton()->GetBoolValue("ViewCells.exportBboxesForPvs", mExportBboxesForPvs); 
     
    179184        if (strcmp(buf, "perobject") == 0) 
    180185        { 
    181                 mRenderCostEvaluationType = ViewCellsManager::PER_OBJECT; 
    182         } 
    183         else if (strcmp(buf, "directional") == 0) 
    184         { 
    185                 mRenderCostEvaluationType = ViewCellsManager::PER_TRIANGLE; 
     186                sRenderCostEvaluationType = ViewCellsManager::PER_OBJECT; 
     187        } 
     188        else if (strcmp(buf, "pertriangle") == 0) 
     189        { 
     190                sRenderCostEvaluationType = ViewCellsManager::PER_TRIANGLE; 
    186191        } 
    187192        else  
     
    224229        Debug << "evaluate view cells: " << mEvaluateViewCells << endl; 
    225230        Debug << "sampling type: " << mSamplingType << endl; 
    226         Debug << "render cost evaluation type: " << mRenderCostEvaluationType << endl; 
     231        Debug << "render cost evaluation type: " << sRenderCostEvaluationType << endl; 
    227232        Debug << "evaluation sampling type: " << mEvaluationSamplingType << endl; 
    228233        Debug << "show visualization: " << mShowVisualization << endl; 
     
    10911096 
    10921097 
    1093 float ViewCellsManager::EvalRenderCost(Intersectable *obj) const 
    1094 { 
    1095         switch (mRenderCostEvaluationType) 
     1098float ViewCellsManager::EvalRenderCost(Intersectable *obj) //const 
     1099{ 
     1100        switch (sRenderCostEvaluationType) 
    10961101        { 
    10971102        case PER_OBJECT: 
    1098                 //cout << "perobject" << endl; 
    10991103                return 1.0f; 
    11001104         
    11011105        case PER_TRIANGLE: 
    1102                 {//cout << "pertriangle" << endl; 
     1106                { 
    11031107                        return (float)obj->NumberOfFaces(); 
    11041108                } 
     
    51875191                AxisAlignedBox3 bbox = mViewSpaceBox; 
    51885192                bbox.Scale(Vector3(0.5, 1, 0.5)); 
     5193 
    51895194                if (CLAMP_TO_BOX) 
    51905195                {        
     
    52045209                } 
    52055210 
    5206                 mHierarchyManager->ExportObjectSpaceHierarchy(exporter, objects, CLAMP_TO_BOX ? &bbox : NULL, false); 
     5211                mHierarchyManager->ExportObjectSpaceHierarchy(exporter,  
     5212                                objects, CLAMP_TO_BOX ? &bbox : NULL, false); 
    52075213                ExportViewCellsForViz(exporter, CLAMP_TO_BOX ? &bbox : NULL, GetClipPlane()); 
    52085214 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h

    r1692 r1703  
    409409        /** Evaluates the render cost of a view cell. 
    410410        */ 
    411         float EvalRenderCost(Intersectable *obj) const; 
     411        static float EvalRenderCost(Intersectable *obj); 
    412412    
    413413        /** Sets pvs size of view cell as a scalar. Used when storing pvs only in the leaves 
     
    711711        bool mViewCellsFinished; 
    712712        bool mEvaluateViewCells; 
    713         int mRenderCostEvaluationType; 
    714713 
    715714        /// if pvs should be exported with view cells 
    716715        bool mExportPvs; 
    717716 
     717        static int sRenderCostEvaluationType; 
     718 
     719        /// if view cells geometry should be used from other sources 
    718720        bool mUsePredefinedViewCells; 
    719721}; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp

    r1701 r1703  
    106106        { 
    107107                string currentFile = *sit; 
    108                 //cout << "here6 " << currentFile << endl; 
    109108                string strippedFilename; 
    110109 
Note: See TracChangeset for help on using the changeset viewer.