Ignore:
Timestamp:
01/17/08 15:56:37 (16 years ago)
Author:
bittner
Message:

merge on nemo

Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp

    r2582 r2606  
    11591159                                 optFloat, 
    11601160                                 "kd_pvs_area=", 
    1161                                  "1e-4"); 
     1161                                 "1e-5"); 
    11621162 
    11631163  RegisterOption("KdTree.splitBorder", 
     
    17001700                                   "false"); 
    17011701 
     1702         
    17021703 
    17031704 
  • GTP/trunk/Lib/Vis/Preprocessing/src/IntelRayCaster.cpp

    r2582 r2606  
    1515FILE *fileOut = 0; 
    1616bool saveRays = false; 
     17bool saveMutationRays = false; 
    1718const int saveRaysStart = 3000000; 
    1819int cntSavedRaysFLUSH = 0; 
     
    4142  if (!InitRayCast(externKdTree)) 
    4243    cout << "warning: intel ray tracer could not be initialized!" << endl; 
    43   if (saveRays) 
     44  if (saveRays || saveMutationRays) 
    4445    InitSaving(); 
    4546} 
     
    5960  return mlrtaLoadAS(externKdTree.c_str()); 
    6061} 
     62 
     63 
     64// Using packet of 4 rays supposing that these are coherent 
     65// We give a box to which each ray is clipped to before the 
     66// ray shooting is computed ! 
    6167 
    6268// Using packet of 4 rays supposing that these are coherent 
     
    7581   
    7682  mlrtaTraverseGroupASEye4(&minBox.x, &maxBox.x, result4, dist4); 
     83 
     84  if (saveMutationRays) { 
     85    fprintf(fileOut, "I %4.7f %4.7f %4.7f %4.7f %4.7f %4.7f\n", 
     86                        minBox.x, minBox.y, minBox.z, maxBox.x, maxBox.y, maxBox.z); 
     87    for (int i = 0; i < 4; i++) { 
     88      fprintf(fileOut, "%d %4.7f %4.7f %4.7f %4.7f %4.7f %4.7f %d %4.7f\n", 
     89                          cntSavedRays, 
     90                          origin4[i].x, 
     91                          origin4[i].y, 
     92                          origin4[i].z, 
     93                          dirs4[i].x, 
     94                          dirs4[i].y, 
     95                          dirs4[i].z, 
     96                          (result4[i] != -1) ? 1 : 0, 
     97                          (result4[i] != -1) ? dist4[i] : 0); 
     98      cntSavedRays ++; 
     99      cntSavedRaysFLUSH++; 
     100    } 
     101    if (cntSavedRaysFLUSH > intSavedLIMIT) { 
     102      fflush(fileOut); 
     103      cntSavedRaysFLUSH = 0; 
     104    } 
     105  } // if we are saving rays 
     106 
    77107  return; 
    78108} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp

    r2575 r2606  
    129129  delete splitCandidates; 
    130130 
    131   float area = GetBox().SurfaceArea() * mKdPvsArea; 
    132  
     131  float area = GetPvsArea(); 
     132   
    133133  SetPvsTerminationNodes(area); 
    134134   
    135135  return true; 
     136} 
     137 
     138float 
     139KdTree::GetPvsArea() const { 
     140  return GetBox().SurfaceArea() * mKdPvsArea; 
    136141} 
    137142 
     
    891896 
    892897void 
     898KdTree::CollectSmallKdObjects(const AxisAlignedBox3 &box, 
     899                                                          ObjectContainer &objects, 
     900                                                          const float maxAreaFrac 
     901                                                          ) 
     902{ 
     903  stack<KdNode *> nodeStack; 
     904   
     905  nodeStack.push(mRoot); 
     906  float maxArea = GetPvsArea()*maxAreaFrac; 
     907   
     908  while (!nodeStack.empty()) { 
     909    KdNode *node = nodeStack.top(); 
     910    nodeStack.pop(); 
     911        if (!node->Mailed()) { 
     912          node->Mail(); 
     913          if (node->IsLeaf() || GetSurfaceArea(node) <= maxArea)  { 
     914                Intersectable *object = GetOrCreateKdIntersectable(node); 
     915                if (!node->Mailed()) { 
     916                  objects.push_back(object); 
     917                } 
     918          } 
     919          else { 
     920                KdInterior *interior = (KdInterior *)node; 
     921                 
     922                if ( box.Max()[interior->mAxis] > interior->mPosition ) 
     923                  nodeStack.push(interior->mFront); 
     924                 
     925                if (box.Min()[interior->mAxis] < interior->mPosition) 
     926                  nodeStack.push(interior->mBack); 
     927          } 
     928        } 
     929  } // while 
     930} 
     931 
     932 
     933void 
    893934KdTree::CollectObjects(const AxisAlignedBox3 &box, 
    894935                       ObjectContainer &objects) 
     
    14511492    KdNode *node = nodeStack.top(); 
    14521493    nodeStack.pop(); 
    1453  
     1494         
    14541495    node->mPvsTermination = 0; 
    14551496    if (node->IsLeaf() || (GetSurfaceArea(node) <= maxArea) ) { 
  • GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.h

    r2575 r2606  
    344344  void 
    345345  SetPvsTerminationNodes(const float maxArea); 
     346 
     347  float 
     348  GetPvsArea() const; 
    346349   
    347350  KdNode * 
     
    353356                   ObjectContainer &objects 
    354357                   ); 
     358 
     359  // colect objects which are in the bounding box by explictly specifying the 
     360  // allowed size of the boxes. If this size is smaller than size used for pvs entries 
     361  // filtering will be more precise 
     362  void 
     363  CollectSmallKdObjects(const AxisAlignedBox3 &box, 
     364                                                ObjectContainer &objects, 
     365                                                const float maxArea 
     366                                                ); 
    355367 
    356368  void 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Makefile

    r2603 r2606  
    11############################################################################# 
    22# Makefile for building: preprocessor 
    3 # Generated by qmake (2.00a) (Qt 4.1.2) on: st 16. I 22:10:45 2008 
     3# Generated by qmake (2.00a) (Qt 4.1.2) on: ?t 17. I 15:26:52 2008 
    44# Project:  preprocessor.pro 
    55# Template: app 
     
    6363        $(MAKE) -f $(MAKEFILE).Debug uninstall 
    6464 
    65 Makefile: preprocessor.pro  C:/Qt/4.1.2/mkspecs/win32-msvc.net\qmake.conf C:/Qt/4.1.2/mkspecs/qconfig.pri \ 
     65Makefile: preprocessor.pro  C:/Qt/4.1.2/mkspecs/win32-msvc2005\qmake.conf C:/Qt/4.1.2/mkspecs/qconfig.pri \ 
    6666                C:\Qt\4.1.2\mkspecs\features\qt_config.prf \ 
    6767                C:\Qt\4.1.2\mkspecs\features\exclusive_builds.prf \ 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Mutation.cpp

    r2599 r2606  
    8383#endif 
    8484 
    85   for (int i=0; i < vssRays.size(); i++) { 
    86         if (vssRays[i]->mPvsContribution) { 
    87           // reset the counter of unsuccsseful mutation for a generating ray (if it exists) 
    88           if (vssRays[i]->mDistribution == MUTATION_BASED_DISTRIBUTION && 
    89                   vssRays[i]->mGeneratorId != -1 
     85  for (int i=0; i < vssRays.size(); i++)  
     86        if (vssRays[i]->mTerminationObject) { 
     87          if (vssRays[i]->mPvsContribution) { 
     88                // reset the counter of unsuccsseful mutation for a generating ray (if it exists) 
     89                if (vssRays[i]->mDistribution == MUTATION_BASED_DISTRIBUTION && 
     90                        vssRays[i]->mGeneratorId != -1 
    9091                  ) { 
    91                 mRays[vssRays[i]->mGeneratorId].mUnsuccessfulMutations = 0; 
     92                  mRays[vssRays[i]->mGeneratorId].mUnsuccessfulMutations = 0; 
    9293#if EVALUATE_MUTATION_STATS  
    93                 mutationRays++; 
     94                  mutationRays++; 
     95                   
     96                  Intersectable *newObject = vssRays[i]->mTerminationObject; 
    9497                 
    95                 Intersectable *newObject = vssRays[i]->mTerminationObject; 
    96                  
    97                 Intersectable *oldObject = mRays[vssRays[i]->mGeneratorId].mRay->mTerminationObject; 
    98                 // the ray generated a contribution although it hits the same object 
     98                  Intersectable *oldObject = mRays[vssRays[i]->mGeneratorId].mRay->mTerminationObject; 
     99                  // the ray generated a contribution although it hits the same object 
    99100                // mark this using a counter 
    100101                if (oldObject == newObject) 
     
    144145                          mRays[newRay->mGeneratorId].SetReverseMutation(origin, termination); 
    145146                        } 
    146                          
    147147                        reverseCandidates++; 
    148148                        //mReverseCandidates 
     
    311311{ 
    312312#ifdef GTP_INTERNAL 
    313  
     313  static int counter = 0; 
     314 
     315   
    314316  // first reconstruct the termination point 
    315317  Vector3 oldDir = Normalize(oldRay.GetDir()); 
     
    331333 
    332334  Intersectable *occluder = newRay.mTerminationObject; 
    333    
     335 
     336 
    334337  AxisAlignedBox3 box = occluder->GetBox(); 
    335338  // consider slightly larger neighborhood of the occluder 
     
    337340  box.Scale(2.0f); 
    338341  //box.Scale(200.0f); 
     342 
    339343   
    340344  const int packetSize = 4; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ObjectPvs.cpp

    r2575 r2606  
    137137 
    138138        Intersectable::NewMail(); 
    139         KdLeaf::NewMail(); 
     139        KdNode::NewMail(); 
    140140 
    141141        ObjectPvsIterator pit = GetIterator(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r2603 r2606  
    12081208 
    12091209        // !!!!!!!!!!!!!!!! VH no sorting 
    1210         if ( 
    1211             rays.size() > 10000) 
     1210        if (  
     1211            rays.size() > 10000 
     1212                ) 
    12121213          { 
    1213  
    12141214          mRayCaster->SortRays(rays); 
    12151215          cout<<"Rays sorted in "<<TimeDiff(t1, GetTime())<<" ms."<<endl; 
     
    15651565void Preprocessor::DeterminePvsObjects(VssRayContainer &rays) 
    15661566{ 
    1567         mViewCellsManager->DeterminePvsObjects(rays, false); 
     1567  mViewCellsManager->DeterminePvsObjects(rays, false); 
    15681568} 
    15691569 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SceneGraph.h

    r2601 r2606  
    3737        virtual void UpdateBox(); 
    3838 
     39        ~SceneGraphInterior(); 
     40 
    3941//protected: 
    4042 
     
    5153        virtual bool IsLeaf() const { return true; } 
    5254        virtual void UpdateBox(); 
     55 
     56        ~SceneGraphLeaf(); 
    5357 
    5458//protected: 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r2601 r2606  
    24742474int ViewCellsManager::GetNumViewCells() const 
    24752475{ 
    2476         return (int)mViewCells.size(); 
     2476  return (int)mViewCells.size(); 
    24772477} 
    24782478 
     
    24932493                   
    24942494                  // set only the termination object 
     2495                  //              if (vssRay->mTerminationObject == NULL)  
     2496                  //                    cerr<<"Error NULL termination object!"<<endl; 
    24952497                  vssRay->mTerminationObject = GetIntersectable(*vssRay, true); 
    2496                 } 
    2497         } 
     2498#if 0 
     2499                  if (vssRay->mTerminationObject == NULL) { 
     2500                        cerr<<"Error in DeterminePvsObjects - termination object maps to NULL!"<<endl; 
     2501                  } 
     2502#endif 
     2503                } 
     2504        } 
     2505   
    24982506} 
    24992507 
     
    32473255                for (int i = 0; it != it_end; ++ it, ++ i) 
    32483256                { 
    3249                         if ((*it) != viewCell)  
     3257                  if ((*it) != viewCell)  
    32503258                        { 
    3251                                 //cout<<"v"<<i<<" pvs="<<(*it)->GetPvs().mEntries.size()<<endl; 
    3252                                 basePvs.MergeInPlace((*it)->GetPvs()); 
     3259                          //cout<<"v"<<i<<" pvs="<<(*it)->GetPvs().mEntries.size()<<endl; 
     3260                          basePvs.MergeInPlace((*it)->GetPvs()); 
    32533261                        } 
    3254  
    3255                         // update samples and globalC 
    3256                         samples = (float)pvs.GetSamples(); 
    3257                         //      cout<<"neighboring viewcells = "<<i-1<<endl; 
    3258                         //      cout<<"Samples' = "<<samples<<endl; 
     3262                   
     3263                  // update samples and globalC 
     3264                  samples = (float)pvs.GetSamples(); 
     3265                  //    cout<<"neighboring viewcells = "<<i-1<<endl; 
     3266                  //    cout<<"Samples' = "<<samples<<endl; 
    32593267                } 
    32603268        } 
     
    33423350 
    33433351                        if (filteredBoxes) 
    3344                                 filteredBoxes->push_back(box); 
    3345  
     3352                          filteredBoxes->push_back(box); 
     3353                         
    33463354                        objects.clear(); 
    33473355 
    33483356                        // $$ warning collect objects takes only unmailed ones! 
    3349                         if (mUseKdPvs)  
    3350                                 GetPreprocessor()->mKdTree->CollectKdObjects(box, objects); 
    3351                         else 
    3352                                 CollectObjects(box, objects); 
    3353  
     3357                        if (mUseKdPvs) { 
     3358                          //                      GetPreprocessor()->mKdTree->CollectKdObjects(box, objects); 
     3359                          GetPreprocessor()->mKdTree->CollectSmallKdObjects(box, objects, 0.1f); 
     3360 
     3361                        } else 
     3362                          CollectObjects(box, objects); 
     3363                         
    33543364                        //      cout<<"collected objects="<<objects.size()<<endl; 
    33553365                        ObjectContainer::const_iterator noi = objects.begin(); 
    33563366                        for (; noi != objects.end(); ++ noi)  
    3357                         { 
     3367                          { 
    33583368                                Intersectable *o = *noi; 
    33593369                                // $$ JB warning: pdfs are not correct at this point!      
  • GTP/trunk/Lib/Vis/Preprocessing/src/default.env

    r2602 r2606  
    33# Jiri Bittner 2003 
    44############################################################################# 
     5 
    56 
    67Scene { 
     
    179180        } 
    180181 
    181         splitMethod spatialMedian 
    182 #       splitMethod SAH 
     182#       splitMethod spatialMedian 
     183        splitMethod SAH 
    183184        splitBorder 0.01 
    184         pvsArea 1e-3 
    185 } 
     185        pvsArea 1e-5 
     186} 
     187 
    186188 
    187189 
     
    202204        importRandomViewCells false 
    203205 
    204         useKdPvs false 
     206        useKdPvs true 
    205207        useKdPvsAfterFiltering true 
    206208        # samples used for view cell construction 
  • GTP/trunk/Lib/Vis/Preprocessing/src/run_test_pompeii

    r2105 r2606  
    44#COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish+ -preprocessor_use_gl_renderer- -preprocessor_evaluate_filter- -preprocessor_detect_empty_viewspace- -total_samples=500000000" 
    55 
    6 COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish+ -preprocessor_use_gl_renderer- -preprocessor_evaluate_filter- -preprocessor_detect_empty_viewspace+ -samples_per_evaluation=5000000 -samples_per_pass=1000000 -total_samples=250000000 -view_cells_use_kd_pvs+" 
     6COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish+ -preprocessor_use_gl_renderer- -preprocessor_evaluate_filter- -preprocessor_detect_empty_viewspace+ -samples_per_evaluation=5000000 -samples_per_pass=1000000 -total_samples=250000000 -view_cells_use_kd_pvs+ -kd_pvs_area=1e-5" 
    77 
    88 
Note: See TracChangeset for help on using the changeset viewer.