Changeset 2677


Ignore:
Timestamp:
05/14/08 19:06:06 (16 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/demo1.env

    r2676 r2677  
    5454        useGlDebugger false 
    5555# 0 = INTERNAL          1 = MLRT 
    56         rayCastMethod 0 
     56        rayCastMethod 1 
    5757         
    5858#       type sampling 
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/gvs.env

    r2643 r2677  
    3434        detectEmptyViewSpace true 
    3535        loadMeshes false 
    36         # internal raycaster 
    37         #rayCastMethod 0 
    38         # intel raycaster 
     36 
     37        # internal: 0 intel: 1 
    3938        rayCastMethod 1 
     39 
    4040        exportVisibility false 
    4141        applyVisibilityFilter false 
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/run_demo_vienna

    r2676 r2677  
    44export PATH=../bin:$PATH 
    55 
    6 #TARGET=debug 
    7 TARGET=release 
    8  
    9  
    106#COMMAND="./release/preprocessor.exe -preprocessor_quit_on_finish+" 
    117COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish- -preprocessor_use_gl_renderer+ -preprocessor_evaluate_filter- -samples_per_evaluation=5000000 -samples_per_pass=500000 -total_samples=100000000" 
    128 
    139 
    14 SCENE=../data/vienna/vienna_cropped.obj 
    15 #SCENE=../data/vienna/city_full.obj 
     10#SCENE=../data/vienna/vienna_cropped.obj 
     11SCENE=../data/vienna/city_full.obj 
     12 
    1613VIEWCELLS=../data/vienna/vienna_cropped-seq-3000-false-20-viewcells.xml.gz 
    1714#VIEWCELLS=../data/vienna/vienna_cropped-57000-viewcells.xml.gz 
    18  
    19  
    20 #SCENE=../data/Arena/arena-high-lods.obj 
    21 SCENE=../data/Arena/arena_trees.obj 
    22 #VIEWCELLS=../data/Arena/arena-high-lods-57000-viewcells.xml.gz 
    23 #VIEWCELLS=../data/Arena/arena-high-lods-10000-viewcells.xml.gz 
    24 VIEWCELLS=../data/Arena/arena-high-lods-5000-viewcells.xml.gz 
    25  
    2615 
    2716 
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/run_gvs_vienna.sh

    r2601 r2677  
    1313echo "starting $TARGET version" 
    1414 
    15 SCENE=../data/vienna/vienna_cropped.obj 
    16 #VIEWCELLS=../data/vienna/vienna_cropped-seq-3000-false-20-viewcells.xml.gz 
    17 VIEWCELLS=../data/vienna/vienna_cropped-57000-viewcells.xml.gz 
     15#SCENE=../data/vienna/vienna_cropped.obj 
     16SCENE=../data/vienna/city_full.obj 
     17 
     18#VIEWCELLS=../data/vienna/vienna_cropped-57000-viewcells.xml.gz 
     19#VIEWCELLS=../data/vienna/vienna_cropped-gradient-viewcells.xml.gz  
     20VIEWCELLS=../data/vienna/vienna_cropped-seq-3000-false-20-viewcells.xml.gz 
     21 
    1822 
    1923LOG_PREFIX=../scripts/tests/sig2008 
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/run_gvs_vps.sh

    r2676 r2677  
    1111echo "starting $TARGET version" 
    1212 
    13 SCENE=../data/vienna/vienna_cropped.obj 
     13#SCENE=../data/vienna/vienna_cropped.obj 
     14SCENE=../data/vienna/city_full.obj 
    1415 
    1516VIEWCELLS=../data/vienna/vienna_cropped-gradient-viewcells.xml.gz  
     
    2728-preprocessor=gvs \ 
    2829-gvs_epsilon=0.0001 \ 
    29 -gvs_total_samples=100000 \ 
    30 -gvs_samples_per_pass=100000 \ 
     30-gvs_total_samples=1000000 \ 
     31-gvs_samples_per_pass=1000000 \ 
    3132-gvs_initial_samples=16 \ 
    32 -gvs_max_viewcells=1 \ 
     33-gvs_max_viewcells=20 \ 
    3334-gvs_min_contribution=50 \ 
    3435-gvs_per_viewcell=true \ 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp

    r2671 r2677  
    993993                                                                   ) 
    994994{ 
    995         MakeCurrent(); 
     995        MakeLive(); 
    996996 
    997997        if (mPixelBuffer == NULL) 
     
    10221022        } 
    10231023 
    1024         DoneCurrent(); 
     1024        DoneLive(); 
    10251025} 
    10261026 
     
    10421042GlRendererBuffer::EvalPvsStat() 
    10431043{ 
    1044         MakeCurrent(); 
     1044        MakeLive(); 
    10451045         
    10461046        GlRenderer::EvalPvsStat(); 
    10471047         
    1048         DoneCurrent(); 
    1049   // mRenderingFinished.wakeAll(); 
     1048        DoneLive(); 
     1049        // mRenderingFinished.wakeAll(); 
    10501050} 
    10511051 
     
    10531053void GlRendererBuffer::EvalPvsStat(const SimpleRayContainer &viewPoints) 
    10541054{ 
    1055         MakeCurrent(); 
     1055        MakeLive(); 
    10561056 
    10571057        GlRenderer::EvalPvsStat(viewPoints); 
    10581058   
    1059         DoneCurrent(); 
     1059        DoneLive(); 
    10601060} 
    10611061 
     
    14781478} 
    14791479 
     1480 
    14801481bool GlRendererBuffer::ValidViewPoint() 
    14811482{        
    1482         MakeCurrent(); 
     1483        MakeLive(); 
    14831484 
    14841485        SetupProjection(GetWidth(), GetHeight()); 
     
    14861487        bool result = GlRenderer::ValidViewPoint(); 
    14871488         
    1488         DoneCurrent(); 
     1489        DoneLive(); 
    14891490         
    14901491        return result; 
     
    15281529                float error = GetPixelError(pvsSize); 
    15291530 
    1530  
    1531           //      emit UpdatePvsErrorItem(i, 
    1532           //                                                      mPvsErrorBuffer[i]); 
    1533           //      swapBuffers(); 
    15341531                mPvsErrorBuffer[i].mError = error; 
    15351532                mPvsErrorBuffer[i].mPvsSize = pvsSize; 
    15361533 
    1537                 cout<<"("<<i<<" ["<<mViewPoint<<"]["<<mViewDirection<<"] "<<mPvsErrorBuffer[i].mError<<")"; 
     1534                //cout<<"("<<i<<" ["<<mViewPoint<<"]["<<mViewDirection<<"] "<<mPvsErrorBuffer[i].mError<<")"; 
    15381535        } 
    15391536 
     
    16031600        for (sit = viewPoints.begin(); sit != sit_end; ++ sit, ++ i)  
    16041601        { 
     1602                if ((i % 10) == 99) 
     1603                        cout << "processed " << i << " view points " << endl; 
     1604 
    16051605                //cout << "\n\nvp: " << (*sit) << endl; 
    16061606                SimpleRay sray = *sit; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h

    r2671 r2677  
    330330        virtual int GetHeight() const  = 0;  
    331331 
    332         virtual void MakeCurrent() = 0; 
    333         virtual void DoneCurrent() = 0; 
     332        virtual void MakeLive() = 0; 
     333        virtual void DoneLive() = 0; 
    334334 
    335335        virtual bool ValidViewPoint(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp

    r2671 r2677  
    6868        mGvsStatsStream.open(gvsStatsLog); 
    6969 
     70        cout << "number of gvs samples per pass: " << mGvsSamplesPerPass << endl; 
     71        cout << "number of samples per pass: " << mSamplesPerPass << endl; 
     72 
    7073        Debug << "Gvs preprocessor options" << endl; 
    7174        Debug << "number of total samples: " << mTotalSamples << endl; 
    7275        Debug << "number of initial samples: " << mInitialSamples << endl; 
    73         cout << "number of gvs samples per pass: " << mGvsSamplesPerPass << endl; 
    74         cout << "number of samples per pass: " << mSamplesPerPass << endl; 
    7576        Debug << "threshold: " << mThreshold << endl; 
    7677        Debug << "epsilon: " << mEps << endl; 
     
    804805        mGenericStats2 = 0; 
    805806 
    806         //while (mGvsStats.mPerViewCellSamples < mTotalSamples)  
    807807        while (1) 
    808808        { 
     
    12231223        app << "#PvsCost\n" << (int)mPvsCost << endl; 
    12241224 
    1225 #if 0 
     1225        app << "#PerViewCellSamples\n" << mPerViewCellSamples << endl; 
     1226        app << "#RaysPerSec\n" << RaysPerSec() << endl; 
     1227         
    12261228        app << "#TotalPvs\n" << mTotalPvs << endl; 
    12271229        app << "#TotalTime\n" << mTotalTime << endl; 
    1228         app << "#RaysPerSec\n" << RaysPerSec() << endl; 
    1229          
    1230         app << "#PerViewCellSamples\n" << mPerViewCellSamples << endl; 
    12311230        app << "#TotalSamples\n" << mTotalSamples << endl; 
    1232         app     << "#SamplesContri\n" << mTotalContribution << endl; 
     1231 
    12331232        app << "#TotalTrianglePvs\n" << mTotalTrianglePvs << endl; 
    12341233         
    1235 #endif 
    1236  
    1237         //app << "#ReverseSamples\n" << mReverseSamples << endl; 
    1238         //app << "#BorderSamples\n" << mBorderSamples << endl; 
    1239  
    1240         //app << "#Pass\n" << mPass << endl; 
    1241         //app << "#ScDiff\n" << mPassContribution << endl; 
    1242         //app << "#GvsRuns\n" << mGvsPass << endl;       
     1234        if (0) 
     1235        { 
     1236                app << "#ReverseSamples\n" << mReverseSamples << endl; 
     1237                app << "#BorderSamples\n" << mBorderSamples << endl; 
     1238 
     1239                app << "#Pass\n" << mPass << endl; 
     1240                app << "#ScDiff\n" << mPassContribution << endl; 
     1241                app << "#GvsRuns\n" << mGvsPass << endl;         
     1242 
     1243                app     << "#SamplesContri\n" << mTotalContribution << endl; 
     1244        } 
    12431245 
    12441246        app << endl; 
     
    12611263        ProcessViewCell(); 
    12621264 
    1263         mGvsStats.mTrianglePvs = (int)mTrianglePvs.size(); 
    1264         mGvsStats.mTotalTrianglePvs += mGvsStats.mTrianglePvs; 
     1265         
     1266        //////// 
     1267        //-- stats 
     1268 
     1269        // compute pvs size using larger (bvh objects) 
     1270        // note: for kd pvs we had to do this during gvs computation 
    12651271 
    12661272        if (!mUseKdPvs) 
     
    12831289 
    12841290                mGvsStats.mPerViewCellPvs = (int)objectPvs.size(); 
     1291                mGvsStats.mPvsCost = 0; // todo objectPvs.EvalPvsCost(); 
    12851292        } 
    12861293        else 
     
    12891296                mGvsStats.mPvsCost = mCurrentViewCell->GetPvs().EvalPvsCost(); 
    12901297 
    1291                 cout << "id: " << mCurrentViewCell->GetId() << " pvs cost: "  
    1292                          << mGvsStats.mPvsCost << " pvs tri: " << mTrianglePvs.size() << endl; 
    1293         } 
    1294  
    1295  
    1296         //////// 
    1297         //-- stats 
    1298  
    1299         mGvsStats.mViewCells = mProcessedViewCells;//mPass; 
    1300         mGvsStats.mTotalPvs += mGvsStats.mPerViewCellPvs; 
    1301         mGvsStats.mTotalSamples += mGvsStats.mPerViewCellSamples; 
    1302  
     1298        } 
     1299 
     1300        mGvsStats.mTrianglePvs = (int)mTrianglePvs.size(); 
     1301         
    13031302        // timing 
    13041303        const long currentTime = GetTime(); 
    1305  
    13061304        mGvsStats.mTimePerViewCell = TimeDiff(startTime, currentTime) * 1e-3f; 
     1305 
     1306 
     1307        //////////////// 
     1308        // global values 
     1309 
     1310        mGvsStats.mViewCells = mProcessedViewCells;//mPass; 
     1311        mGvsStats.mTotalTrianglePvs += mGvsStats.mTrianglePvs; 
    13071312        mGvsStats.mTotalTime += mGvsStats.mTimePerViewCell; 
     1313    mGvsStats.mTotalPvs += mGvsStats.mPerViewCellPvs; 
     1314        mGvsStats.mTotalSamples += mGvsStats.mPerViewCellSamples; 
    13081315 
    13091316        mGvsStats.Stop(); 
    13101317        mGvsStats.Print(mGvsStatsStream); 
    13111318 
     1319        cout << "id: " << mCurrentViewCell->GetId() << " pvs cost: "  
     1320         << mGvsStats.mPvsCost << " pvs tri: " << mTrianglePvs.size() << endl; 
     1321 
     1322 
    13121323        mTrianglePvs.clear(); 
    13131324} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.h

    r2669 r2677  
    7474        ObjectContainer mKdPvs; 
    7575 
    76         float RaysPerSec() const { if (!mTotalTime) return 0; return (float)mTotalSamples / mTotalTime * 1e-6f; } 
     76        float RaysPerSec() const { if (!mTotalTime) return 0; return (float)(mTotalSamples / mTotalTime) * 1e-6f; } 
    7777 
    7878        void Print(ostream &app) const; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp

    r2643 r2677  
    14771477 
    14781478KdLeaf *KdTree::ImportBinLeaf(IN_STREAM &stream,  
    1479                               KdInterior *parent, 
    1480                               const ObjectContainer &objects) 
    1481 { 
    1482   int leafId = TYPE_LEAF; 
    1483   int objId = leafId; 
    1484   int size; 
    1485    
    1486   stream.read(reinterpret_cast<char *>(&size), sizeof(int)); 
    1487   KdLeaf *leaf = new KdLeaf(parent, size); 
    1488  
    1489   MeshInstance dummyInst(NULL); 
    1490          
    1491   // read object ids 
    1492   // note: this can also be done geometrically 
    1493   for (int i = 0; i < size; ++ i) 
    1494     {    
    1495       stream.read(reinterpret_cast<char *>(&objId), sizeof(int)); 
    1496       dummyInst.SetId(objId); 
    1497        
    1498       ObjectContainer::const_iterator oit = 
    1499         lower_bound(objects.begin(), objects.end(), (Intersectable *)&dummyInst, ilt); 
    1500        
    1501       if ((oit != objects.end()) && ((*oit)->GetId() == objId)) 
    1502         leaf->mObjects.push_back(*oit); 
    1503       else 
    1504         Debug << "error: object with id " << objId << " does not exist" << endl; 
    1505     } 
    1506    
    1507   return leaf; 
     1479                                                          KdInterior *parent, 
     1480                                                          const ObjectContainer &objects) 
     1481{ 
     1482        int leafId = TYPE_LEAF; 
     1483        int objId = leafId; 
     1484        int size; 
     1485 
     1486        stream.read(reinterpret_cast<char *>(&size), sizeof(int)); 
     1487        KdLeaf *leaf = new KdLeaf(parent, size); 
     1488 
     1489        MeshInstance dummyInst(NULL); 
     1490 
     1491        // read object ids 
     1492        // note: this can also be done geometrically 
     1493        for (int i = 0; i < size; ++ i) 
     1494        {        
     1495                stream.read(reinterpret_cast<char *>(&objId), sizeof(int)); 
     1496                dummyInst.SetId(objId); 
     1497 
     1498                ObjectContainer::const_iterator oit = 
     1499                        lower_bound(objects.begin(), objects.end(), (Intersectable *)&dummyInst, ilt); 
     1500 
     1501                if ((oit != objects.end()) && ((*oit)->GetId() == objId)) 
     1502                        leaf->mObjects.push_back(*oit); 
     1503                else 
     1504                        Debug << "error: object with id " << objId << " does not exist" << endl; 
     1505        } 
     1506 
     1507        return leaf; 
    15081508} 
    15091509 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp

    r2676 r2677  
    7070 
    7171 
    72 void QtGlRendererBuffer::MakeCurrent() 
     72void QtGlRendererBuffer::MakeLive() 
    7373{ 
    7474        QGLPixelBuffer::makeCurrent(); 
     
    7777 
    7878 
    79 void QtGlRendererBuffer::DoneCurrent() 
     79void QtGlRendererBuffer::DoneLive() 
    8080{ 
    8181        QGLPixelBuffer::doneCurrent(); 
     
    9292                                                 QGL::DepthBuffer |  
    9393                                                 QGL::DoubleBuffer | 
    94                                                  QGL::Rgba 
    95                                                  )), 
     94                                                 QGL::Rgba) 
     95                                                 ), 
    9696GlRendererBuffer(sceneGraph, viewcells, tree) 
    9797{ 
     
    9999        //mUseVbos = false; 
    100100         
    101         MakeCurrent(); 
     101        MakeLive(); 
    102102        glViewport(0, 0, w, h); 
    103103    glMatrixMode(GL_PROJECTION); 
     
    109109 
    110110        InitGL(); 
    111         DoneCurrent(); 
     111         
     112        //mydynamicTexture = generateDynamicTexture(); 
     113    // bind the dynamic texture to the pbuffer - this is a no-op under X11 
     114        //bindToDynamicTexture(mydynamicTexture); 
     115 
     116        DoneLive(); 
    112117} 
    113118 
     
    133138float QtGlRendererBuffer::GetPixelError(int &pvsSize) 
    134139{ 
    135         MakeCurrent(); 
     140        MakeLive(); 
    136141 
    137142        if (0) 
     
    141146                cout << "rgba: " << format().rgba() << endl; 
    142147                cout << "double: " << format().doubleBuffer() << endl; 
     148                cout << "depth: " << format().depth() << endl; 
     149                cout << "gl:" << format().hasOpenGL() << endl; 
     150                cout << "dir:" << format().directRendering() << endl; 
    143151        } 
    144152 
     
    249257        pixelCount = query->GetQueryResult(); 
    250258 
    251         pErrorPixels = ((float)pixelCount) / (GetWidth() * GetHeight()); 
    252  
     259        pErrorPixels = (float)pixelCount / (GetWidth() * GetHeight()); 
     260 
     261        // some error happened 
    253262        if (pixelCount > 0)  
    254263        { 
     
    265274 
    266275                        char filename[256]; 
    267                         sprintf(filename, "error-frame-%04d-%0.5f.png", mFrame, pErrorPixels); 
     276                        //sprintf(filename, "error-frame-%04d-%0.5f.png", mFrame, pErrorPixels); 
     277                        sprintf(filename, "error-frame-%04d-%04d.png", mFrame, pixelCount); 
    268278                        QImage im = toImage(); 
    269279                        string str = mSnapPrefix + filename; 
     
    306316        glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 
    307317 
    308         DoneCurrent(); 
     318        DoneLive(); 
    309319 
    310320        return pErrorPixels; 
     
    23992409        // bind the dynamic texture to the pbuffer - this is a no-op under X11 
    24002410        mRenderBuffer->bindToDynamicTexture(dynamicTexture); 
    2401         makeCurrent(); 
     2411        //makeCurrent(); 
    24022412} 
    24032413 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h

    r2671 r2677  
    6161        ~QtGlRendererBuffer() {} 
    6262 
    63         virtual void MakeCurrent(); 
    64         virtual void DoneCurrent(); 
     63        virtual void MakeLive(); 
     64        virtual void DoneLive(); 
    6565 
    6666        virtual int GetWidth() const { return width(); } 
     
    7575        int ComputePvs(ObjectContainer &objects, ObjectContainer &pvs) const; 
    7676 
     77        unsigned int mydynamicTexture; 
    7778 
    7879public: 
     
    311312 
    312313public slots: 
    313 void UpdateDynamicObjects(); 
     314         
     315        void UpdateDynamicObjects(); 
    314316        void UpdateAllPvs(); 
    315317        void ComputeVisibility(); 
     
    516518                        mShowDistribution ^= 1; 
    517519 
    518                 std::cout << "b: " << (mShowDistribution & 1) << " " << (mShowDistribution & 2) << " " << (mShowDistribution & 4) << " " << (mShowDistribution & 8) << std::endl;  
     520                std::cout << "b: "  
     521                                  << (mShowDistribution & 1) << " "  
     522                                  << (mShowDistribution & 2) << " "  
     523                                  << (mShowDistribution & 4) << " "  
     524                                  << (mShowDistribution & 8) << std::endl;  
    519525        } 
    520526 
  • GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor05.vcproj

    r2676 r2677  
    153153                        <Tool 
    154154                                Name="VCLinkerTool" 
    155                                 AdditionalDependencies="xerces-c_2.lib glew32.lib zdll.lib zziplib.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib Preprocessor05.lib RTScene.lib RTWorld.lib cg.lib cgGL.lib Qt3Support4.lib QtTest4.lib QtGui4.lib QtInterface05.lib QtOpenGL4.lib QtCore4.lib qtmain.lib" 
     155                                AdditionalDependencies="xerces-c_2.lib glew32.lib zdll.lib zziplib.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib Preprocessor05.lib RTScene.lib RTWorld.lib cg.lib cgGL.lib QtInterface05.lib QtGui4.lib QtOpenGL4.lib QtCore4.lib qtmain.lib" 
    156156                                OutputFile="../bin/$(ConfigurationName)/Preprocessor.exe" 
    157157                                LinkIncremental="1" 
  • GTP/trunk/Lib/Vis/Preprocessing/src/demo1.env

    r2524 r2677  
    7474        visibilityFile visibility.xml 
    7575        loadMeshes false 
    76         loadKdTree      false 
     76        loadKdTree false 
    7777        exportKdTree false 
    7878 
     
    169169 
    170170KdTree { 
    171         pvsArea   5e-4 
     171        pvsArea   5e-5 
    172172        sahUseFaces false 
    173173        Termination { 
  • GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp

    r2676 r2677  
    257257        { 
    258258                cout << "importing random view cells" << endl; 
    259                 preprocessor->mViewCellsManager->ImportViewCellsList(viewCellPointsFile); 
    260                 cout << "finished" << endl; 
     259                if (preprocessor->mViewCellsManager->ImportViewCellsList(viewCellPointsFile)) 
     260                        cout << "successfully loaded " << viewCellPointsFile << endl; 
     261                else 
     262                        cout << "error: file << " << viewCellPointsFile << " not found, generating random view points!" << endl; 
    261263        } 
    262264 
Note: See TracChangeset for help on using the changeset viewer.