Changeset 2072


Ignore:
Timestamp:
02/01/07 17:38:55 (17 years ago)
Author:
mattausch
Message:

prepared view cell generation that is useable.
changed back view cell generation to vsp osp.

Location:
GTP/trunk/Lib/Vis/Preprocessing
Files:
1 added
5 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/manual/integration.tex

    r2068 r2072  
    3030Important options for performance are 
    3131 
    32 \begin{verbatim} 
    33 VspBspTree.Construction.samples 
    34 VspBspTree.Termination.maxViewCells 
     32%\begin{verbatim} 
     33%VspBspTree.Construction.samples 
     34%VspBspTree.Termination.maxViewCells 
     35%\end{verbatim} 
     36 
     37\begin{verbatim} 
     38VspTree.Termination.maxLeaves 
     39Hierarchy.Construction.samples 
    3540\end{verbatim} 
    3641 
  • GTP/trunk/Lib/Vis/Preprocessing/manual/manual.log

    r2068 r2072  
    1 This is pdfeTeX, Version 3.141592-1.21a-2.2 (MiKTeX 2.4) (preloaded format=latex 2005.8.25)  31 JAN 2007 13:39 
     1This is pdfeTeX, Version 3.141592-1.21a-2.2 (MiKTeX 2.4) (preloaded format=latex 2005.8.25)  1 FEB 2007 16:05 
    22entering extended mode 
    33**D:/svn/gametools/GTP/trunk/Lib/Vis/Preprocessing/manual/manual.tex 
     
    179179) 
    180180LaTeX Font Info:    Font shape `OT1/ptm/bx/n' in size <12> not available 
    181 (Font)              Font shape `OT1/ptm/b/n' tried instead on input line 57. 
    182 LaTeX Font Info:    Try loading font information for OMS+ptm on input line 64. 
     181(Font)              Font shape `OT1/ptm/b/n' tried instead on input line 62. 
     182LaTeX Font Info:    Try loading font information for OMS+ptm on input line 69. 
    183183 
    184184(D:\texmf\tex\latex\psnfss\omsptm.fd 
     
    186186) 
    187187LaTeX Font Info:    Font shape `OMS/ptm/m/n' in size <10> not available 
    188 (Font)              Font shape `OMS/cmsy/m/n' tried instead on input line 64. 
     188(Font)              Font shape `OMS/cmsy/m/n' tried instead on input line 69. 
    189189 [2 
    190190 
    191191] [3] 
    192 Overfull \hbox (1.41376pt too wide) in paragraph at lines 176--176 
     192Overfull \hbox (1.41376pt too wide) in paragraph at lines 181--181 
    193193[]                                \OT1/pcr/m/n/10 IntersectableWrapper<EntityCo 
    194194ntainer *>[]  
     
    196196 
    197197 
    198 Overfull \hbox (19.41376pt too wide) in paragraph at lines 176--176 
     198Overfull \hbox (19.41376pt too wide) in paragraph at lines 181--181 
    199199[]   \OT1/pcr/m/n/10 EngineIntersectable(EntityContainer *item): GtpVisibilityP 
    200200reprocessor::[]  
     
    202202 
    203203[4] 
    204 Overfull \hbox (31.41376pt too wide) in paragraph at lines 260--260 
     204Overfull \hbox (31.41376pt too wide) in paragraph at lines 265--265 
    205205[]       \OT1/pcr/m/n/10 const GtpVisibilityPreprocessor::IndexedBoundingBoxCon 
    206206tainer &iboxes,[]  
     
    208208 
    209209 
    210 Overfull \hbox (1.41376pt too wide) in paragraph at lines 260--260 
     210Overfull \hbox (1.41376pt too wide) in paragraph at lines 265--265 
    211211[]    \OT1/pcr/m/n/10 EngineIntersectable *entry = new EngineIntersectable(entr 
    212212yObjects);[]  
     
    214214 
    215215[5] 
    216 Overfull \hbox (1.41376pt too wide) in paragraph at lines 309--309 
     216Overfull \hbox (1.41376pt too wide) in paragraph at lines 314--314 
    217217[]  \OT1/pcr/m/n/10 for (sit = sceneNodeList.begin(); sit != sceneNodeList.end( 
    218218); ++ sit)[]  
     
    220220 
    221221 
    222 Overfull \hbox (7.41376pt too wide) in paragraph at lines 309--309 
     222Overfull \hbox (7.41376pt too wide) in paragraph at lines 314--314 
    223223[]      \OT1/pcr/m/n/10 // test for intersection (note: function provided of pr 
    224224eprocessor)[]  
     
    242242\urw\urwstd\utmri8a.pfb><D:\texmf\fonts\type1\urw\urwstd\utmb8a.pfb><D:\texmf\f 
    243243onts\type1\urw\urwstd\utmr8a.pfb> 
    244 Output written on manual.pdf (7 pages, 82161 bytes). 
     244Output written on manual.pdf (7 pages, 82164 bytes). 
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/generate_viewcells.env

    r2071 r2072  
    55 
    66Scene { 
     7 
    78        filename ../data/vienna/vienna_cropped.obj 
    8 #       filename ../data/soda/soda5.obj 
    99#       filename ../data/soda/soda5.dat 
    1010} 
     
    1616        type vss 
    1717        detectEmptyViewSpace true 
    18         #loadMeshes true 
    1918        loadMeshes false 
    2019        # internal raycaster 
    21 #       rayCastMethod 0 
     20        rayCastMethod 0 
    2221        # intel raycaster 
    23         rayCastMethod 1 
     22        #rayCastMethod 1 
    2423        exportVisibility false 
    2524        loadKdTree false 
     
    8887                 
    8988                maxCostRatio 1.5 
    90                 #maxCostRatio 999999 
    9189                ct_div_ci 0.5 
    9290        } 
     
    9694        splitBorder 0.01 
    9795} 
    98  
    9996 
    10097MeshKdTree { 
     
    128125        loadFromFile false 
    129126 
     127        filename vienna_cropped-viewcells.xml.gz 
     128 
    130129        exportPvs false 
    131         filename vienna_cropped-visibility.xml.gz 
    132130 
    133131        # type of view cells 
    134         type vspBspTree 
     132        type vspOspTree 
    135133         
    136134        #percentage of total visible objects where pvs is considered invalid 
     
    157155        Visualization { 
    158156                # how much samples we use for visualization 
    159                 samples 20000 
     157                samples 200 
    160158                exportRays true 
    161                 exportGeometry false 
     159                exportGeometry true 
    162160                exportMergedViewCells false 
    163161                useClipPlane true 
     
    188186 
    189187 
    190 VspBspTree { 
     188################################ 
     189# 
     190# View space partitioning kd tree 
     191# 
     192 
     193VspTree { 
    191194        Construction { 
     195                renderCostDecreaseWeight 1.0 
     196        } 
     197 
     198        Termination { 
     199                minPvs 0 
     200                maxViewCells 5000 
     201        } 
     202 
     203        useCostHeuristics true 
     204        splitUseOnlyDrivingAxis false 
     205 
     206        # maximum number of tests per node 
     207        maxTests 50000 
     208} 
     209 
     210 
     211########################## 
     212# 
     213# The bounding volume hierarchy 
     214# 
     215 
     216BvHierarchy { 
     217 
     218        Construction {           
     219                renderCostDecreaseWeight 1.0 
     220        } 
     221 
     222        Termination { 
     223                maxLeaves 50000 
     224        } 
     225 
     226        minRaysForVisibility 15 
     227 
     228        # use only surface area heuristic        
     229        useCostHeuristics true 
     230        useSah false 
     231 
     232        splitUseOnlyDrivingAxis false 
     233 
     234        maxTests 50000 
     235} 
     236 
     237 
     238############################################################### 
     239# 
     240# Manages the construction of view space and object space partition 
     241# 
     242 
     243Hierarchy { 
     244        # the type of object space partition: view space is always vsp (=kd) partition 
     245        type bvh 
     246         
     247        Construction { 
     248 
    192249                samples 2000000 
    193                 epsilon 0.0000001 
    194                 randomize false 
    195                 renderCostWeight 1.0 
    196         } 
    197  
    198  
    199         # random polygon       = 1 
    200         # axis aligned         = 2 
    201         # least ray splits     = 256 
    202         # balanced rays        = 512 
    203         # pvs                  = 1024 
    204          
    205         splitPlaneStrategy 1026 
    206          
    207         # maximal candidates for split planes 
    208         maxPolyCandidates 0 
    209  
    210         usePolygonSplitIfAvailable false 
    211  
    212         # maximal tested rays for split cost heuristics 
    213         maxTests 100000 
    214          
    215         maxTotalMemory  50 
    216         maxStaticMemory 50 
    217  
    218         subdivisionStats ../subdivisionStats.log 
    219  
    220         # factors for evaluating split plane costs 
    221         Factor { 
    222                 leastRaySplits 1.0 
    223                 balancedRays 1.0 
    224                 pvs 1.0 
    225         } 
    226          
    227         Termination { 
    228                 # parameters used for autopartition 
    229                 minRays                 -1 
    230                 minPolygons             -1 
    231                 maxDepth                25 
    232                 minPvs                  0 
    233                 minProbability          0.000001 
    234                 maxRayContribution      1 
    235                 maxCostRatio            0.9 
    236                 missTolerance           6 
    237                 globalCostMissTolerance 4 
    238                 minGlobalCostRatio      0.0001 
    239  
    240                 maxViewCells            3000 
    241          
    242                 # used for pvs criterium 
    243                 ct_div_ci 0.0 
    244                  
    245                 AxisAligned { 
    246                         minRays                 50000 
    247                         maxRayContribution      9.9 
    248                 } 
    249         } 
    250          
    251         useSplitCostQueue true 
    252  
    253         splitUseOnlyDrivingAxis false 
    254         simulateOctree false 
    255         useRandomAxis false 
    256         usePolygonSplitIfAvailable false 
    257         nodePriorityQueueType 0 
    258  
    259         useCostHeuristics true 
    260  
    261         Visualization { 
    262                 # x3d visualization of the split planes 
    263                 exportSplits false 
    264         } 
    265 } 
     250 
     251                # type 0 = sequential computation, 1 = interleaved, 2 = gradient 
     252                type 0 
     253 
     254                ############################### 
     255                # only for interleaved method 
     256 
     257                # minimal steps of same type for gradient method 
     258                minStepsOfSameType 100 
     259                # maximum steps of same type for gradient method 
     260                maxStepsOfSameType 900 
     261 
     262                # maximum number of repair steps per gradient step 
     263                maxRepairs 1000 
     264        } 
     265 
     266        Termination { 
     267                # maximal number of leaves 
     268                maxLeaves 3000000 
     269                # maximal memory in MB 
     270                maxMemory 100 
     271                # minimum ratio of global cost decrease 
     272                minGlobalCostRatio -1 
     273        } 
     274} 
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/generate_viewcells.sh

    r2066 r2072  
    1010 
    1111SCENE=vienna_cropped 
    12 #SCENE=soda5 
    13  
    1412LOG_PREFIX=../scripts/$SCENE 
    1513ENVIRONMENT=generate_viewcells.env 
     
    1715echo "starting $TARGET mode for $SCENE scene" 
    1816 
    19 #!/bin/sh 
     17############################################################################ 
    2018 
    21 PROGRAM=../bin/release/Preprocessor.exe 
    22 SCENE=generate_viewcells 
     19#  METHOD=interleaved 
     20#  echo "$SCENE $METHOD" 
    2321 
    24 LOG_PREFIX=../scripts/vienna 
     22#  $PROGRAM $ENVIRONMENT \ 
     23#  -view_cells_filename=$LOG_PREFIX-$METHOD-viewcells.xml.gz \ 
     24#   -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 
     25#   -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 
     26#   -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 
     27#   -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 
     28#   -hierarchy_construction_type=2 \ 
     29#   -hierarchy_construction_consider_memory=true 
    2530 
    26 ENVIRONMENT=$SCENE.env 
     31############################################################################ 
    2732 
     33  echo "$SCENE $METHOD" 
    2834 
    29 ############################################### 
     35  $PROGRAM $ENVIRONMENT \ 
     36  -view_cells_filename=$LOG_PREFIX-viewcells.xml.gz \ 
     37   -view_cells_merge_stats=$LOG_PREFIX-mergeStats.log \ 
     38   -vsp_subdivision_stats=$LOG_PREFIX-vsp-subdivisionStats.log \ 
     39   -bvh_subdivision_stats=$LOG_PREFIX-bvh-subdivisionStats.log \ 
     40   -hierarchy_subdivision_stats=$LOG_PREFIX-hierarchy-subdivisionStats.log \ 
     41   -hierarchy_construction_type=0 \ 
     42   -hierarchy_construction_consider_memory=true 
    3043 
    31 METHOD=avs 
    32 echo "$SCENE $METHOD" 
    33  
    34 $PROGRAM $ENVIRONMENT \ 
    35 -view_cells_filename=$LOG_PREFIX-visibility.xml.zip 
    36  
    37 mv debug.log $LOG_PREFIX-$METHOD-debug.log 
    38  
     44#   -bvh_term_max_leaves=10000 \ 
     45#   -hierarchy_term_max_leaves=20000  
  • GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.cpp

    r2065 r2072  
    150150                SetFilled(); 
    151151                 
    152                 if (1) 
     152                if (0) 
    153153                        ExportGeometry(leaf->mObjects, true, box); 
    154154                else 
  • GTP/trunk/Lib/Vis/Preprocessing/src/InternalRayCaster.cpp

    r2071 r2072  
    201201#endif 
    202202 
    203         AxisAlignedBox3 ebox = sbox; 
    204         ebox.Enlarge(Vector3(1e-3f)); 
    205  
    206203        SimpleRayContainer::const_iterator sit, sit_end = rays.end(); 
    207204 
     
    210207        { 
    211208                CastRay(*sit, vssRays, sbox, castDoubleRays, pruneInvalidRays); 
    212                 if (!vssRays.empty() && (!vssRays.back() || !ebox.IsInside(*vssRays.back()))) 
    213                 cout << "error " << *vssRays.back()<<endl; 
    214209        } 
    215210 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r2070 r2072  
    745745                if (!mViewCellsManager) 
    746746                { 
     747                        cerr << "no view cells manager could be loaded" << endl; 
    747748                        return false; 
    748749                } 
     
    12031204        } 
    12041205         
    1205         // reserve constant block of rays 
     1206        ///// 
     1207        //-- reserve constant block of rays 
     1208         
     1209        // hack: If we dont't use view cells loading, there must be at least as much rays 
     1210        // as are needed for the view cells construction 
     1211        bool loadViewCells; 
     1212        Environment::GetSingleton()->GetBoolValue("ViewCells.loadFromFile", loadViewCells); 
     1213 
     1214        int reserveRays; 
     1215 
     1216        if (!loadViewCells) 
     1217        { 
     1218                cout << "setting ray pool size to view cell construction ize" << endl; 
     1219 
     1220                char buf[100]; 
     1221                Environment::GetSingleton()->GetStringValue("ViewCells.type", buf);      
     1222                 
     1223                if (strcmp(buf, "vspBspTree") == 0) 
     1224                { 
     1225                        Environment::GetSingleton()->GetIntValue("VspBspTree.Construction.samples", reserveRays); 
     1226                        reserveRays *= 2; 
     1227                } 
     1228                else if (strcmp(buf, "vspOspTree") == 0) 
     1229                { 
     1230                        Environment::GetSingleton()->GetIntValue("Hierarchy.Construction.samples", reserveRays); 
     1231                        reserveRays *= 2;                        
     1232                } 
     1233        } 
     1234        else 
     1235        { 
     1236                cout << "setting ray pool size to samples per pass" << endl; 
     1237         
     1238                reserveRays = mSamplesPerPass * 2; 
     1239        } 
     1240 
    12061241        cout << "======================" << endl; 
    1207         cout << "reserving " << 2 * mSamplesPerPass << " rays " << endl; 
    1208         mRayCaster->ReserveVssRayPool(2 * mSamplesPerPass); 
     1242        cout << "reserving " << reserveRays << " rays " << endl; 
     1243        mRayCaster->ReserveVssRayPool(reserveRays); 
    12091244         
    12101245        return true; 
     
    12251260        if ((int)rays.size() > 10000) { 
    12261261         
    1227                 //mRayCaster->SortRays(rays); 
     1262                mRayCaster->SortRays(rays); 
    12281263                cout<<"Rays sorted in "<<TimeDiff(t1, GetTime())<<" ms."<<endl; 
    12291264 
     
    12461281 
    12471282        SimpleRayContainer::const_iterator rit, rit_end = rays.end(); 
    1248 cout << "here1 " << vssRays.size()<<endl; 
     1283 
    12491284        SimpleRayContainer rayBucket; 
    12501285        int i = 0; 
     1286 
    12511287        for (rit = rays.begin(); rit != rit_end; ++ rit, ++ i) 
    12521288        { 
     
    12761312         
    12771313                if ((int)rays.size() > 100000 && i % 100000 == 0) 
    1278                         cout << "here2 " << vssRays.size()<<endl; 
    1279                   //cout<<"\r"<<i<<"/"<<(int)rays.size()<<"\r"; 
    1280         } 
    1281     cout << "here3 " << vssRays.size()<<endl; 
     1314                        //cout << "here2 " << vssRays.size()<<endl; 
     1315                        cout<<"\r"<<i<<"/"<<(int)rays.size()<<"\r"; 
     1316        } 
     1317     
    12821318        // cast rest of rays 
    12831319        SimpleRayContainer::const_iterator sit, sit_end = rayBucket.end(); 
     
    13041340        } 
    13051341 
    1306         cout << "here5 " << vssRays.size()<<endl; 
    1307  
    13081342        int m = 850000; 
    13091343 
    1310         if (1 && (int)rays.size() > m + 50) { 
     1344        if (0 && (int)rays.size() > m + 50) { 
    13111345          VssRayContainer tmpRays; 
    13121346                   
  • GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.h

    r2069 r2072  
    8282          if (mRays) 
    8383                delete mRays; 
    84           cout << "here4" << endl; 
     84         
    8585          mRays = new VssRay[number]; 
    8686          mNumber = number; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp

    r2071 r2072  
    205205bool SpatialBoxBasedDistribution::GenerateSample(SimpleRay &ray) 
    206206{ 
    207                 Vector3 origin, direction;  
     207        /* 
     208        Vector3 origin, direction;  
    208209 
    209210        mPreprocessor.mViewCellsManager->GetViewPoint(origin); 
     
    213214 
    214215        if (c <= Limits::Small)  
     216        return false; 
     217 
     218        const float pdf = 1.0f; 
     219 
     220        direction *= 1.0f / c; 
     221        ray = SimpleRay(origin, direction, SPATIAL_BOX_BASED_DISTRIBUTION, pdf); 
     222 
     223        return true; 
     224        */ 
     225 
     226        Vector3 origin, direction;  
     227 
     228        float r[6]; 
     229        sHalton.GetNext(6, r); 
     230        mPreprocessor.mViewCellsManager->GetViewPoint(origin, Vector3(r[0], r[1], r[2])); 
     231 
     232        direction = mPreprocessor.mKdTree->GetBox().GetRandomPoint(Vector3(r[3], 
     233                                                                                                                                           r[4], 
     234                                                                                                                                           r[5]) 
     235                                                                                                                                           ) - origin; 
     236        //cout << "z"; 
     237        const float c = Magnitude(direction); 
     238 
     239        if (c <= Limits::Small)  
    215240                return false; 
    216241 
     
    219244        direction *= 1.0f / c; 
    220245        ray = SimpleRay(origin, direction, SPATIAL_BOX_BASED_DISTRIBUTION, pdf); 
    221  
    222         return true; 
    223  
    224         /* 
    225   Vector3 origin, direction;  
    226  
    227   float r[6]; 
    228   sHalton.GetNext(6, r); 
    229   mPreprocessor.mViewCellsManager->GetViewPoint(origin, Vector3(r[0],r[1],r[2])); 
    230    
    231   direction = mPreprocessor.mKdTree->GetBox().GetRandomPoint(Vector3(r[3], 
    232                                                                                                                                          r[4], 
    233                                                                                                                                          r[5]) 
    234                                                                                                                                          ) - origin; 
    235   //cout << "z"; 
    236   const float c = Magnitude(direction); 
    237    
    238   if (c <= Limits::Small)  
    239         return false; 
    240    
    241   const float pdf = 1.0f; 
    242    
    243   direction *= 1.0f / c; 
    244   ray = SimpleRay(origin, direction, SPATIAL_BOX_BASED_DISTRIBUTION, pdf); 
    245    
    246   return true;*/ 
     246   
     247        return true; 
    247248} 
    248249 
     
    275276        // $$ jb the pdf is yet not correct for all sampling methods! 
    276277        const float pdf = 1.0f; 
    277         //cout << "p: " << point << " "; 
     278         
    278279        direction *= 1.0f / c; 
    279280        // a little offset 
     
    300301        Intersectable *object = mPreprocessor.mObjects[objIdx]; 
    301302        ViewCell *viewCell = viewCells[vcIdx]; 
    302  
    303         //cout << "vc: " << vcIdx << endl; 
    304         //cout << "obj: " << objIdx << endl; 
    305303 
    306304        object->GetRandomSurfacePoint(point, normal); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r2071 r2072  
    65886588        stream << "<VisibilitySolution>" << endl; 
    65896589 
    6590         // §§ tmp matt: for storage cost 
    6591         if (0 && exportPvs)  
     6590        if (exportPvs)  
    65926591        { 
    65936592        /////////////// 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp

    r2071 r2072  
    2727#define COUNT_ORIGIN_OBJECTS 1 
    2828 
    29 #define STORE_PVS 1 
     29#define STORE_PVS 0 
    3030 
    3131 
     
    451451        } 
    452452 
    453         // normalize 
    454453        if (mUseAreaForPvs) 
    455454                mTermMinProbability *= mBoundingBox.SurfaceArea();  
    456         else  
     455        else // normalize volume 
    457456                mTermMinProbability *= mBoundingBox.GetVolume(); 
    458  
    459457 
    460458        mBspStats.nodes = 1; 
     
    12731271                if (ray->mTerminationObject)  
    12741272                { 
    1275                         //cout << "m"; 
    12761273                        if (vc->AddPvsSample(ray->mTerminationObject, ray->mPdf, contribution)) 
    12771274                                madeContrib = true; 
     
    21262123        pOverall = data.mProbability; 
    21272124 
    2128         if (!mUseAreaForPvs) // use front and back cell areas to approximate volume 
     2125        if (!mUseAreaForPvs) 
    21292126        { 
    21302127                pFront = geomFront.GetVolume(); 
     
    21442141        else 
    21452142        { 
     2143                // use front and back cell areas to approximate volume 
    21462144                pFront = geomFront.GetArea(); 
    21472145                pBack = geomBack.GetArea(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp

    r2066 r2072  
    578578{ 
    579579        // note: to track for global cost misses does not really  
    580         // make sense because cost termination  happens in the hierarchy mananger 
    581  
     580        // make sense because termination on cost or memory is done  
     581        // in the hierarchy mananger 
    582582        const bool terminationCriteriaMet = (0 
    583583                // || mOutOfMemory 
Note: See TracChangeset for help on using the changeset viewer.