Changeset 382 for trunk


Ignore:
Timestamp:
11/05/05 20:03:25 (19 years ago)
Author:
bittner
Message:

vsspreprocessor update

Location:
trunk/VUT/GtpVisibilityPreprocessor/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/Environment.cpp

    r379 r382  
    12891289                                                                 "-preprocessor=", 
    12901290                                                                 "sampling"); 
    1291          
     1291 
     1292 
     1293        RegisterOption("VssTree.maxDepth", optInt, "kd_depth=", "12"); 
     1294  RegisterOption("VssTree.minPvs", optInt, "kd_minpvs=", "32"); 
     1295        RegisterOption("VssTree.maxCostRatio", optFloat, "maxcost=", "0.9"); 
     1296        RegisterOption("VssTree.maxRayContribution", optFloat, "maxraycontrib=", "0.5"); 
     1297 
     1298        RegisterOption("VssTree.epsilon", optFloat, "kd_eps=", "1e-6"); 
     1299  RegisterOption("VssTree.ct_div_ci", optFloat, "kd_ctdivci=", "1.0"); 
     1300  RegisterOption("VssTree.randomize", optBool, "randomize", "false"); 
     1301  RegisterOption("VssTree.splitType", optString, "split=", "queries"); 
     1302  RegisterOption("VssTree.numberOfEndPointDomains", optInt, "endpoints=", "10000"); 
     1303 
     1304  RegisterOption("VssTree.minSize", optFloat, "minsize=", "0.001"); 
     1305 
     1306  RegisterOption("VssTree.maxTotalMemory", optFloat, "mem=", "60.0"); 
     1307  RegisterOption("VssTree.maxStaticMemory", optFloat, "statmem=", "8.0"); 
     1308 
     1309  RegisterOption("VssTree.queryType", optString, "qtype=", "static"); 
     1310 
     1311  RegisterOption("VssTree.queryPosWeight", optFloat, "qposweight=", "0.0"); 
     1312  RegisterOption("VssTree.useRefDirSplits", optBool, "refdir", "false"); 
     1313  RegisterOption("VssTree.refDirAngle", optFloat, "refangle=", "10"); 
     1314  RegisterOption("VssTree.refDirBoxMaxSize", optFloat, "refboxsize=", "0.1"); 
     1315  RegisterOption("VssTree.accessTimeThreshold", optInt, "accesstime=", "1000"); 
     1316  RegisterOption("VssTree.minCollapseDepth", optInt, "colldepth=", "4"); 
     1317 
    12921318} 
    12931319 
  • trunk/VUT/GtpVisibilityPreprocessor/src/Intersectable.h

    r354 r382  
    1111        // both mailId and mailbox should be unique for each thread!!! 
    1212        static int sMailId; 
     13        static int sReservedMailboxes; 
    1314        int mMailbox; 
    1415         
     
    2627        int GetId() { return mId; } 
    2728         
     29 
     30        static void NewMail(const int reserve = 1) { 
     31                sMailId += sReservedMailboxes; 
     32                sReservedMailboxes = reserve; 
     33        } 
     34         
    2835        void Mail() { mMailbox = sMailId; } 
    29   static void NewMail() { sMailId++; } 
    3036  bool Mailed() const { return mMailbox == sMailId; } 
    31   int IncMail() { return ++mMailbox - sMailId; } 
    3237 
     38        void Mail(const int mailbox) { mMailbox = sMailId + mailbox; } 
     39        bool Mailed(const int mailbox) const { return mMailbox == sMailId + mailbox; } 
     40 
     41        int IncMail() { return ++mMailbox - sMailId; } 
     42 
     43 
     44         
    3345  virtual AxisAlignedBox3 GetBox() = 0; 
    3446   
  • trunk/VUT/GtpVisibilityPreprocessor/src/Makefile

    r372 r382  
    11############################################################################# 
    22# Makefile for building: preprocessor 
    3 # Generated by qmake (1.07a) (Qt 3.3.2) on: Thu Nov 03 11:34:08 2005 
     3# Generated by qmake (1.07a) (Qt 3.3.2) on: Sat Nov 05 19:00:35 2005 
    44# Project:  preprocessor.pro 
    55# Template: app 
     
    415415main.obj: main.cpp  \ 
    416416                SamplingPreprocessor.h \ 
     417                VssPreprocessor.h \ 
    417418                ExactPreprocessor.h \ 
    418419                Parser.h \ 
     
    441442                common.h \ 
    442443                Ray.h \ 
     444                VssRay.h \ 
    443445                 
    444446 
     
    639641                Environment.h \ 
    640642                VssRay.h \ 
     643                Intersectable.h \ 
    641644                AxisAlignedBox3.h \ 
    642645                Statistics.h \ 
     
    646649                Matrix4x4.h \ 
    647650                Plane3.h \ 
     651                Pvs.h \ 
    648652                 
    649653 
     
    657661                Polygon3.h \ 
    658662                ViewCell.h \ 
     663                VssRay.h \ 
     664                VssTree.h \ 
    659665                Containers.h \ 
    660666                AxisAlignedBox3.h \ 
     
    672678                Material.h \ 
    673679                Exporter.h \ 
     680                Statistics.h \ 
    674681                 
    675682 
  • trunk/VUT/GtpVisibilityPreprocessor/src/Mesh.cpp

    r376 r382  
    55 
    66int Intersectable::sMailId = 21843194198; 
     7int Intersectable::sReservedMailboxes = 1; 
    78 
    89void 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp

    r376 r382  
    88#include "ViewCell.h" 
    99#include "VssRay.h" 
     10#include "VssTree.h" 
    1011 
    1112VssPreprocessor::VssPreprocessor(): 
     
    4849        Intersectable *objectA, *objectB; 
    4950        Vector3 pointA, pointB; 
    50  
     51        float bsize = Magnitude(box.Size()); 
    5152        if (mKdTree->CastRay(ray)) { 
    5253                objectA = ray.intersections[0].mObject; 
     
    5758                float tmin, tmax; 
    5859                box.ComputeMinMaxT(ray, &tmin, &tmax); 
     60                if (tmax > bsize) { 
     61                        cerr<<"Warning: tmax > box size tmax="<<tmax<<" tmin="<<tmin<<" size="<<bsize<<endl; 
     62                        cerr<<"ray"<<ray<<endl; 
     63                } 
    5964                pointA = ray.Extrap(tmax); 
     65                 
    6066        } 
    6167         
     
    6975                float tmin, tmax; 
    7076                box.ComputeMinMaxT(ray, &tmin, &tmax); 
     77                if (tmax > bsize) { 
     78                        cerr<<"Warning: tmax > box size tmax="<<tmax<<" tmin="<<tmin<<" size="<<bsize<<endl; 
     79                        cerr<<"ray"<<ray<<endl; 
     80                } 
     81                 
    7182                pointB = ray.Extrap(tmax); 
    7283        } 
     
    8697 
    8798Vector3 
    88 VssPreprocessor::GetViewpoint() 
    89 { 
    90         AxisAlignedBox3 box = mKdTree->GetBox(); 
    91  
     99VssPreprocessor::GetViewpoint(AxisAlignedBox3 *viewSpaceBox) 
     100{ 
     101        AxisAlignedBox3 box; 
     102         
     103        if (viewSpaceBox) 
     104                box =*viewSpaceBox; 
     105        else 
     106                box = mKdTree->GetBox(); 
     107         
    92108        // shrink the box in the y direction 
    93         Vector3 diff(0, -box.Size().y*0.4f, 0); 
    94         box.Enlarge(diff); 
    95          
    96109        return box.GetRandomPoint(); 
    97110} 
     
    100113VssPreprocessor::GetDirection(const Vector3 &viewpoint) 
    101114{ 
    102         int i = RandomValue(0, mObjects.size()); 
     115        int i = RandomValue(0, mObjects.size()-1); 
    103116        Intersectable *object = mObjects[i]; 
    104117        Vector3 point, normal; 
     
    114127   
    115128  mSceneGraph->CollectObjects(&mObjects); 
    116          
    117  
     129        cout<<"#NUM_OBJECTS (Total numner of objects)\n"<<mObjects.size()<<endl; 
     130         
    118131  long startTime = GetTime(); 
    119132   
     
    121134  int totalSamples = 0; 
    122135 
    123  
     136        AxisAlignedBox3 *viewSpaceBox = NULL; 
     137 
     138        AxisAlignedBox3 box = mKdTree->GetBox(); 
     139        box.Enlarge(box.Size()*-Vector3(0.45, 0.45, 0.45)); 
     140 
     141        bool useViewSpaceBox = false; 
     142        if (useViewSpaceBox) 
     143                viewSpaceBox = &box; 
     144         
    124145  while (totalSamples < mTotalSamples) { 
    125146                int passContributingSamples = 0; 
     
    132153                 
    133154                for (int k=0; k < mSamplesPerPass; k++) { 
    134  
    135                         Vector3 viewpoint = GetViewpoint(); 
     155                         
     156                        Vector3 viewpoint = GetViewpoint(viewSpaceBox); 
    136157                        Vector3 direction = GetDirection(viewpoint); 
    137  
     158                         
    138159                        VssRay *vssRay = CastRay(viewpoint, direction); 
    139160                         
     
    153174     
    154175                mPass++; 
    155  
     176                 
    156177                int pvsSize = 0; 
    157178                float avgRayContrib = (passContributingSamples > 0) ?  
     
    176197         
    177198        cout << "#totalPvsSize=" << mKdTree->CollectLeafPvs() << endl; 
    178         cout << "#totalRayStackSize=" << mVssRays.size() << endl; 
    179  
     199        cout << "#totalRayStackSize=" << mVssRays.size() << endl <<flush; 
     200 
     201        VssTree *vssTree = new VssTree; 
     202 
     203        vssTree->Construct(mVssRays, viewSpaceBox); 
     204         
    180205  return true; 
    181206} 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.h

    r376 r382  
    2828 
    2929        Vector3 
    30         GetViewpoint(); 
     30        GetViewpoint(AxisAlignedBox3 *viewSpaceBox); 
    3131 
    3232        Vector3 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VssRay.cpp

    r372 r382  
    141141  return SqrDistance(point, center) < sqrRadius; 
    142142} 
     143 
     144 
     145float 
     146VssRay::GetDirParametrization(const int axis) const 
     147{ 
     148        float angle; 
     149        Vector3 dir = GetNormalizedDir(); 
     150        if (axis == 0) { 
     151                angle = atan2(dir.x, dir.z); 
     152        } else { 
     153                angle = asin(dir.y); 
     154        } 
     155        return angle; 
     156} 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VssRay.h

    r376 r382  
    2222         
    2323        // side of the ray - used for the ray classification 
    24   char mSide; 
     24        //  char mSide; 
    2525         
    2626        // computed t 
     
    9898  Vector3 GetNormalizedDir() const { return (mTermination - mOrigin)*mInvSize; } 
    9999 
     100        float GetDirParametrization(const int axis) const; 
     101         
    100102        float GetInvSize() const { return  mInvSize; } 
    101103  float GetOrigin(const int axis) const { return mOrigin[axis]; } 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VssTree.cpp

    r372 r382  
    2222#include "Environment.h" 
    2323#include "VssRay.h" 
     24#include "Intersectable.h" 
    2425 
    2526 
     
    3233VssTreeLeaf::mailID = 0; 
    3334 
     35inline void 
     36AddObject2Pvs(Intersectable *object, 
     37                                                        const int side, 
     38                                                        int &pvsBack, 
     39                                                        int &pvsFront) 
     40{ 
     41 
     42        if (!object) 
     43                return; 
     44                 
     45        if (side <= 0) { 
     46                if (!object->Mailed() && !object->Mailed(2)) { 
     47                        pvsBack++; 
     48                        if (object->Mailed(1)) 
     49                                object->Mail(2); 
     50                        else 
     51                                object->Mail(); 
     52                } 
     53        } 
     54         
     55        if (side >= 0) { 
     56                if (!object->Mailed(1) && !object->Mailed(2)) { 
     57                        pvsFront++; 
     58                        if (object->Mailed()) 
     59                                object->Mail(2); 
     60                        else 
     61                                object->Mail(1); 
     62                } 
     63        } 
     64} 
     65 
    3466 
    3567// Constructor 
     
    3769{ 
    3870  environment->GetIntValue("VssTree.maxDepth", termMaxDepth); 
    39  
    40         environment->GetIntValue("VssTree.minCost", termMinCost); 
     71        environment->GetIntValue("VssTree.minPvs", termMinPvs); 
     72        environment->GetFloatValue("VssTree.maxRayContribution", termMaxRayContribution); 
     73  environment->GetFloatValue("VssTree.maxCostRatio", termMaxCostRatio); 
    4174 
    4275  environment->GetFloatValue("VssTree.minSize", termMinSize); 
    4376  termMinSize = sqr(termMinSize); 
    44  
     77         
    4578  environment->GetFloatValue("VssTree.refDirBoxMaxSize", refDirBoxMaxSize); 
    4679  refDirBoxMaxSize = sqr(refDirBoxMaxSize); 
     
    4881  environment->GetFloatValue("VssTree.epsilon", epsilon); 
    4982  environment->GetFloatValue("VssTree.ct_div_ci", ct_div_ci); 
    50  
     83         
    5184  environment->GetFloatValue("VssTree.maxTotalMemory", maxTotalMemory); 
    5285  environment->GetFloatValue("VssTree.maxStaticMemory", maxStaticMemory); 
    5386   
    54   environment->GetFloatValue("VssTree.maxCostRatio", maxCostRatio); 
    5587   
    5688 
     
    77109    splitType = ESplitRegular; 
    78110  else 
    79     if (name.compare("volume") == 0) 
     111    if (name.compare("heuristics") == 0) 
    80112      splitType = ESplitVolume; 
    81     else 
    82       if (name.compare("queries") == 0) 
    83                                 splitType = ESplitQueries; 
    84       else { 
    85                                 cerr<<"Invalid VssTree split type "<<name<<endl; 
    86                                 exit(1); 
    87       } 
     113                else { 
     114                        cerr<<"Invalid VssTree split type "<<name<<endl; 
     115                        exit(1); 
     116                } 
    88117         
    89118  environment->GetBoolValue("VssTree.randomize", randomize); 
     
    91120  root = NULL; 
    92121   
    93   splitCandidates = new vector<SSortableEntry>; 
     122  splitCandidates = new vector<SortableEntry>; 
    94123} 
    95124 
     
    109138  app << "===== VssTree statistics ===============\n"; 
    110139 
    111   app << "#N_RAYS Number of rays )\n" 
     140  app << "#N_RAYS ( Number of rays )\n" 
    112141      << rays <<endl; 
    113   app << "#N_DOMAINS  ( Number of query domains )\n" 
    114       << queryDomains <<endl; 
     142 
     143        app << "#N_INITPVS ( Initial PVS size )\n" 
     144      << initialPvsSize <<endl; 
    115145   
    116146  app << "#N_NODES ( Number of nodes )\n" << nodes << "\n"; 
     
    135165    maxRayRefs << "\n"; 
    136166 
    137   app << "#N_NONEMPTYRAYREFS  ( Number of rayRefs in nonEmpty leaves / non empty leaf )\n" << 
    138     rayRefsNonZeroQuery/(double)(Leaves() - zeroQueryNodes) << "\n"; 
    139  
    140   app << "#N_LEAFDOMAINREFS  ( Number of query domain Refs / leaf )\n" << 
    141     queryDomainRefs/(double)Leaves() << "\n"; 
    142167 
    143168  //  app << setprecision(4); 
    144  
    145   app << "#N_PEMPTYLEAVES  ( Percentage of leaves with zero query domains )\n"<< 
    146     zeroQueryNodes*100/(double)Leaves()<<endl; 
    147169 
    148170  app << "#N_PMAXDEPTHLEAVES ( Percentage of leaves at maxdepth )\n"<< 
     
    151173  app << "#N_PMINCOSTLEAVES  ( Percentage of leaves with minCost )\n"<< 
    152174    minCostNodes*100/(double)Leaves()<<endl; 
     175         
     176        app << "#N_PMINSIZELEAVES  ( Percentage of leaves with minSize )\n"<< 
     177    minSizeNodes*100/(double)Leaves()<<endl; 
     178 
     179        app << "#N_PMAXRAYCONTRIBLEAVES  ( Percentage of leaves with maximal ray contribution )\n"<< 
     180    maxRayContribNodes*100/(double)Leaves()<<endl; 
    153181 
    154182  app << "#N_ADDED_RAYREFS  (Number of dynamically added ray references )\n"<< 
     
    173201VssTree::Construct( 
    174202                                                                         VssRayContainer &rays, 
    175                                                                          const bool onlyStaticPart 
     203                                                                         AxisAlignedBox3 *forcedBoundingBox 
    176204                                                                         ) 
    177205{ 
    178206  stat.Start(); 
    179207   
    180   if (onlyStaticPart) 
    181     maxMemory = maxStaticMemory; 
    182   else 
    183     maxMemory = maxTotalMemory; 
    184  
     208        maxMemory = maxStaticMemory; 
    185209 
    186210  if (root) 
     
    194218   
    195219  bbox.Initialize(); 
    196  
    197220  dirBBox.Initialize(); 
    198221   
     
    201224      ri++) { 
    202225    leaf->AddRay(VssTreeNode::RayInfo(*ri)); 
     226 
    203227    bbox.Include((*ri)->GetOrigin()); 
    204228    bbox.Include((*ri)->GetTermination()); 
    205229     
    206     dirBBox.Include( (*ri)->GetNormalizedDir() ); 
    207   } 
    208    
    209    
     230                 
     231                dirBBox.Include(Vector3( 
     232                                                                                                                (*ri)->GetDirParametrization(0), 
     233                                                                                                                (*ri)->GetDirParametrization(1), 
     234                                                                                                                0 
     235                                                                                                                ) 
     236                                                                                ); 
     237        } 
     238         
     239         
     240        if (forcedBoundingBox) 
     241                bbox = *forcedBoundingBox; 
     242 
     243        cout<<"Bbox = "<<bbox<<endl; 
     244        cout<<"Dirr Bbox = "<<dirBBox<<endl; 
     245 
    210246  stat.rays = leaf->rays.size(); 
    211    
     247        EvalLeafPvs(leaf); 
     248  stat.initialPvsSize = leaf->mPvsSize; 
    212249  // Subdivide(); 
    213250  root = Subdivide(TraversalData(leaf, bbox, 0)); 
     
    216253    // force realease of this vector 
    217254    delete splitCandidates; 
    218     splitCandidates = new vector<SSortableEntry>; 
     255    splitCandidates = new vector<SortableEntry>; 
    219256  } 
    220257   
    221258  stat.Stop(); 
    222259 
    223   cout<<"##################################"<<endl; 
    224    
     260        stat.Print(cout); 
     261        cout<<"#Total memory="<<GetMemUsage()<<endl; 
     262 
     263} 
     264 
     265void 
     266VssTree::EvalLeafPvs(VssTreeLeaf *leaf) 
     267{ 
     268        Intersectable::NewMail(); 
     269        int pvsSize = 0; 
     270        for(VssTreeNode::RayInfoContainer::iterator ri = leaf->rays.begin(); 
     271                        ri != leaf->rays.end(); 
     272                        ri++) 
     273                if ((*ri).mRay->IsActive()) { 
     274                        Intersectable *object = (*ri).mRay->mOriginObject; 
     275                        if (object && !object->Mailed()) { 
     276                                pvsSize++; 
     277                                object->Mail(); 
     278                        } 
     279                        object = (*ri).mRay->mTerminationObject; 
     280                        if (object && !object->Mailed()) { 
     281                                pvsSize++; 
     282                                object->Mail(); 
     283                        } 
     284                } 
     285        leaf->mPvsSize = pvsSize; 
    225286} 
    226287 
     
    283344                                                                                 VssTreeLeaf *leaf, 
    284345                                                                                 const AxisAlignedBox3 &box, 
    285                                                                                  float &position 
     346                                                                                 float &position, 
     347                                                                                 int &raysBack, 
     348                                                                                 int &raysFront, 
     349                                                                                 int &pvsBack, 
     350                                                                                 int &pvsFront 
    286351                                                                                 ) 
    287352{ 
    288353 
    289354  int minDirDepth = 6; 
    290  
    291   Vector3 size = box.Size(); 
    292    
    293   float pDirSubdivision = 0.0f; 
    294   if (leaf->depth >= minDirDepth && RandomValue(0, 1) < pDirSubdivision) { 
    295     AxisAlignedBox3 dirbox = GetDirBBox(leaf); 
    296     Vector3 size = dirbox.Size(); 
    297     int axis = size.DrivingAxis(); 
    298     position = (dirbox.Min()[axis] + dirbox.Max()[axis])*0.5f; 
    299     return axis + 3; 
    300   } 
    301    
    302   int axis = size.DrivingAxis(); 
    303  
    304    
     355  int axis; 
     356        float costRatio; 
     357         
    305358  if (splitType == ESplitRegular) { 
    306                 position = (box.Min()[axis] + box.Max()[axis])*0.5f; 
    307   } 
    308    
    309   return axis; 
     359                int sRaysBack, sRaysFront; 
     360                int dRaysBack, dRaysFront; 
     361                int sPvsBack, sPvsFront; 
     362                int dPvsBack, dPvsFront; 
     363                 
     364                 
     365                int sAxis = box.Size().DrivingAxis(); 
     366                float sPosition = (box.Min()[sAxis] + box.Max()[sAxis])*0.5f; 
     367                float sCostRatio = EvalCostRatio(leaf, 
     368                                                                                                                                                 sAxis, 
     369                                                                                                                                                 sPosition, 
     370                                                                                                                                                 sRaysBack, 
     371                                                                                                                                                 sRaysFront, 
     372                                                                                                                                                 sPvsBack, 
     373                                                                                                                                                 sPvsFront 
     374                                                                                                                                                 ); 
     375                //              cout<<"srays back="<<sRaysBack<<" rays front="<<sRaysFront<<" pvs back="<<sPvsBack<< 
     376                //                      " pvs front="<<sPvsFront<<endl; 
     377 
     378                AxisAlignedBox3 dirBox = GetDirBBox(leaf); 
     379                int dAxis = dirBox.Size().DrivingAxis(); 
     380                float dPosition = (dirBox.Min()[dAxis] + dirBox.Max()[dAxis])*0.5f; 
     381                float dCostRatio = EvalCostRatio(leaf, 
     382                                                                                                                                                 dAxis+3, 
     383                                                                                                                                                 dPosition, 
     384                                                                                                                                                 dRaysBack, 
     385                                                                                                                                                 dRaysFront, 
     386                                                                                                                                                 dPvsBack, 
     387                                                                                                                                                 dPvsFront 
     388                                                                                                                                                 ); 
     389                 
     390                //              cout<<"drays back="<<dRaysBack<<" rays front="<<dRaysFront<<" pvs back="<<dPvsBack<< 
     391                //                      " pvs front="<<dPvsFront<<endl; 
     392 
     393                if (sCostRatio < dCostRatio) { 
     394                        costRatio = sCostRatio; 
     395                        axis = sAxis; 
     396                        position = sPosition; 
     397                        raysBack = sRaysBack; 
     398                        raysFront = sRaysFront; 
     399                        pvsBack = sPvsBack; 
     400                        pvsFront = sPvsFront; 
     401                         
     402                } else { 
     403                        costRatio = dCostRatio; 
     404                        axis = dAxis+3; 
     405                        position = dPosition; 
     406                        raysBack = dRaysBack; 
     407                        raysFront = dRaysFront; 
     408                        pvsBack = dPvsBack; 
     409                        pvsFront = dPvsFront; 
     410                } 
     411                 
     412        } else { 
     413    if (splitType == ESplitVolume) 
     414      costRatio = BestCostRatio(leaf, 
     415                                                                                                                                axis, 
     416                                                                                                                                position, 
     417                                                                                                                                raysBack, 
     418                                                                                                                                raysFront); 
     419                else { 
     420                        cerr<<"VssTree: Unknown split heuristics\n"; 
     421                        exit(1); 
     422                } 
     423  } 
     424 
     425        if (costRatio > termMaxCostRatio) { 
     426                cout<<"Too big cost ratio "<<costRatio<<endl; 
     427                return -1; 
     428        } 
     429 
     430#if 0    
     431        cout<< 
     432                "pvs="<<leaf->mPvsSize<< 
     433                " rays="<<leaf->rays.size()<< 
     434                " rc="<<leaf->GetAvgRayContribution()<< 
     435                " axis="<<axis<<endl; 
     436#endif 
     437         
     438        return axis; 
     439} 
     440 
     441 
     442                                                         
     443 
     444float 
     445VssTree::EvalCostRatio( 
     446                                                                                         VssTreeLeaf *leaf, 
     447                                                                                         const int axis, 
     448                                                                                         const float position, 
     449                                                                                         int &raysBack, 
     450                                                                                         int &raysFront, 
     451                                                                                         int &pvsBack, 
     452                                                                                         int &pvsFront 
     453                                                                                         ) 
     454{ 
     455        raysBack = 0; 
     456        raysFront = 0; 
     457        pvsFront = 0; 
     458        pvsBack = 0; 
     459 
     460        float newCost; 
     461 
     462        Intersectable::NewMail(3); 
     463         
     464        // eval pvs size 
     465        int pvsSize = leaf->mPvsSize; 
     466 
     467        Intersectable::NewMail(3); 
     468 
     469        if (axis <= VssTreeNode::SPLIT_Z) { 
     470    // this is the main ray classification loop! 
     471    for(VssTreeNode::RayInfoContainer::iterator ri = leaf->rays.begin(); 
     472                                ri != leaf->rays.end(); 
     473                                ri++) 
     474      if ((*ri).mRay->IsActive()) { 
     475                                 
     476                                // determine the side of this ray with respect to the plane 
     477                                int side = (*ri).ComputeRayIntersection(axis, position, (*ri).mRay->mT); 
     478                                 
     479                                //                              (*ri).mRay->mSide = side; 
     480                                 
     481                                if (side <= 0) 
     482                                        raysBack++; 
     483                                 
     484                                if (side >= 0) 
     485                                        raysFront++; 
     486                                 
     487                                AddObject2Pvs((*ri).mRay->mOriginObject, side, pvsBack, pvsFront); 
     488                                AddObject2Pvs((*ri).mRay->mTerminationObject, side, pvsBack, pvsFront); 
     489 
     490      } 
     491                 
     492                AxisAlignedBox3 box = GetBBox(leaf); 
     493                 
     494                float minBox = box.Min(axis); 
     495                float maxBox = box.Max(axis); 
     496                float sizeBox = maxBox - minBox; 
     497                 
     498                //              float sum = raysBack*(position - minBox) + raysFront*(maxBox - position); 
     499                float sum = pvsBack*(position - minBox) + pvsFront*(maxBox - position); 
     500 
     501                newCost = ct_div_ci + sum/sizeBox; 
     502                 
     503  } else { 
     504                 
     505                // directional split 
     506    for(VssTreeNode::RayInfoContainer::iterator ri = leaf->rays.begin(); 
     507                                ri != leaf->rays.end(); 
     508                                ri++) 
     509      if ((*ri).mRay->IsActive()) { 
     510                                 
     511                                // determine the side of this ray with respect to the plane 
     512                                int side; 
     513                                if ((*ri).mRay->GetDirParametrization(axis - 3) > position) 
     514                                        side = 1; 
     515                                else 
     516                                        side = -1; 
     517 
     518                                if (side <= 0) 
     519                                        raysBack++; 
     520                                 
     521                                if (side >= 0) 
     522                                        raysFront++; 
     523 
     524                                //                              (*ri).mRay->mSide = side; 
     525 
     526                                AddObject2Pvs((*ri).mRay->mOriginObject, side, pvsBack, pvsFront); 
     527                                AddObject2Pvs((*ri).mRay->mTerminationObject, side, pvsBack, pvsFront); 
     528 
     529      } 
     530                 
     531                AxisAlignedBox3 box = GetDirBBox(leaf); 
     532                 
     533                float minBox = box.Min(axis-3); 
     534                float maxBox = box.Max(axis-3); 
     535                float sizeBox = maxBox - minBox; 
     536                 
     537                //              float sum = raysBack*(position - minBox) + raysFront*(maxBox - position); 
     538                float sum = pvsBack*(position - minBox) + pvsFront*(maxBox - position); 
     539                //              float sum = pvsBack + pvsFront; 
     540                newCost = ct_div_ci + sum/sizeBox; 
     541  } 
     542 
     543        //      cout<<axis<<" "<<pvsSize<<" "<<pvsBack<<" "<<pvsFront<<endl; 
     544        //  float oldCost = leaf->rays.size(); 
     545        float oldCost = pvsSize; 
     546  float ratio = newCost/oldCost; 
     547        //      cout<<"ratio="<<ratio<<endl; 
     548        return ratio; 
     549} 
     550 
     551float 
     552VssTree::BestCostRatio( 
     553                                                                                         VssTreeLeaf *node, 
     554                                                                                         int &axis, 
     555                                                                                         float &position, 
     556                                                                                         int &raysBack, 
     557                                                                                         int &raysFront 
     558                                                                                         ) 
     559{ 
     560        AxisAlignedBox3 box = GetBBox(node); 
     561        AxisAlignedBox3 dirBox = GetDirBBox(node); 
     562 
     563        axis = box.Size().DrivingAxis(); 
     564         
     565        SortSplitCandidates(node, axis); 
     566   
     567  // go through the lists, count the number of objects left and right 
     568  // and evaluate the following cost funcion: 
     569  // C = ct_div_ci  + (ql*rl + qr*rr)/queries 
     570 
     571  int rl=0, rr=node->rays.size(); 
     572         
     573  float minBox = box.Min(axis); 
     574  float maxBox = box.Max(axis); 
     575  float sizeBox = maxBox - minBox; 
     576   
     577  float minBand = minBox + 0.1*(maxBox - minBox); 
     578  float maxBand = minBox + 0.9*(maxBox - minBox); 
     579   
     580  float sum = rr*sizeBox; 
     581  float minSum = 1e20; 
     582   
     583  for(vector<SortableEntry>::const_iterator ci = splitCandidates->begin(); 
     584      ci < splitCandidates->end(); 
     585      ci++) { 
     586     
     587    switch ((*ci).type) { 
     588    case SortableEntry::ERayMin: 
     589      rl++; 
     590      break; 
     591    case SortableEntry::ERayMax: 
     592      rr--; 
     593      break; 
     594    } 
     595                 
     596    if ((*ci).value > minBand && (*ci).value < maxBand) { 
     597       
     598      sum = rl*((*ci).value - minBox) + rr*(maxBox - (*ci).value); 
     599       
     600      //      cout<<"pos="<<(*ci).value<<"\t q=("<<ql<<","<<qr<<")\t r=("<<rl<<","<<rr<<")"<<endl; 
     601      //      cout<<"cost= "<<sum<<endl; 
     602       
     603      if (sum < minSum) { 
     604                                minSum = sum; 
     605                                position = (*ci).value; 
     606                                 
     607                                raysBack = rl; 
     608                                raysFront = rr; 
     609                                 
     610      } 
     611    } 
     612  } 
     613   
     614  float oldCost = node->rays.size(); 
     615  float newCost = ct_div_ci + minSum/sizeBox; 
     616  float ratio = newCost/oldCost; 
     617   
     618  //  cout<<"===================="<<endl; 
     619  //  cout<<"costRatio="<<ratio<<" pos="<<position<<" t="<<(position - minBox)/(maxBox - minBox) 
     620  //      <<"\t q=("<<queriesBack<<","<<queriesFront<<")\t r=("<<raysBack<<","<<raysFront<<")"<<endl; 
     621 
     622        return ratio; 
     623} 
     624 
     625void 
     626VssTree::SortSplitCandidates( 
     627                                                                                                                 VssTreeLeaf *node, 
     628                                                                                                                 const int axis 
     629                                                                                                                 ) 
     630{ 
     631   
     632  splitCandidates->clear(); 
     633   
     634  int requestedSize = 2*(node->rays.size()); 
     635  // creates a sorted split candidates array 
     636  if (splitCandidates->capacity() > 500000 && 
     637      requestedSize < (int)(splitCandidates->capacity()/10) ) { 
     638     
     639    delete splitCandidates; 
     640    splitCandidates = new vector<SortableEntry>; 
     641  } 
     642   
     643  splitCandidates->reserve(requestedSize); 
     644 
     645  // insert all queries  
     646  for(VssTreeNode::RayInfoContainer::const_iterator ri = node->rays.begin(); 
     647      ri < node->rays.end(); 
     648      ri++) { 
     649    bool positive = (*ri).mRay->HasPosDir(axis); 
     650    splitCandidates->push_back(SortableEntry(positive ? SortableEntry::ERayMin : 
     651                                                                                                                                                                                 SortableEntry::ERayMax, 
     652                                                                                                                                                                                 (*ri).ExtrapOrigin(axis), 
     653                                                                                                                                                                                 (void *)&*ri) 
     654                                                                                                                         ); 
     655                 
     656    splitCandidates->push_back(SortableEntry(positive ? SortableEntry::ERayMax : 
     657                                                                                                                                                                                 SortableEntry::ERayMin, 
     658                                                                                                                                                                                 (*ri).ExtrapTermination(axis), 
     659                                                                                                                                                                                 (void *)&*ri) 
     660                                                                                                                         ); 
     661  } 
     662         
     663  stable_sort(splitCandidates->begin(), splitCandidates->end()); 
    310664} 
    311665 
     
    318672  VssTreeLeaf *leaf = (VssTreeLeaf *)data.node; 
    319673 
    320   if (data.depth > termMaxDepth) 
     674  if (data.depth >= termMaxDepth) 
    321675    stat.maxDepthNodes++; 
    322676   
    323   if ( (int)(leaf->rays.size()) < termMinCost) 
    324     stat.minCostNodes++; 
    325    
    326  
    327   if ( (int)(leaf->rays.size()) > stat.maxRayRefs) 
     677        //  if ( (int)(leaf->rays.size()) < termMinCost) 
     678        //    stat.minCostNodes++; 
     679        if ( leaf->mPvsSize < termMinPvs) 
     680                stat.minCostNodes++; 
     681   
     682        if (leaf->GetAvgRayContribution() > termMaxRayContribution ) 
     683                stat.maxRayContribNodes++; 
     684         
     685        if (SqrMagnitude(data.bbox.Size()) <= termMinSize) { 
     686                stat.minSizeNodes++; 
     687        } 
     688 
     689        if ( (int)(leaf->rays.size()) > stat.maxRayRefs) 
    328690    stat.maxRayRefs = leaf->rays.size(); 
    329    
     691 
    330692} 
    331693 
     
    341703{ 
    342704   
    343   if ( ((int)leaf->rays.size() < termMinCost) || 
    344        (leaf->depth >= termMaxDepth) ) { 
    345     return leaf; 
    346   } 
    347    
    348   float position; 
    349    
     705  if ( (leaf->mPvsSize < termMinPvs) || 
     706                         (leaf->GetAvgRayContribution() > termMaxRayContribution ) || 
     707       (leaf->depth >= termMaxDepth) || 
     708                         SqrMagnitude(box.Size()) <= termMinSize ) { 
     709 
     710#if 0 
     711                if (leaf->depth >= termMaxDepth) { 
     712                        cout<<"Warning: max depth reached depth="<<(int)leaf->depth<<" rays="<<leaf->rays.size()<<endl; 
     713                        cout<<"Bbox: "<<GetBBox(leaf)<<" dirbbox:"<<GetDirBBox(leaf)<<endl; 
     714                } 
     715#endif 
     716                 
     717                return leaf; 
     718        } 
     719         
     720        float position; 
     721         
     722        // first count ray sides 
     723  int raysBack; 
     724  int raysFront; 
     725        int pvsBack; 
     726        int pvsFront; 
     727         
    350728  // select subdivision axis 
    351   int axis = SelectPlane( leaf, box, position); 
     729  int axis = SelectPlane( leaf, box, position, raysBack, raysFront, pvsBack, pvsFront); 
     730 
     731        //      cout<<"rays back="<<raysBack<<" rays front="<<raysFront<<" pvs back="<<pvsBack<<" pvs front="<< 
     732        //              pvsFront<<endl; 
    352733 
    353734  if (axis == -1) { 
     
    364745  node->position = position; 
    365746  node->bbox = box; 
    366  
    367747  node->dirBBox = GetDirBBox(leaf); 
    368748   
     
    370750  frontBBox = box; 
    371751 
    372   // first count ray sides 
    373   int raysBack = 0; 
    374   int raysFront = 0; 
    375    
    376   if (axis <= VssTreeNode::SPLIT_Z) { 
    377     backBBox.SetMax(axis, position); 
    378     frontBBox.SetMin(axis, position); 
    379      
    380     // this is the main ray classification loop! 
    381     for(VssTreeNode::RayInfoContainer::iterator ri = leaf->rays.begin(); 
    382                                 ri != leaf->rays.end(); 
    383                                 ri++) 
    384       if ((*ri).mRay->IsActive()) { 
    385                                  
    386                                 // determine the side of this ray with respect to the plane 
    387                                 int side = node->ComputeRayIntersection(*ri, (*ri).mRay->mT); 
    388                                  
    389                                 (*ri).mRay->mSide = side; 
    390                                  
    391                                 if (side <= 0) 
    392                                         raysBack++; 
    393                                  
    394                                 if (side >= 0) 
    395                                         raysFront++; 
    396                                  
    397 #if 0 
    398         cout<<"-------------------"<<endl; 
    399         cout<<"axis = "<<(int)node->axis<<"\t position="<<node->position<<endl; 
    400         cout<<"origin="<<(*ri).ray->GetOrigin()<<"\t  term="<<(*ri).ray->GetTermination()<<endl; 
    401         cout<<"side = "<<side<<"\t t="<<t<<endl; 
    402         cout<<"-------------------"<<endl; 
    403 #endif 
    404       } 
    405   } else { 
    406     // directional split 
    407     for(VssTreeNode::RayInfoContainer::iterator ri = leaf->rays.begin(); 
    408                                 ri != leaf->rays.end(); 
    409                                 ri++) 
    410       if ((*ri).mRay->IsActive()) { 
    411                                  
    412                                 // determine the side of this ray with respect to the plane 
    413                                 int side; 
    414                                 if ((*ri).mRay->GetNormalizedDir(axis - 3) > position) 
    415                                         side = 1; 
    416                                 else 
    417                                         side = -1; 
    418                                  
    419                                  
    420                                 (*ri).mRay->mSide = side; 
    421                                  
    422                                 if (side <= 0) 
    423                                         raysBack++; 
    424                                  
    425                                 if (side >= 0) 
    426                                         raysFront++; 
    427       } 
    428   } 
    429    
    430752  VssTreeLeaf *back = new VssTreeLeaf(node, raysBack); 
     753        back->mPvsSize = pvsBack; 
    431754  VssTreeLeaf *front = new VssTreeLeaf(node, raysFront); 
     755        front->mPvsSize = pvsFront; 
    432756 
    433757  // replace a link from node's parent 
     
    436760  // and setup child links 
    437761  node->SetupChildLinks(back, front); 
    438  
    439    
     762         
    440763  if (axis <= VssTreeNode::SPLIT_Z) { 
    441     for(VssTreeNode::RayInfoContainer::iterator ri = leaf->rays.begin(); 
     764                backBBox.SetMax(axis, position); 
     765    frontBBox.SetMin(axis, position); 
     766                 
     767                for(VssTreeNode::RayInfoContainer::iterator ri = leaf->rays.begin(); 
    442768                                ri != leaf->rays.end(); 
    443769                                ri++) { 
     
    446772                                // first unref ray from the former leaf 
    447773                                (*ri).mRay->Unref(); 
    448                                  
    449                                 if ((*ri).mRay->mSide == 0) { 
     774 
     775                                // determine the side of this ray with respect to the plane 
     776                                int side = node->ComputeRayIntersection(*ri, (*ri).mRay->mT); 
     777 
     778                                if (side == 0) { 
    450779                                        if ((*ri).mRay->HasPosDir(axis)) { 
    451780                                                back->AddRay(VssTreeNode::RayInfo((*ri).mRay, 
     
    465794                                        } 
    466795                                } else 
    467                                         if ((*ri).mRay->mSide == 1)  
     796                                        if (side == 1)  
    468797                                                front->AddRay(*ri); 
    469798                                        else 
     
    475804    // rays front/back 
    476805     
    477 #if DEBUG_DIR_SPLIT 
    478     cout<<"dir split, depth="<<(int)leaf->depth<<" front= "<<raysFront<<" back="<<raysBack<<endl; 
    479 #endif 
    480806     
    481807    for(VssTreeNode::RayInfoContainer::iterator ri = leaf->rays.begin(); 
     
    485811                                // first unref ray from the former leaf 
    486812                                (*ri).mRay->Unref(); 
    487                                  
    488                                 if ((*ri).mRay->mSide == 1) 
     813 
     814                                int side; 
     815                                if ((*ri).mRay->GetDirParametrization(axis - 3) > position) 
     816                                        side = 1; 
     817                                else 
     818                                        side = -1; 
     819                                 
     820                                if (side == 1) 
    489821                                        front->AddRay(*ri); 
    490822                                else 
     
    573905  // check if we should perform a dynamic subdivision of the leaf 
    574906  if ( 
    575       leaf->rays.size() > (unsigned)termMinCost && 
     907                        //      leaf->rays.size() > (unsigned)termMinCost && 
     908                        (leaf->mPvsSize >= termMinPvs) && 
    576909      SqrMagnitude(leafBBox.Size()) > sizeThreshold) { 
    577910     
  • trunk/VUT/GtpVisibilityPreprocessor/src/VssTree.h

    r372 r382  
    4343  // totals number of rays 
    4444  int rays; 
    45   // total number of query domains 
     45        // initial size of the pvs 
     46  int initialPvsSize; 
     47        // total number of query domains 
    4648  int queryDomains; 
    4749  // total number of ray references 
    4850  int rayRefs; 
    49   // refs in non empty leafs 
    50   int rayRefsNonZeroQuery; 
    51   // total number of query references 
    52   int queryDomainRefs; 
    53   // nodes with zero queries 
    54   int zeroQueryNodes; 
    55   // max depth nodes 
     51 
     52        // max depth nodes 
    5653  int maxDepthNodes; 
    5754  // max depth nodes 
    5855  int minCostNodes; 
     56        // max ray contribution nodes 
     57  int maxRayContribNodes; 
     58        // max depth nodes 
     59  int minSizeNodes; 
     60         
    5961  // max number of rays per node 
    6062  int maxRayRefs; 
     
    7880      splits[i] = 0; 
    7981    rays = queryDomains = 0; 
    80     rayRefs = rayRefsNonZeroQuery = queryDomainRefs = 0; 
    81     zeroQueryNodes = 0; 
     82    rayRefs = 0; 
    8283    maxDepthNodes = 0; 
    8384    minCostNodes = 0; 
    8485    maxRayRefs = 0; 
    8586    addedRayRefs = removedRayRefs = 0; 
     87                initialPvsSize = 0; 
     88                maxRayContribNodes = 0; 
     89                minSizeNodes = 0; 
    8690  } 
    8791 
     
    101105// For sorting rays 
    102106// -------------------------------------------------------------- 
    103 struct  SSortableEntry 
     107struct  SortableEntry 
    104108{ 
    105109  enum EType { 
     
    112116  void *data; 
    113117   
    114   SSortableEntry() {} 
    115   SSortableEntry(const int t, const float v, void *d):type(t), 
    116                                                                                                                                                                                                                         value(v), 
    117                                                       data(d) {} 
    118          
    119   friend bool operator<(const SSortableEntry &a, const SSortableEntry &b) { 
     118  SortableEntry() {} 
     119  SortableEntry(const int t, const float v, void *d):type(t), 
     120                                                                                                                                                                                                                 value(v), 
     121                                                                                                                                                                                                                data(d) {} 
     122         
     123  friend bool operator<(const SortableEntry &a, const SortableEntry &b) { 
    120124    return a.value < b.value; 
    121125  } 
     
    215219        void SetMaxT (const float t) { mMaxT = t; } 
    216220#endif  
     221 
     222 
     223  int ComputeRayIntersection(const float axis, 
     224                                                                                                                 const float position, 
     225                                                                                                                 float &t 
     226                                                                                                                 ) const { 
     227                 
     228                // intersect the ray with the plane 
     229    float denom = mRay->GetDir(axis); 
     230     
     231    if (fabs(denom) < 1e-20) 
     232      //if (denom == 0.0f) 
     233      return (mRay->GetOrigin(axis) > position) ? 1 : -1; 
     234     
     235    t = (position - mRay->GetOrigin(axis))/denom; 
     236 
     237    if (t < GetMinT()) 
     238      return (denom > 0) ? 1 : -1; 
     239 
     240    if (t > GetMaxT()) 
     241      return (denom > 0) ? -1 : 1; 
     242 
     243                return 0; 
     244        } 
     245 
     246 
    217247}; 
    218248 
     
    329359 
    330360   
     361         
    331362  int ComputeRayIntersection(const RayInfo &rayData, 
    332363                                                                                                                 float &t 
    333364                                                                                                                 ) { 
    334                  
    335     // intersect the ray with the plane 
    336     float denom = rayData.mRay->GetDir(axis); 
    337      
    338     if (fabs(denom) < 1e-20) 
    339       //if (denom == 0.0f) 
    340       return (rayData.mRay->GetOrigin(axis) > position) ? 1 : -1; 
    341      
    342     t = (position - rayData.mRay->GetOrigin(axis))/denom; 
    343  
    344     if (t < rayData.GetMinT()) 
    345       return (denom > 0) ? 1 : -1; 
    346  
    347     if (t > rayData.GetMaxT()) 
    348       return (denom > 0) ? -1 : 1; 
    349      
    350     return 0; 
     365                return rayData.ComputeRayIntersection(axis, position, t); 
    351366  } 
    352367 
     
    365380   
    366381  RayInfoContainer rays; 
    367  
    368    
    369   VssTreeLeaf(VssTreeInterior *p, const int n):VssTreeNode(p), rays() { 
    370     rays.reserve(n); 
     382        int mPvsSize; 
     383   
     384  VssTreeLeaf(VssTreeInterior *p, 
     385                                                        const int nRays 
     386                                                        ):VssTreeNode(p), rays(), mPvsSize(0) { 
     387    rays.reserve(nRays); 
    371388  } 
    372389   
     
    392409  } 
    393410 
     411        float GetAvgRayContribution() const { 
     412                return mPvsSize/(float)rays.size(); 
     413        } 
    394414}; 
    395415 
     
    490510  // max depth of the tree 
    491511  int termMaxDepth; 
    492   // minimal cost of the node to still get subdivided 
    493   int termMinCost; 
    494512  // minimal ratio of the volume of the cell and the query volume 
    495513  float termMinSize; 
    496514 
    497   // minimal cost imporvement to subdivide a node 
    498   float maxCostRatio; 
    499    
     515        // minimal pvs per node to still get subdivided 
     516  int termMinPvs; 
     517 
     518  // maximal cost ration to subdivide a node 
     519  float termMaxCostRatio; 
     520         
     521        // maximal contribution per ray to subdivide the node 
     522        float termMaxRayContribution; 
     523 
     524         
    500525  // randomized construction 
    501526  bool randomize; 
    502527 
    503528  // type of the splitting to use fo rthe tree construction 
    504   enum {ESplitRegular, ESplitVolume, ESplitQueries }; 
     529  enum {ESplitRegular, ESplitVolume }; 
    505530  int splitType; 
    506531         
     
    528553   
    529554  // reusable array of split candidates 
    530   vector<SSortableEntry> *splitCandidates; 
     555  vector<SortableEntry> *splitCandidates; 
    531556  ///////////////////////////// 
    532557 
     
    540565  Construct( 
    541566                                                VssRayContainer &rays, 
    542                                                 const bool onlyStaticPart 
     567                                                AxisAlignedBox3 *forcedBoundingBox = NULL 
    543568                                                ); 
    544569         
     
    565590  int 
    566591  SelectPlane(VssTreeLeaf *leaf, 
    567               const AxisAlignedBox3 &box, 
    568               float &position 
    569               ); 
     592                                                        const AxisAlignedBox3 &box, 
     593                                                        float &position, 
     594                                                        int &raysBack, 
     595                                                        int &raysFront, 
     596                                                        int &pvsBack, 
     597                                                        int &pvsFront 
     598                                                        ); 
    570599 
    571600  void 
     
    590619  } 
    591620   
     621        float 
     622        BestCostRatio( 
     623                                                                VssTreeLeaf *node, 
     624                                                                int &axis, 
     625                                                                float &position, 
     626                                                                int &raysBack, 
     627                                                                int &raysFront 
     628                                                                ); 
     629         
     630        float 
     631        EvalCostRatio( 
     632                                                                VssTreeLeaf *node, 
     633                                                                const int axis, 
     634                                                                const float position, 
     635                                                                int &raysBack, 
     636                                                                int &raysFront, 
     637                                                                int &pvsBack, 
     638                                                                int &pvsFront 
     639                                                                ); 
    592640 
    593641  AxisAlignedBox3 GetBBox(const VssTreeNode *node) { 
     
    664712  EvaluateLeafStats(const TraversalData &data); 
    665713 
     714        void 
     715        EvalLeafPvs(VssTreeLeaf *leaf); 
     716 
     717         
    666718}; 
    667719 
  • trunk/VUT/GtpVisibilityPreprocessor/src/default.env

    r376 r382  
    99#       filename vienna.x3d 
    1010# filename ../data/vienna/vienna-simple.x3d 
    11 filename ../data/vienna/vienna-buildings.x3d 
     11# filename ../data/vienna/vienna-buildings.x3d 
    1212# filename ../data/vienna/viewcells-25-sel.x3d 
    1313# filename ../data/atlanta/atlanta2.x3d 
    1414#       filename ../data/soda/soda.dat 
    15 # filename ../data/soda/soda5.dat 
     15filename ../data/soda/soda5.dat 
    1616} 
    1717 
     
    2222 
    2323VssPreprocessor { 
    24         totalSamples 1000000 
    25         samplesPerPass  100000 
     24        totalSamples 200000 
     25        samplesPerPass  50000 
     26} 
     27 
     28VssTree { 
     29        epsilon         1e-6 
     30 
     31        maxDepth        40 
     32        minPvs          10 
     33        minSize         0.00001 
     34        maxCostRatio    1.0 
     35        maxRayContribution 0.5 
     36         
     37        maxTotalMemory  500 
     38        maxStaticMemory 200 
     39 
     40        splitType regular 
     41#       splitType heuristics 
     42 
     43        numberOfEndPointDomains 10000 
     44        ct_div_ci       0.0 
     45        randomize       false 
     46 
     47        refDirBoxMaxSize        0.1 
    2648} 
    2749 
     
    6688 
    6789Sampling { 
    68         totalSamples 100000000 
     90        totalSamples 10000000 
    6991        samplesPerPass  3 
    7092} 
  • trunk/VUT/GtpVisibilityPreprocessor/src/preprocessor.pro

    r372 r382  
    4040ViewCell.cpp ViewCellBsp.cpp Halton.cpp VssRay.cpp VssTree.cpp VssPreprocessor.cpp 
    4141 
    42  
Note: See TracChangeset for help on using the changeset viewer.