Changeset 1112


Ignore:
Timestamp:
07/10/06 19:21:19 (18 years ago)
Author:
bittner
Message:

Merge with Olivers code

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

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/AxisAlignedBox3.h

    r1012 r1112  
    176176        mMax = center + newSize; 
    177177  } 
    178    
     178 
     179  void Scale(const Vector3 &scale) { 
     180        Vector3 newSize = Size()*(scale*0.5f); 
     181        Vector3 center = Center(); 
     182        mMin = center - newSize; 
     183        mMax = center + newSize; 
     184  } 
     185 
     186  /** Translates the box with the factor. 
     187  */ 
     188  void Translate(const Vector3 &shift) { 
     189        mMin += shift; 
     190        mMax += shift; 
     191  } 
     192 
    179193  /** Returns the square of the minimal and maximal distance to  
    180194        a point on the box. 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp

    r1106 r1112  
    16951695        RegisterOption("Preprocessor.quitOnFinish", 
    16961696                                   optBool, 
    1697                                    "preprocessor_quit_on_finish=", 
     1697                                   "preprocessor_quit_on_finish", 
    16981698                                   "true"); 
    16991699 
     
    17991799        RegisterOption("RssPreprocessor.useImportanceSampling", 
    18001800                                        optBool, 
    1801                                         "rss_use_importance=", 
     1801                                        "rss_use_importance", 
    18021802                                        "true"); 
    18031803 
    18041804        RegisterOption("RssPreprocessor.objectBasedSampling", 
    18051805                                        optBool, 
    1806                                         "rss_object_based_sampling=", 
     1806                                        "rss_object_based_sampling", 
    18071807                                        "true"); 
    18081808 
    18091809        RegisterOption("RssPreprocessor.directionalSampling", 
    18101810                                        optBool, 
    1811                                         "rss_directional_sampling=", 
     1811                                        "rss_directional_sampling", 
    18121812                                        "false"); 
    18131813 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.h

    r1106 r1112  
    8888                         const RgbColor &color = RgbColor(1,1,1) 
    8989                         ) = 0; 
    90    
     90 
     91  virtual bool 
     92  ExportRaySets(const vector<VssRayContainer> &rays, 
     93                                const RgbColor &color) = 0; 
     94 
    9195  virtual void  
    9296  ExportViewCells(const ViewCellContainer &viewCells) = 0; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp

    r1004 r1112  
    7373{ 
    7474  mSceneGraph->CollectObjects(&mObjects); 
     75 
     76  //  mViewCellsManager->GetViewPoint(mViewPoint); 
     77 
    7578  mViewPoint = mSceneGraph->GetBox().Center(); 
    7679  mViewDirection = Vector3(0,0,1); 
    7780 
    78   mViewPoint = Vector3(991.7, 187.8, -271); 
    79   mViewDirection = Vector3(0.9, 0, -0.4); 
     81  //  mViewPoint = Vector3(991.7, 187.8, -271); 
     82  //  mViewDirection = Vector3(0.9, 0, -0.4); 
    8083 
    8184  //  timerId = startTimer(10); 
     
    740743  // different executions of the algorithm 
    741744 
    742   //mViewCellsManager->GetViewPoint(mViewPoint); 
     745  //  mViewCellsManager->GetViewPoint(mViewPoint); 
    743746 
    744747  while (1) { 
     
    747750                                                          halton.GetNumber(3)); 
    748751         
    749         mViewPoint =  mSceneGraph->GetBox().GetPoint(pVector); 
     752        mViewPoint =  mViewCellsManager->GetViewSpaceBox().GetPoint(pVector); 
    750753        ViewCell *v = mViewCellsManager->GetViewCell(mViewPoint); 
    751754        if (v && v->GetValid()) 
     
    754757        halton.GenerateNext(); 
    755758  } 
    756    
    757759   
    758760  Vector3 dVector = Vector3(2*M_PI*halton.GetNumber(4), 
     
    816818        glDepthMask(GL_FALSE); 
    817819        glDisable( GL_CULL_FACE ); 
     820 
    818821         
    819822        query.BeginQuery(); 
     
    840843   
    841844  PrVs prvs; 
    842   //  mViewCellsManager->SetMaxFilterSize(1); 
     845   
     846  mViewCellsManager->SetMaxFilterSize(0); 
    843847  mViewCellsManager->GetPrVS(mViewPoint, prvs, mViewCellsManager->GetFilterWidth()); 
    844848  viewcell = prvs.mViewCell; 
     
    898902                        if (qGreen(p) != 255 && index!=0) { 
    899903                          if (index != lastIndex) { 
    900                                 Debug<<"ei="<<index<<" "; 
     904                                //                              Debug<<"ei="<<index<<" "; 
    901905                                lastIndex = index; 
    902906                          } 
     
    931935  } 
    932936 
    933   if (viewcell) 
     937  if (viewcell && mViewCellsManager->GetMaxFilterSize() > 0) 
    934938        mViewCellsManager->DeleteLocalMergeTree(viewcell); 
    935939   
     
    11831187 
    11841188  makeCurrent(); 
     1189 
     1190 
    11851191  SetupProjection(GetWidth(), GetHeight()); 
     1192 
    11861193   
    11871194  for (int i=0; i < mPvsStatFrames; i++) { 
     
    12041211        if (mPvsErrorBuffer[i].mError > 0.0f) { 
    12051212          int pvsSize; 
     1213 
     1214 
    12061215          float error = GetPixelError(pvsSize); 
    12071216          mPvsErrorBuffer[i].mError = error; 
     
    13701379        updateGL(); 
    13711380        break; 
     1381  case Qt::Key_P: 
     1382        // set random viewpoint 
     1383        mViewCellsManager->GetViewPoint(mViewPoint); 
     1384        updateGL(); 
     1385        break; 
     1386 
    13721387  default: 
    13731388        e->ignore(); 
     
    15791594  mRenderErrors = false; 
    15801595  mRenderFilter = true; 
    1581   mUseFilter = true; 
    1582   mUseSpatialFilter = true; 
     1596 
     1597  bool tmp; 
     1598 
     1599  Environment::GetSingleton()->GetBoolValue("Preprocessor.applyVisibilityFilter", tmp ); 
     1600  mUseFilter = tmp; 
     1601   
     1602  Environment::GetSingleton()->GetBoolValue("Preprocessor.applyVisibilitySpatialFilter", 
     1603                                                        tmp ); 
     1604 
     1605  mUseSpatialFilter = tmp; 
     1606 
    15831607  mShowRenderCost = false; 
    15841608  mShowPvsSizes = false; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.h

    r1109 r1112  
    1313namespace GtpVisibilityPreprocessor { 
    1414 
    15 class KdNode; 
    16 class KdLeaf; 
    17 class KdInterior; 
    18 class Intersectable; 
    19 //class KdViewCell; 
    20 class Beam; 
     15   
     16  class KdNode; 
     17  class KdLeaf; 
     18  class KdInterior; 
     19  class Intersectable; 
     20  //class KdViewCell; 
     21  class Beam; 
     22 
     23  class KdTree; 
     24   
     25  //  KdTree *SceneKdTree; 
    2126 
    2227// -------------------------------------------------------------- 
  • GTP/trunk/Lib/Vis/Preprocessing/src/LogManager.h

    r1004 r1112  
    3434        LogManager(); 
    3535 
    36         ~LogManager(); 
     36  ~LogManager() {} 
    3737   
    3838        void LogMessage(const std::string &str); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Makefile

    r878 r1112  
    11############################################################################# 
    22# Makefile for building: preprocessor 
    3 # Generated by qmake (2.00a) (Qt 4.1.2) on: út 2. V 11:18:23 2006 
     3# Generated by qmake (2.00a) (Qt 4.1.2) on: po 10. VII 19:18:45 2006 
    44# Project:  preprocessor.pro 
    55# Template: app 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r1022 r1112  
    384384                Environment::GetSingleton()->GetStringValue("ViewCells.type", buf);              
    385385            mViewCellsManager = CreateViewCellsManager(buf); 
    386         } 
    387  
     386 
     387                // default view space is the extent of the scene 
     388                mViewCellsManager->SetViewSpaceBox(mSceneGraph->GetBox()); 
     389 
     390 
     391        } 
     392         
    388393        //-- parameters for render heuristics evaluation 
    389394        float objRenderCost = 0, vcOverhead = 0, moveSpeed = 0; 
     
    398403        mViewCellsManager->SetRenderer(mRenderSimulator); 
    399404 
    400         // default view space is the extent of the scene 
    401         mViewCellsManager->SetViewSpaceBox(mSceneGraph->GetBox()); 
    402405 
    403406        if (mUseGlRenderer || mUseGlDebugger) 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h

    r1089 r1112  
    281281   
    282282  if (data)  { 
    283         data->mSumPdf+=pdf; 
     283        data->mSumPdf += pdf; 
    284284        return data->mSumPdf; 
    285285  } 
     
    299299   
    300300  if (data)  { 
    301         data->mSumPdf+=pdf; 
     301        data->mSumPdf += pdf; 
    302302        contribution = pdf/data->mSumPdf; 
    303303        return false; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Ray.h

    r860 r1112  
    317317public: 
    318318   
    319   float mSumPdf; 
    320    
    321   SimpleRayContainer():vector<SimpleRay>(), mSumPdf(0.0f) {} 
    322    
    323   void NormalizePdf() { 
     319   
     320  SimpleRayContainer():vector<SimpleRay>() {} 
     321   
     322  void NormalizePdf(float scale = 1.0f) { 
    324323        iterator it = begin(); 
    325         float c = 1.0f/mSumPdf; 
     324        float sumPdf = 0.0f; 
    326325        for (; it != end(); it++) 
     326          sumPdf += (*it).mPdf; 
     327 
     328        float c = scale/sumPdf; 
     329         
     330        for (it = begin(); it != end(); it++) { 
    327331          (*it).mPdf*=c; 
    328   } 
    329  
     332        } 
     333  } 
     334   
    330335  void AddRay(const SimpleRay &ray) { 
    331336        push_back(ray); 
    332         mSumPdf += ray.mPdf; 
    333337  } 
    334338}; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.cpp

    r1027 r1112  
    2323static bool fromBoxVisibility = false; 
    2424 
    25  
     25#define ADD_RAYS_IN_PLACE 0 
     26   
    2627RssPreprocessor::RssPreprocessor(): 
    2728  mPass(0), 
     
    6768          GenerateImportanceRays(mRssTree, number, rays); 
    6869          result = true; 
    69           //      rays.NormalizePdf(); 
    7070        } 
    7171        break; 
     
    7575  } 
    7676 
     77  //  rays.NormalizePdf(); 
     78   
    7779  return result; 
    7880} 
     
    120122  int hits = 0; 
    121123  static Ray ray; 
    122   AxisAlignedBox3 box = mKdTree->GetBox(); 
     124  //  AxisAlignedBox3 box = Union(mKdTree->GetBox(), mViewCellsManager->GetViewSpaceBox()); 
     125 
     126  AxisAlignedBox3 box = mViewCellsManager->GetViewSpaceBox(); 
    123127 
    124128  AxisAlignedBox3 sbox = box; 
     
    284288  } else { 
    285289        int leaves = rssTree->stat.Leaves()/1; 
     290         
    286291        num = rssTree->GenerateRays(desiredSamples, leaves, rays); 
    287292  } 
     
    302307  Exporter *exporter = NULL; 
    303308  exporter = Exporter::GetExporter(filename); 
    304   //    exporter->SetWireframe(); 
    305   //    exporter->ExportKdTree(*mKdTree); 
     309  if (0) { 
     310        exporter->SetWireframe(); 
     311        exporter->ExportKdTree(*mKdTree); 
     312  } 
    306313  exporter->SetFilled(); 
    307314  // $$JB temporarily do not export the scene 
     
    310317  exporter->SetWireframe(); 
    311318 
    312   if (mViewSpaceBox) { 
     319  if (1 || mViewSpaceBox) { 
    313320        exporter->SetForcedMaterial(RgbColor(1,0,1)); 
    314         exporter->ExportBox(*mViewSpaceBox); 
     321        exporter->ExportBox(mViewCellsManager->GetViewSpaceBox()); 
    315322        exporter->ResetForcedMaterial(); 
    316323  } 
    317          
     324   
    318325  VssRayContainer rays; 
    319326   
    320   vssRays.SelectRays( number, rays); 
     327  vssRays.SelectRays(number, rays); 
    321328 
    322329  exporter->ExportRays(rays, RgbColor(1, 0, 0)); 
     330         
     331  delete exporter; 
     332 
     333  cout<<"done."<<endl<<flush; 
     334 
     335  return true; 
     336} 
     337 
     338bool 
     339RssPreprocessor::ExportRayAnimation(const char *filename, 
     340                                                                        const vector<VssRayContainer> &vssRays 
     341                                                                        ) 
     342{ 
     343  cout<<"Exporting vss rays..."<<endl<<flush; 
     344         
     345  Exporter *exporter = NULL; 
     346  exporter = Exporter::GetExporter(filename); 
     347  if (0) { 
     348        exporter->SetWireframe(); 
     349        exporter->ExportKdTree(*mKdTree); 
     350  } 
     351  exporter->SetFilled(); 
     352  // $$JB temporarily do not export the scene 
     353  if (1) 
     354        exporter->ExportScene(mSceneGraph->mRoot); 
     355  exporter->SetWireframe(); 
     356 
     357  if (1 || mViewSpaceBox) { 
     358        exporter->SetForcedMaterial(RgbColor(1,0,1)); 
     359        exporter->ExportBox(mViewCellsManager->GetViewSpaceBox()); 
     360        exporter->ResetForcedMaterial(); 
     361  } 
     362   
     363  exporter->ExportRaySets(vssRays, RgbColor(1, 0, 0)); 
    323364         
    324365  delete exporter; 
     
    459500} 
    460501 
    461  
     502void 
     503NormalizeRatios(float ratios[3]) 
     504{ 
     505  int i; 
     506  float sumRatios; 
     507  sumRatios = ratios[0] + ratios[1] + ratios[2]; 
     508  if (sumRatios == 0.0f) { 
     509        ratios[0] = ratios[1] = ratios[2] = 1.0f; 
     510        sumRatios = 3.0f; 
     511  } 
     512   
     513  for (i=0 ; i < 3; i++) 
     514        ratios[i]/=sumRatios; 
     515#define MIN_RATIO 0.03f 
     516  for (i=0 ; i < 3; i++) 
     517        if (ratios[i] < MIN_RATIO) 
     518          ratios[i] = MIN_RATIO; 
     519 
     520  sumRatios = ratios[0] + ratios[1] + ratios[2]; 
     521  for (i=0 ; i < 3; i++) 
     522        ratios[i]/=sumRatios; 
     523   
     524} 
    462525 
    463526bool 
     
    472535  Randomize(0); 
    473536   
    474          
     537  vector<VssRayContainer> rayBuffer(50); 
     538   
    475539  long startTime = GetTime(); 
    476540   
     
    480544 
    481545  // if not already loaded, construct view cells from file 
    482   if (!mLoadViewCells) {         
    483  
    484         if (0)  
     546  if (!mLoadViewCells) 
     547  { 
     548        if (1)  
    485549          mViewCellsManager->SetViewSpaceBox(mKdTree->GetBox()); 
    486550        else { 
    487551          AxisAlignedBox3 box = mKdTree->GetBox(); 
    488           float s = box.Size(0); 
    489           box.Scale(0.1f); 
    490           box.SetMin(0, box.Min(0) + s); 
    491           box.SetMax(0, box.Max(0) + s); 
     552           
     553          if (1) { 
     554                // use a small box outside of the scene 
     555                box.Scale(Vector3(0.1f,0.5f,0.5f)); 
     556                box.Translate(Vector3(Magnitude(mKdTree->GetBox().Size())*0.5, 0, 0)); 
     557          } else { 
     558                float s = box.Size(0); 
     559                box.Scale(0.1f); 
     560                box.SetMin(0, box.Min(0) + s); 
     561                box.SetMax(0, box.Max(0) + s); 
     562          } 
    492563          
    493564          mViewCellsManager->SetViewSpaceBox(box); 
    494565        } 
    495  
    496           // construct view cells using it's own set of samples 
    497           mViewCellsManager->Construct(this); 
    498  
    499           //-- several visualizations and statistics 
    500           Debug << "view cells construction finished: " << endl; 
    501           mViewCellsManager->PrintStatistics(Debug); 
    502   } 
    503  
    504  
     566         
     567        // construct view cells using it's own set of samples 
     568        mViewCellsManager->Construct(this); 
     569         
     570        //-- several visualizations and statistics 
     571        Debug << "view cells construction finished: " << endl; 
     572        mViewCellsManager->PrintStatistics(Debug); 
     573  } 
     574   
     575   
    505576  int rssPass = 0; 
    506577  int rssSamples = 0; 
     
    515586        cout<<"Generating initial rays..."<<endl<<flush; 
    516587 
    517         GenerateRays(mInitialSamples/4, SPATIAL_BOX_BASED_DISTRIBUTION, rays); 
    518         GenerateRays(mInitialSamples/4, OBJECT_BASED_DISTRIBUTION, rays); 
    519         GenerateRays(mInitialSamples/4, DIRECTION_BASED_DISTRIBUTION, rays); 
    520         GenerateRays(mInitialSamples/4, OBJECT_DIRECTION_BASED_DISTRIBUTION, rays); 
    521          
     588        GenerateRays(mInitialSamples/3, SPATIAL_BOX_BASED_DISTRIBUTION, rays); 
     589        GenerateRays(mInitialSamples/3, OBJECT_BASED_DISTRIBUTION, rays); 
     590        GenerateRays(mInitialSamples/3, DIRECTION_BASED_DISTRIBUTION, rays); 
     591        //      GenerateRays(mInitialSamples/4, OBJECT_DIRECTION_BASED_DISTRIBUTION, rays); 
     592 
    522593        cout<<"Casting initial rays..."<<endl<<flush; 
    523594        CastRays(rays, mVssRays); 
     
    537608        sprintf(filename, "rss-rays-initial.x3d"); 
    538609        ExportRays(filename, mVssRays, mExportNumRays); 
     610 
     611        mVssRays.SelectRays(mExportNumRays, rayBuffer[0], true); 
    539612         
    540613  } 
     
    562635        { 
    563636          VssRayContainer contributingRays; 
    564           mVssRays.GetContributingRays(contributingRays, mPass); 
     637          mVssRays.GetContributingRays(contributingRays, 0); 
    565638          mStats<<"#NUM_CONTRIBUTING_RAYS\n"<<(int)contributingRays.size()<<endl; 
     639          if (mExportRays) { 
     640                char filename[64]; 
     641                sprintf(filename, "rss-crays-%04d.x3d", 0); 
     642                ExportRays(filename, contributingRays, mExportNumRays); 
     643          } 
    566644        } 
    567645         
     
    615693          VssRayContainer tmpVssRays; 
    616694 
    617           float ratios[] = {0.8f,0.1f,0.1f}; 
    618  
     695          static float ratios[] = {0.9f,0.05f,0.05f}; 
     696          //float ratios[] = {1.0f,0.0f,0.0f}; 
     697           
     698          int nrays[3]; 
     699          float contributions[3]; 
     700          float times[3]; 
     701           
     702          long t1, t2; 
     703 
     704          t1 = GetTime(); 
     705           
    619706          GenerateRays(mRssSamplesPerPass*ratios[0], RSS_BASED_DISTRIBUTION, rays); 
     707 
     708          rays.NormalizePdf(rays.size()); 
     709           
    620710          CastRays(rays, tmpVssRays); 
    621711          castRays += rays.size(); 
    622           float c1 = mViewCellsManager->ComputeSampleContributions(tmpVssRays, false, true); 
    623           mStats<<"#RssRelContrib"<<endl<<c1/rays.size()<<endl; 
    624  
     712#if ADD_RAYS_IN_PLACE  
     713          contributions[0] = mViewCellsManager->ComputeSampleContributions(tmpVssRays, true, false); 
     714#else 
     715          contributions[0] = mViewCellsManager->ComputeSampleContributions(tmpVssRays, false, true); 
     716#endif 
     717          times[0] = TimeDiff(t1, GetTime()); 
     718          nrays[0] = rays.size(); 
     719           
     720          mStats<<"#RssRelContrib"<<endl<<contributions[0]/nrays[0]<<endl; 
     721           
    625722          vssRays.insert(vssRays.end(), tmpVssRays.begin(), tmpVssRays.end() ); 
    626723          rays.clear(); 
    627724          tmpVssRays.clear(); 
    628  
    629725          if (ratios[1]!=0.0f) { 
     726                t1 = GetTime(); 
    630727                GenerateRays(mRssSamplesPerPass*ratios[1], SPATIAL_BOX_BASED_DISTRIBUTION, rays); 
    631728                CastRays(rays, tmpVssRays); 
    632729                castRays += rays.size(); 
    633                 float c2 = mViewCellsManager->ComputeSampleContributions(tmpVssRays, false, true); 
    634                 mStats<<"#SpatialRelContrib"<<endl<<c2/rays.size()<<endl; 
     730#if ADD_RAYS_IN_PLACE  
     731                contributions[1] = mViewCellsManager->ComputeSampleContributions(tmpVssRays, true, false); 
     732#else 
     733                contributions[1] = mViewCellsManager->ComputeSampleContributions(tmpVssRays, false, true); 
     734#endif 
     735          times[1] = TimeDiff(t1, GetTime()); 
     736          nrays[1] = rays.size(); 
     737 
     738          mStats<<"#SpatialRelContrib"<<endl<<contributions[1]/nrays[1]<<endl; 
    635739                 
    636740                vssRays.insert(vssRays.end(), tmpVssRays.begin(), tmpVssRays.end() ); 
     
    642746           
    643747          if (ratios[2]!=0.0f) { 
     748                t1 = GetTime(); 
    644749                GenerateRays(mRssSamplesPerPass*ratios[2], DIRECTION_BASED_DISTRIBUTION, rays); 
    645750                CastRays(rays, tmpVssRays); 
    646751                castRays += rays.size(); 
    647                 float c3 = mViewCellsManager->ComputeSampleContributions(tmpVssRays, false, true); 
    648                 mStats<<"#DirectionalRelContrib"<<endl<<c3/rays.size()<<endl; 
     752#if ADD_RAYS_IN_PLACE  
     753                contributions[2] = mViewCellsManager->ComputeSampleContributions(tmpVssRays, true, false); 
     754#else 
     755                contributions[2] = mViewCellsManager->ComputeSampleContributions(tmpVssRays, false, true); 
     756#endif 
     757                times[2] = TimeDiff(t1, GetTime()); 
     758                nrays[2] = rays.size(); 
     759                 
     760                mStats<<"#DirectionalRelContrib"<<endl<<contributions[2]/nrays[2]<<endl; 
    649761                 
    650762                vssRays.insert(vssRays.end(), tmpVssRays.begin(), tmpVssRays.end() ); 
     
    654766          } 
    655767           
     768           
     769          // now evaluate the ratios for the next pass 
     770#define TIMES 0 
     771 
     772#if TIMES 
     773          ratios[0] = sqr(contributions[0]/times[0]); 
     774          ratios[1] = sqr(contributions[1]/times[1]); 
     775          ratios[2] = sqr(contributions[2]/times[2]); 
     776#else 
     777          ratios[0] = sqr(contributions[0]/nrays[0]); 
     778          ratios[1] = sqr(contributions[1]/nrays[1]); 
     779          ratios[2] = sqr(contributions[2]/nrays[2]); 
     780#endif 
     781          NormalizeRatios(ratios); 
     782 
     783          cout<<"New ratios: "<<ratios[0]<<" "<<ratios[1]<<" "<<ratios[2]<<endl; 
     784           
    656785          // add contributions of all rays at once... 
     786#if !ADD_RAYS_IN_PLACE  
    657787          mViewCellsManager->AddSampleContributions(vssRays); 
    658            
     788#endif     
    659789        } 
    660790        else { 
     
    723853                sprintf(filename, "rss-rays-%04d.x3d", rssPass); 
    724854           
     855           
     856 
     857          vssRays.SelectRays(mExportNumRays, rayBuffer[mPass], true); 
     858           
    725859          ExportRays(filename, vssRays, mExportNumRays); 
    726  
     860           
    727861          // now export all contributing rays 
    728862          VssRayContainer contributingRays; 
     
    731865          sprintf(filename, "rss-crays-%04d.x3d", rssPass); 
    732866          ExportRays(filename, contributingRays, mExportNumRays); 
     867           
    733868        } 
    734869 
     
    798933         
    799934  } 
    800    
     935 
     936 
     937  if (mExportRays && mUseImportanceSampling) { 
     938        char filename[64]; 
     939        sprintf(filename, "rss-rays-i.x3d"); 
     940         
     941        rayBuffer.resize(mPass); 
     942        ExportRayAnimation(filename, rayBuffer); 
     943  } 
     944           
    801945  Debug<<"Deleting RSS tree...\n"; 
    802946  delete mRssTree; 
     
    804948 
    805949 
    806   //  mViewCellsManager->ExportViewCells("visibility.xml", 
     950  // mViewCellsManager->ExportViewCells("visibility.xml", 
    807951  //                                                                     true); 
    808952   
  • GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.h

    r863 r1112  
    9090                         ); 
    9191 
     92  bool 
     93  ExportRayAnimation(const char *filename, 
     94                                         const vector<VssRayContainer> &vssRays 
     95                                         ); 
     96 
    9297  void 
    9398  ExportObjectRays(VssRayContainer &rays, 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.cpp

    r1004 r1112  
    333333          leaf->dirBBox.SetMin(2, 0.0f); 
    334334          leaf->dirBBox.SetMax(2, 1.0f); 
    335            
    336335          mRoots[i] = leaf; 
    337336        } 
     337 
    338338        // init spatial bounding boxes 
    339339        for (i = 0; i < objects.size(); i++) { 
     
    366366           
    367367          // leaf bbox contains bbox of origins only 
     368 
     369          // include both origin and terminatin in the global bbox 
     370#if USE_ORIGIN 
    368371          leaf->bbox.Include((*ri)->GetOrigin()); 
    369            
    370           // include both origin and terminatin in the global bbox 
    371372          bbox.Include((*ri)->GetOrigin()); 
     373#else 
    372374          bbox.Include((*ri)->GetTermination()); 
    373            
     375          leaf->bbox.Include((*ri)->GetTermination()); 
     376#endif     
    374377          Vector3 dVec = Vector3( 
    375378                                                         (*ri)->GetDirParametrization(0), 
     
    396399  for (int i=0; i < mRoots.size(); i++) { 
    397400        RssTreeLeaf *leaf = (RssTreeLeaf *)mRoots[i]; 
     401        UpdatePvsSize(leaf); 
    398402        stat.initialPvsSize += leaf->GetPvsSize(); 
    399         UpdatePvsSize(leaf); 
    400403        mRoots[i] = Subdivide(TraversalData(leaf, GetBBox(leaf), 0)); 
    401404  } 
     
    458461          if (!node->IsLeaf()) { 
    459462                subdivided++; 
    460  
     463                 
    461464                 
    462465                RssTreeInterior *interior = (RssTreeInterior *) node; 
     
    626629        case 1: { 
    627630          float newContrib = 
    628                 info.contributionBack/(info.position - minBox) +  
    629                 + 
    630                 info.contributionFront/(maxBox - info.position); 
    631           float oldContrib = info.contribution/sizeBox; 
    632           info.costRatio = oldContrib/newContrib; 
     631                (info.contributionBack*(info.position - minBox) +  
     632                 + 
     633                 info.contributionFront*(maxBox - info.position))/sizeBox; 
     634          float oldContrib = info.contribution; 
     635          info.costRatio = newContrib/oldContrib; 
     636          //      cout<<info.contribution<<" "<<info.contributionBack<<" "<<info.contributionFront<<endl; 
    633637          break; 
    634638        }  
     
    757761        } 
    758762 
    759   info.contribution = sumContribution/sumWeights; 
    760   info.contributionBack = sumContributionBack/sumWeightsBack; 
    761   info.contributionFront = sumContributionFront/sumWeightsFront; 
     763  if (sumWeights!=0.0f) 
     764        info.contribution = sumContribution/sumWeights; 
     765  else 
     766        info.contribution = 0.0f; 
     767 
     768  if (sumWeightsBack!=0.0f) 
     769        info.contributionBack = sumContributionBack/sumWeightsBack; 
     770  else 
     771        info.contributionBack = 0.0f; 
     772 
     773  if (sumWeightsFront!=0.0f) 
     774        info.contributionFront = sumContributionFront/sumWeightsFront; 
     775  else 
     776        info.contributionFront = 0.0f; 
    762777   
    763778  GetCostRatio( 
     
    765780                           info); 
    766781   
    767   //    cout<<axis<<" "<<pvsSize<<" "<<pvsBack<<" "<<pvsFront<<endl; 
     782  //cout<<axis<<" "<<pvsSize<<" "<<pvsBack<<" "<<pvsFront<<endl; 
    768783  //  float oldCost = leaf->rays.size(); 
    769784   
    770   //    cout<<"ratio="<<ratio<<endl; 
     785  //  cout<<"ratio="<<ratio<<endl; 
    771786} 
    772787 
     
    20542069 
    20552070 
    2056   const float smoothRange = 0.0f; 
     2071  const float smoothRange = 0.1f; 
    20572072  if (smoothRange != 0.0f) { 
    20582073        box.Scale(1.0f + smoothRange); 
     
    20782093  } 
    20792094   
    2080   int numberOfTries = numberOfRays*4; 
     2095  //  int numberOfTries = numberOfRays*4; 
     2096  int numberOfTries = numberOfRays; 
    20812097  int generated = 0; 
    20822098 
     
    21042120   
    21052121  float extendedConvexCombinationProb = 0.0f; //0.7f 
    2106   float silhouetteCheckPercentage = 1.0f; //0.5f 
     2122  //  float silhouetteCheckPercentage = 1.0f; //0.5f 
     2123  float silhouetteCheckPercentage = 0.0f; //0.9f; // 0.5f; 
     2124  float silhouetteObjectCheckPercentage = 0.8f; 
    21072125  for (int i=0; generated < numberOfRays && i < numberOfTries; i++) { 
    21082126        bool useExtendedConvexCombination = ((nrays >= 2) && (Random(1.0f) < 
     
    21792197        bool intersects = false; 
    21802198         
    2181  
    2182         if (i > numberOfRays*(1.0f - silhouetteCheckPercentage)) { 
     2199        if (i >= numberOfRays*(1.0f - silhouetteCheckPercentage)) { 
    21832200          if (exporter) { 
    21842201                VssRay *ray = new VssRay(origin, origin + 100*direction, NULL, NULL); 
     
    21942211                Intersectable *object = *oi; 
    21952212                // do not test every object 
    2196                 if (Random(1.0f) > 0.5f) 
    2197                   break; 
    2198                 if ( object->CastRay(traversalRay) ) { 
     2213                if ( Random(1.0f) <= silhouetteObjectCheckPercentage && 
     2214                         object->CastRay(traversalRay) ) { 
    21992215                  intersects = true; 
    22002216                  break; 
     
    22112227  } 
    22122228 
    2213    
    22142229  //  cout<<"desired="<<numberOfRays<<" tries="<<i<<endl; 
    22152230  // assign pdfs to the generated rays 
    2216   float p = 1.0f; //(box.GetVolume()*dirBox.GetVolume())/i; 
    2217   rays.mSumPdf = 0.0f; 
     2231  // float density = generated/(box.SurfaceArea()*dirBox.GetVolume()); 
     2232  float density = 1.0f; 
     2233 
     2234  float p = 1.0f/density; //(box.GetVolume()*dirBox.GetVolume())/i; 
    22182235  for (i=startIndex; i < rays.size(); i++) { 
    22192236        rays[i].mPdf = p; 
    2220         rays.mSumPdf += p; 
    22212237  } 
    22222238   
     
    22272243        CLEAR_CONTAINER(selectedRays); 
    22282244  } 
    2229    
    22302245   
    22312246} 
     
    23162331        if (leaf->rays[i].mRay->RefCount() != 0) { 
    23172332          cerr<<"Error: refcount!=0, but"<<leaf->rays[i].mRay->RefCount()<<endl; 
     2333          cerr<<"desired="<<desired<<"i="<<i<<" size="<<leaf->rays.size()<<endl; 
    23182334          exit(1); 
    23192335        } 
     
    24122428  CollectLeaves(leaves); 
    24132429         
    2414   sort(leaves.begin(), 
    2415            leaves.end(), 
    2416            GreaterContribution); 
     2430  if (numberOfLeaves != leaves.size()) 
     2431        sort(leaves.begin(), 
     2432                 leaves.end(), 
     2433                 GreaterContribution); 
    24172434                          
    24182435 
     
    24312448   
    24322449  // always generate at leat n ray per leaf 
    2433   int fixedPerLeaf = 1; 
    2434   int fixed = 1*leaves.size(); 
     2450  int fixedPerLeaf = 0; 
     2451  // int fixedPerLeaf = 0; 
     2452  int fixed = fixedPerLeaf*leaves.size(); 
    24352453  int iGenerated = numberOfRays; 
    24362454  float ratioPerLeaf = iGenerated /(avgContrib*numberOfLeaves); 
     
    24852503// if 1.0f then weighs = 1 1/2 1/3 1/4 
    24862504float passSampleWeightDecay = 1.0f; 
    2487  
    2488 void 
    2489 RssTree::GetRayContribution(const RssTreeNode::RayInfo &info, 
    2490                                                         float &weight, 
    2491                                                         float &contribution) 
    2492 { 
    2493   VssRay *ray = info.mRay; 
    2494   weight = 1.0f/(mCurrentPass - ray->mPass + passSampleWeightDecay); 
    2495   contribution = 
    2496         weightAbsContributions*ray->mPvsContribution + 
    2497         (1.0f - weightAbsContributions)*ray->mRelativePvsContribution; 
    2498   // store the computed value 
    2499   info.mRay->mWeightedPvsContribution = weight*contribution; 
    2500 } 
     2505//float passSampleWeightDecay = 0.0001f; 
     2506 
    25012507 
    25022508float 
     
    25062512  float weight; 
    25072513  if (1)  
    2508         weight = 1.0f/(passDiff + passSampleWeightDecay); 
     2514        weight = 1.0f/sqr(passDiff + passSampleWeightDecay); 
    25092515  else  
    25102516        switch (passDiff) { 
    2511         case 0: 
     2517          //    case 0: 
     2518          //      weight = 1.0f; 
     2519          //      break; 
     2520        default: 
    25122521          weight = 1.0f; 
    2513           break; 
    2514         default: 
    2515           weight = 0.0f; 
    25162522          break; 
    25172523          //    case 1: 
     
    25352541 
    25362542void 
     2543RssTree::GetRayContribution(const RssTreeNode::RayInfo &info, 
     2544                                                        float &weight, 
     2545                                                        float &contribution) 
     2546{ 
     2547  VssRay *ray = info.mRay; 
     2548  weight = GetSampleWeight(mCurrentPass); 
     2549  contribution = 
     2550        weightAbsContributions*ray->mPvsContribution + 
     2551        (1.0f - weightAbsContributions)*ray->mRelativePvsContribution; 
     2552  // store the computed value 
     2553  info.mRay->mWeightedPvsContribution = weight*contribution; 
     2554} 
     2555 
     2556 
     2557void 
    25372558RssTree::ComputeImportance(RssTreeLeaf *leaf)  
    25382559{ 
     
    25532574          sumRelContributions += weight*ray->mRelativePvsContribution; 
    25542575           
    2555           //      sumWeights += weight; 
     2576          //sumWeights += weight; 
    25562577          sumWeights += 1.0f; 
    25572578        } 
     
    25762597RssTreeLeaf::GetImportance()  const 
    25772598{ 
     2599  //return sqr(mImportance); 
    25782600  return mImportance; 
    25792601} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.h

    r863 r1112  
    162162        } 
    163163 
    164 #define USE_ORIGIN 0 
     164#define USE_ORIGIN 1 
    165165         
    166166        Vector3 GetOrigin() const { 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.cpp

    r1004 r1112  
    8787} 
    8888 
    89 //  void 
    90 //  SamplingPreprocessor::AvsGenerateRandomRay(Ray &ray) 
    91 //  { 
    92 //    int objId = RandomValue(0, mObjects.size()); 
    93 //    Intersectable *object = objects[objId]; 
    94 //    object->GetRandomSurfacePoint(point, normal); 
    95 //    direction = UniformRandomVector(normal); 
    96 //    SetupRay(ray, point, direction); 
    97 //  } 
    98  
    99 //  void 
    100 //  SamplingPreprocessor::AvsHandleRay(Ray &ray) 
    101 //  { 
    102 //    int sampleContributions = 0; 
    103  
    104 //    mKdTree->CastRay(ray); 
    105    
    106 //    if (ray.leaves.size()) { 
    107 //      sampleContributions += AddNodeSamples(object, ray, pass); 
    108      
    109 //      if (ray.intersections.size()) { 
    110 //        sampleContributions += AddNodeSamples(ray.intersections[0].mObject, ray, pass); 
    111 //      } 
    112 //    } 
    113 //  } 
    114  
    115 //  void 
    116 //  SamplingPreprocessor::AvsBorderSampling(Ray &ray) 
    117 //  { 
    118    
    119  
    120 //  } 
    121  
    122 //  void 
    123 //  SamplingPreprocessor::AvsPass() 
    124 //  { 
    125 //    Ray ray; 
    126 //    while (1) { 
    127 //      AvsGenerateRay(ray); 
    128 //      HandleRay(ray); 
    129 //      while ( !mRayQueue.empty() ) { 
    130 //        Ray ray = mRayQueue.pop(); 
    131 //        mRayQueue.pop(); 
    132 //        AdaptiveBorderSampling(ray); 
    133 //      } 
    134 //    } 
    135    
    136    
    137  
    138 //  } 
    13989 
    14090 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1108 r1112  
    720720                   << " max=\"" << mViewSpaceBox.Max().x << " " << mViewSpaceBox.Max().y << " " << mViewSpaceBox.Max().z << "\" />" << endl; 
    721721 
    722          
     722        if (exportPvs) { 
    723723        //-- export bounding boxes 
    724724        stream << "<BoundingBoxes>" << endl; 
     
    738738 
    739739        stream << "</BoundingBoxes>" << endl; 
    740  
     740        } 
    741741 
    742742        //-- export the view cells and the pvs 
     
    12221222                                                           const float filterWidth) 
    12231223{ 
     1224 
     1225         
     1226 
     1227         
     1228  ViewCell *currentViewCell = GetViewCell(viewPoint); 
     1229 
     1230  if (mMaxFilterSize < 1) { 
     1231        prvs.mViewCell = currentViewCell; 
     1232        return; 
     1233  } 
     1234   
    12241235  const AxisAlignedBox3 box = GetFilterBBox(viewPoint, filterWidth); 
    1225          
    1226   ViewCell *currentViewCell = GetViewCell(viewPoint); 
    1227  
     1236   
    12281237  if (currentViewCell) { 
    12291238        ViewCellContainer viewCells; 
    12301239        ComputeBoxIntersections(box, viewCells); 
    1231          
     1240 
     1241 
    12321242        ViewCell *root = ConstructLocalMergeTree2(currentViewCell, viewCells); 
    12331243        prvs.mViewCell = root; 
     1244         
    12341245  } else 
    12351246        prvs.mViewCell = NULL; 
     
    16741685void ViewCellsManager::GetPvsStatistics(PvsStatistics &stat) 
    16751686{ 
    1676         // update pvs of view cells tree if necessary 
    1677         UpdatePvs(); 
    1678  
    1679         ViewCellContainer::const_iterator it = mViewCells.begin(); 
    1680  
    1681         stat.viewcells = 0; 
    1682         stat.minPvs = 100000000; 
    1683         stat.maxPvs = 0; 
    1684         stat.avgPvs = 0.0f; 
    1685  
    1686         for (; it != mViewCells.end(); ++ it)  
    1687         { 
    1688                 ViewCell *viewcell = *it; 
    1689                  
    1690                 const int pvsSize = mViewCellsTree->GetPvsSize(viewcell); 
    1691                  
    1692                 if (pvsSize < stat.minPvs) 
    1693                         stat.minPvs = pvsSize; 
    1694                 if (pvsSize > stat.maxPvs) 
    1695                         stat.maxPvs = pvsSize; 
    1696                 stat.avgPvs += pvsSize; 
    1697                  
    1698                 ++ stat.viewcells; 
    1699         } 
    1700  
    1701         if (stat.viewcells) 
    1702                 stat.avgPvs/=stat.viewcells; 
     1687  // update pvs of view cells tree if necessary 
     1688  UpdatePvs(); 
     1689   
     1690  ViewCellContainer::const_iterator it = mViewCells.begin(); 
     1691   
     1692  stat.viewcells = 0; 
     1693  stat.minPvs = 100000000; 
     1694  stat.maxPvs = 0; 
     1695  stat.avgPvs = 0.0f; 
     1696   
     1697  for (; it != mViewCells.end(); ++ it)  
     1698        { 
     1699          ViewCell *viewcell = *it; 
     1700           
     1701          const int pvsSize = mViewCellsTree->GetPvsSize(viewcell); 
     1702           
     1703          if (pvsSize < stat.minPvs) 
     1704                stat.minPvs = pvsSize; 
     1705          if (pvsSize > stat.maxPvs) 
     1706                stat.maxPvs = pvsSize; 
     1707          stat.avgPvs += pvsSize; 
     1708           
     1709          ++ stat.viewcells; 
     1710        } 
     1711   
     1712  if (stat.viewcells) 
     1713        stat.avgPvs/=stat.viewcells; 
    17031714} 
    17041715 
     
    18691880                        // if ray not outside of view space 
    18701881                        float contribution; 
    1871                         if (ray.mTerminationObject && 
    1872                                 viewcell->GetPvs().GetSampleContribution(ray.mTerminationObject, 
    1873                                                                                                                  ray.mPdf, 
    1874                                                                                                                  contribution)) 
    1875                         { 
     1882                        if (ray.mTerminationObject) { 
     1883                          if (viewcell->GetPvs().GetSampleContribution(ray.mTerminationObject, 
     1884                                                                                                                   ray.mPdf, 
     1885                                                                                                                   contribution)) 
    18761886                                ++ ray.mPvsContribution; 
    1877                                 ray.mRelativePvsContribution += contribution; 
     1887                          ray.mRelativePvsContribution += contribution; 
    18781888                        } 
    1879  
    18801889                        // for directional sampling it is important to count only contributions 
    18811890                        // made in one direction!!! 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VrmlExporter.h

    r1106 r1112  
    113113                         const RgbColor &color = RgbColor(1,1,1)); 
    114114 
     115  virtual bool 
     116  ExportRaySets(const vector<VssRayContainer> &rays, 
     117        const RgbColor &color) { return false; } 
     118 
    115119  virtual void 
    116120  ExportBspSplitPlanes(const BspTree &tree); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspKdTree.h

    r1012 r1112  
    3535#include "ViewCell.h" 
    3636 
     37 
     38namespace GtpVisibilityPreprocessor { 
     39 
    3740class VspKdLeaf; 
    3841class ViewCellsManager; 
    3942class ViewCellsStatistics; 
    40  
    41 namespace GtpVisibilityPreprocessor { 
    4243 
    4344/** 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.cpp

    r863 r1112  
    230230int 
    231231VssRayContainer::SelectRays(const int number, 
    232                                                         VssRayContainer &selected) const 
     232                                                        VssRayContainer &selected, 
     233                                                        const bool copy) const 
    233234{ 
    234235  float p = number/(float)size(); 
     
    236237   
    237238  for (; it != end(); it++) 
    238         if (Random(1.0f) < p) 
    239           selected.push_back(*it); 
     239        if (Random(1.0f) < p) { 
     240          if (!copy) 
     241                selected.push_back(*it); 
     242          else 
     243                selected.push_back(new VssRay(**it)); 
     244        } 
    240245   
    241246  return (int)selected.size(); 
     
    249254{ 
    250255  VssRayContainer::const_iterator it = begin(); 
    251    
     256  //  ofstream s("contrib.log"); 
    252257  for (; it != end(); it++) { 
    253258        VssRay *ray = *it; 
     259        //      s<<"(pass="<<ray->mPass<<", c="<<ray->mPvsContribution<<")"<<endl; 
    254260        if (ray->mPass >= minPass && ray->mPvsContribution > 0) 
    255261          selected.push_back(ray); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.h

    r863 r1112  
    220220  bool HasPosDir(const int axis) const { return mFlags & (1<<axis); } 
    221221 
    222   char Flags() const { return mFlags;} 
    223   void SetFlags(char orFlag) { mFlags |= orFlag;} 
     222  char Flags() const { return mFlags;}  void SetFlags(char orFlag) { mFlags |= orFlag;} 
    224223   
    225224  bool IsActive() const { return mRefCount>0; } 
     
    312311{ 
    313312  void PrintStatistics(ostream &s); 
    314   int SelectRays(const int number, VssRayContainer &selected) const; 
     313  int SelectRays(const int number, VssRayContainer &selected, const bool copy=false) const; 
    315314  int 
    316315  GetContributingRays(VssRayContainer &selected, 
  • GTP/trunk/Lib/Vis/Preprocessing/src/X3dExporter.cpp

    r1107 r1112  
    3535 
    3636 
     37 
    3738bool 
    3839X3dExporter::ExportRays(const RayContainer &rays, 
     
    8384 
    8485  return true; 
     86} 
     87 
     88 
     89bool 
     90X3dExporter::ExportRaySets(const vector<VssRayContainer> &rays, 
     91                                                   const RgbColor &color) 
     92{ 
     93  vector<VssRayContainer>::const_iterator ri = rays.begin(); 
     94   
     95  stream<<"<Switch DEF=\"RAYS\" whichChoice=\"0\" >"<<endl; 
     96 
     97  bool result = false; 
     98 
     99  for (; ri != rays.end(); ri++) { 
     100        result = ExportRays(*ri, color); 
     101        if (!result) { 
     102          cerr<<"Error while exporting rays!\n"; 
     103          break; 
     104        } 
     105  } 
     106   
     107  stream<<"</Switch>"<<endl; 
     108 
     109  stream<<"<TimeSensor DEF='TIMER' loop='true' startTime='0' stopTime='0' cycleInterval='5'>" 
     110                <<endl; 
     111  stream<<"</TimeSensor>"<<endl; 
     112   
     113  stream<<"<IntegerSequencer DEF='SEQ'"<<endl; 
     114  stream<<"key='0.0 "; 
     115  int i; 
     116  int size = rays.size() + 2; 
     117  for (i=1; i < size; i++) { 
     118        stream<<i/(float)(size-1)<<" "; 
     119  } 
     120  stream<<"'\n"; 
     121 
     122  stream<<"keyValue='"; 
     123  for (i=0; i < size; i++) { 
     124        stream<<i<<" "; 
     125  } 
     126  stream<<"'>\n"; 
     127   
     128  stream<<"</IntegerSequencer>"<<endl; 
     129 
     130  stream<< 
     131        "<ROUTE fromNode='TIMER' fromField='fraction_changed' toNode='SEQ' toField='set_fraction'>"; 
     132  stream<<"</ROUTE>"<<endl; 
     133   
     134  stream<<"<ROUTE fromNode='SEQ' fromField='value_changed' toNode='RAYS' toField='set_whichChoice'>"; 
     135   
     136  stream<<"</ROUTE>"<<endl; 
     137   
     138  return result; 
    85139} 
    86140 
     
    12621316 
    12631317} 
     1318 
  • GTP/trunk/Lib/Vis/Preprocessing/src/X3dExporter.h

    r1106 r1112  
    128128  virtual void ExportBeam(const Beam &beam, const AxisAlignedBox3 &box); 
    129129 
     130  bool 
     131  ExportRaySets(const vector<VssRayContainer> &rays, 
     132                                const RgbColor &color); 
     133 
    130134protected: 
    131135 
  • GTP/trunk/Lib/Vis/Preprocessing/src/common.h

    r971 r1112  
    484484 
    485485// if the view cells should be exported and inported as gzstream 
    486 #define ZIPPED_VIEWCELLS 1 
    487  
    488 #endif 
    489  
    490  
    491  
    492  
    493  
    494  
    495  
    496  
    497  
    498  
    499  
     486#define ZIPPED_VIEWCELLS 0 
     487 
     488#endif 
     489 
     490 
     491 
     492 
     493 
     494 
     495 
     496 
     497 
     498 
     499 
  • GTP/trunk/Lib/Vis/Preprocessing/src/default.env

    r904 r1112  
    1414# filename ../data/vienna/viewcells-25-sel.x3d 
    1515#filename ../data/atlanta/atlanta2.x3d 
    16 #filename ../data/soda/soda.dat 
    17 filename ../data/soda/soda5.dat 
     16# filename ../data/soda/soda.dat 
     17#filename ../data/soda/soda5.dat 
    1818#filename ../data/PowerPlant/ppsection1/part_a/g0.ply 
    1919#filename ../data/PowerPlant/ppsection1/part_b/g0.ply 
     
    2222#filename ../data/PowerPlant/selection3.plb 
    2323#filename ../data/PowerPlant/section10.plb;../data/PowerPlant/section14.plb 
    24 #filename ../data/PowerPlant/selection.plb 
     24filename ../data/PowerPlant/selection.plb 
    2525#filename ../data/PowerPlant/comps/ppsection1/comps.plb 
    2626} 
     
    3535        type rss 
    3636#       type render 
    37         detectEmptyViewSpace false 
    38         pvsRenderErrorSamples 0 
    39 #       pvsRenderErrorSamples 1000 
    40         quitOnFinish false 
     37        detectEmptyViewSpace true 
     38#       pvsRenderErrorSamples 0 
     39        pvsRenderErrorSamples 5000 
     40        quitOnFinish true 
    4141        computeVisibility true 
    42         applyVisibilityFilter   false 
    43         applyVisibilitySpatialFilter    true 
     42        applyVisibilityFilter false 
     43        applyVisibilitySpatialFilter false 
    4444        visibilityFilterWidth   0.01 
    4545        visibilityFile visibility.xml 
     46        loadPolygonsAsMeshes false 
    4647} 
    4748 
     
    5354VssPreprocessor { 
    5455        samplesPerPass  100000 
    55         initialSamples 500000 
    56         vssSamples 5000000 
    57         vssSamplesPerPass 500000 
     56        initialSamples 100000 
     57        vssSamples 1000000 
     58        vssSamplesPerPass 100000 
    5859        useImportanceSampling true 
    5960        loadInitialSamples  false 
     
    7273        minRays         100 
    7374        minSize         0.001 
    74         maxCostRatio    1.5 
     75        maxCostRatio    2.0 
    7576        maxRayContribution 0.5 
    7677         
     
    7980 
    8081#       splitType regular 
    81 #       splitType heuristic 
    82         splitType hybrid 
     82        splitType heuristic 
     83#       splitType hybrid 
    8384        splitUseOnlyDrivingAxis true 
    8485 
     
    9495 
    9596RssPreprocessor { 
    96         samplesPerPass 500000 
     97        samplesPerPass 1000 
    9798        initialSamples 1000000 
    98         vssSamples 5000000 
     99        vssSamples 500000000 
    99100        vssSamplesPerPass 1000000 
    100101        useImportanceSampling true 
     
    106107                pvs false 
    107108                rssTree false 
    108                 rays false 
    109                 numRays 20000 
     109                rays true 
     110                numRays 2000 
    110111        } 
    111112 
     
    121122        perObjectTree false 
    122123 
    123         maxDepth        40 
    124         minPvs          3 
     124        maxDepth        60 
     125        minPvs          1 
    125126# before vienna test it was: 
    126127#       minRays 50 
    127128#       splitType heuristic 
    128129 
    129         minRays         100 
     130        minRays         200 
    130131        minSize         0.001 
    131         maxCostRatio 1.0 
     132        maxCostRatio 0.98 
    132133        maxRayContribution 0.5 
    133         maxRays         2000000 
     134        maxRays         4000000 
    134135        maxTotalMemory  200 
    135136        maxStaticMemory 100 
    136137 
    137         splitType regular 
    138 #       splitType heuristic 
     138#       splitType regular 
     139        splitType heuristic 
    139140#       splitType hybrid 
    140141        splitUseOnlyDrivingAxis false 
     
    165166                maxCostRatio 1.0 
    166167                ct_div_ci 0.5 
    167                 maxNodes 100000 
     168                maxNodes 200000 
    168169 
    169170#500000  
     
    211212        maxStaticMemory 40 
    212213 
    213         exportToFile false 
     214        exportToFile true 
    214215        loadFromFile true 
    215216 
     
    280281#       filename ../data/soda/soda5-viewcells.xml 
    281282#       filename ../scripts/viewcells_atlanta.xml 
    282         filename ../data/soda/soda5-viewcells2.xml 
     283#       filename ../data/soda/soda5-viewcells2.xml 
     284 
     285#       filename ../data/soda/soda5-viewcell-single.xm 
     286#       filename ../data/soda/vienna-viewcell-single.xml 
     287 
     288 
    283289#       filename ../data/atlanta/viewcells_atlanta3.xml 
    284290#       filename ../data/vienna/viewcells_vienna.xml 
    285291#       filename ../data/vienna/viewcells_vienna2.xml 
    286292#       filename ../data/vienna/vienna_simple-21-04-avs2-viewCells.xml 
    287 #       filename ../data/PowerPlant/power_plant_viewcells_all3.xml 
     293        filename ../data/PowerPlant/power_plant_viewcells1.xml 
    288294} 
    289295 
     
    385391                minGlobalCostRatio      0.0000001 
    386392#               minGlobalCostRatio      0.0001 
    387                 maxViewCells            50000 
     393# $$MAXVIEWCELLS 
     394                maxViewCells            5000 
    388395         
    389396 
  • GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp

    r1076 r1112  
    3030{ 
    3131 
    32         //Now just call this function at the start of your program and if you're 
    33         //compiling in debug mode (F5), any leaks will be displayed in the Output 
    34         //window when the program shuts down. If you're not in debug mode this will 
    35         //be ignored. Use it as you will! 
    36         //note: from GDNet Direct [3.8.04 - 3.14.04] void detectMemoryLeaks() { 
    37     _CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF|_CRTDBG_ALLOC_MEM_DF); 
    38     _CrtSetReportMode(_CRT_ASSERT,_CRTDBG_MODE_FILE); 
    39     _CrtSetReportFile(_CRT_ASSERT,_CRTDBG_FILE_STDERR);  
     32  //Now just call this function at the start of your program and if you're 
     33  //compiling in debug mode (F5), any leaks will be displayed in the Output 
     34  //window when the program shuts down. If you're not in debug mode this will 
     35  //be ignored. Use it as you will! 
     36  //note: from GDNet Direct [3.8.04 - 3.14.04] void detectMemoryLeaks() { 
     37  _CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF|_CRTDBG_ALLOC_MEM_DF); 
     38  _CrtSetReportMode(_CRT_ASSERT,_CRTDBG_MODE_FILE); 
     39  _CrtSetReportFile(_CRT_ASSERT,_CRTDBG_FILE_STDERR);  
     40 
     41  InitTiming(); 
    4042 
    4143  Debug.open("debug.log"); 
     
    136138        rendererWidget->show(); 
    137139         
    138         if (p->GetRenderer()) { 
     140        if (0 && p->GetRenderer()) { 
    139141           
    140142          cout<<"CONNECTING"<<endl; 
     
    142144                                           SIGNAL(UpdatePvsErrorItem(int i, 
    143145                                                                                                 GlRendererBuffer::PvsErrorEntry &)), 
    144  
     146                                            
    145147                                           rendererWidget->mControlWidget, 
    146148                                           SLOT(UpdatePvsErrorItem(int i, 
  • GTP/trunk/Lib/Vis/Preprocessing/src/preprocessor.pro

    r811 r1112  
    1313 
    1414 
    15 win32:LIBPATH += $$NONGTP/Xerces/xerces/lib $$NONGTP/Devil/lib "d:/Programs/NVIDIA Corporation/Cg/lib" 
     15win32:LIBPATH += GL $$NONGTP/Xerces/xerces/lib $$NONGTP/Devil/lib \ 
     16  "d:/Programs/NVIDIA Corporation/Cg/lib" $$NONGTP/glut 
     17   
    1618unix:LIBPATH += ../support/src/xerces-c-src_2_7_0/lib ../support/devil/lib /usr/lib/qt3/lib64 
    1719 
     
    2830QT += opengl 
    2931 
    30 win32:LIBS += xerces-c_2.lib devil.lib ilu.lib ilut.lib cg.lib cgGL.lib 
     32win32:LIBS += xerces-c_2.lib devil.lib ilu.lib ilut.lib cg.lib cgGL.lib glew32.lib  
     33 
    3134unix:LIBS += -lxerces-c -lIL -lILU -lILUT 
    3235 
     
    4447MutualVisibility.cpp Triangle3.cpp Rectangle3.cpp Plane3.cpp Polygon3.cpp \ 
    4548ViewCell.cpp ViewCellBsp.cpp Halton.cpp VssRay.cpp VssTree.cpp VssPreprocessor.cpp \ 
    46 RenderSimulator.cpp VspKdTree.cpp RayInfo.cpp RssTree.cpp RssPreprocessor.cpp \ 
     49RenderSimulator.cpp RayInfo.cpp RssTree.cpp RssPreprocessor.cpp \ 
    4750ViewCellsManager.cpp VspBspTree.cpp GlRenderer.cpp \ 
    4851PreprocessorThread.cpp Renderer.cpp Beam.cpp ViewCellsParser.cpp Tetrahedron3.cpp \ 
    49 VrmlExporter.cpp PlyParser.cpp plyfile.c RenderSampler.cpp 
     52VrmlExporter.cpp PlyParser.cpp plyfile.c RenderSampler.cpp \ 
     53GzBinFileInputStream.cpp  GzFileInputSource.cpp \ 
     54OcclusionQuery.cpp VspOspTree.cpp LogManager.cpp \ 
     55SamplingStrategy.cpp 
    5056 
     57#VspKdTree.cpp ResourceManager.cpp  
Note: See TracChangeset for help on using the changeset viewer.