Changeset 2730


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

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/run_gvs_vps.sh

    r2729 r2730  
    4242-gvs_total_samples=1000000 \ 
    4343-gvs_samples_per_pass=1000000 \ 
    44 -gvs_initial_samples=4 \ 
    45 -gvs_max_viewcells=2 \ 
     44-gvs_initial_samples=1 \ 
     45-gvs_max_viewcells=3 \ 
    4646-gvs_min_contribution=500 \ 
    4747-gvs_per_viewcell=true \ 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp

    r2727 r2730  
    15631563{ 
    15641564        mPvsStat.Reset(); 
    1565         ++ mPvsStat.pass; 
     1565        ++ mPvsStat.currentPass; 
    15661566 
    15671567        SetupProjection(GetWidth(), GetHeight()); 
     
    15721572 
    15731573        int i = 0; 
    1574  
    15751574        // $matt tmp: somehow this is not properly initialised 
    15761575        //ClearErrorBuffer(); 
     
    15791578        { 
    15801579                SimpleRay sray = *sit; 
    1581                  
    15821580                int pvsSize = -1; 
    15831581 
     
    15931591                { 
    15941592                        // compute the pixel error 
    1595                         mPvsErrorBuffer[i].mError = GetPixelError(pvsSize, mPvsStat.pass); 
     1593                        mPvsErrorBuffer[i].mError = GetPixelError(pvsSize, mPvsStat.currentPass); 
    15961594                        mPvsErrorBuffer[i].mPvsSize = pvsSize; 
    15971595 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h

    r2723 r2730  
    4242  int frames; 
    4343  int errorFreeFrames; 
    44   int pass; 
    45  
    46   PvsRenderStatistics(): pass(0) { Reset(); } 
     44  int currentPass; 
     45 
     46  PvsRenderStatistics(): currentPass(0) { Reset(); } 
    4747   
    4848  void Reset()  
     
    5353        errorFreeFrames = 0; 
    5454        sumPvsSize = 0; 
     55        //cuurentPass = 0; 
    5556  } 
    5657 
     
    171172   
    172173  /** Gets the pixel error of the current view point.  
    173      returns the size of the pvs for the current view point. pass returns the  
    174          current pass of the evaluation. 
    175         */ 
     174        returns the size of the pvs for the current view point. pass returns the  
     175        current pass of the evaluation. 
     176  */ 
    176177  virtual float GetPixelError(int &pvsSize, int pass); 
    177178   
  • GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp

    r2729 r2730  
    1414#include "IntersectableWrapper.h" 
    1515#include "Timer/PerfTimer.h" 
     16#include "Vector2.h" 
     17#include "RndGauss.h" 
     18 
    1619 
    1720 
     
    13261329        // export the preprocessed information to a file 
    13271330        if (0 && mExportVisibility) 
    1328         { 
    13291331                ExportPreprocessedData(mVisibilityFileName); 
    1330         } 
    13311332         
    13321333        // compute the pixel error of this visibility solution 
    1333         if (mEvaluatePixelError) 
    1334         { 
     1334        if (0 && mEvaluatePixelError) 
    13351335                ComputeRenderError(); 
    1336         } 
    13371336 
    13381337        return true; 
     
    14241423        mGvsStats.mGvsSamples = 0; 
    14251424 
     1425        //renderer->mPvsStat.currentPass = 0; 
     1426        mPass = 0; 
     1427 
    14261428        int oldContribution = 0; 
    14271429        int passSamples = 0; 
     
    15071509                        mGvsStats.mPassContribution = 0; 
    15081510                        passSamples = 0; 
     1511                         
     1512                        // compute the pixel error of this visibility solution 
     1513                        if (mEvaluatePixelError) 
     1514                                ComputeRenderError(); 
    15091515                } 
    15101516        } 
     
    16271633        cout << "raw cast time          : " << rawCastTime << endl; 
    16281634 
    1629         float randomRaysPerSec = mGvsStats.mRandomSamples / (1e6f * initialTime); 
    1630         float gvsRaysPerSec = mGvsStats.mGvsSamples / (1e6f * gvsTime); 
    1631         float rawRaysPerSec = mGvsStats.mPerViewCellSamples / (1e6f * rawCastTime); 
     1635        double randomRaysPerSec = mGvsStats.mRandomSamples / (1e6 * initialTime); 
     1636        double gvsRaysPerSec = mGvsStats.mGvsSamples / (1e6 * gvsTime); 
     1637        double rawRaysPerSec = mGvsStats.mPerViewCellSamples / (1e6 * rawCastTime); 
    16321638 
    16331639        cout << "cast " << randomRaysPerSec << " M random rays/s: " << endl; 
     
    18041810} 
    18051811 
    1806 } 
     1812 
     1813void GvsPreprocessor::ComputeRenderError() 
     1814{ 
     1815        // compute rendering error       
     1816        if (renderer && renderer->mPvsStatFrames)  
     1817        { 
     1818                if (!mViewCellsManager->GetViewCellPointsList()->empty())  
     1819                { 
     1820                        ViewCellPointsList *vcPoints = mViewCellsManager->GetViewCellPointsList(); 
     1821                        ViewCellPointsList::const_iterator vit = vcPoints->begin(),     vit_end = vcPoints->end(); 
     1822 
     1823                        SimpleRayContainer viewPoints; 
     1824 
     1825                        for (; vit != vit_end; ++ vit)  
     1826                        { 
     1827                                ViewCellPoints *vp = *vit; 
     1828                                 
     1829                                SimpleRayContainer::const_iterator rit = vp->second.begin(), rit_end = vp->second.end(); 
     1830                         
     1831                                for (; rit!=rit_end; ++rit) 
     1832                                { 
     1833                                        ViewCell *vc = mViewCellsManager->GetViewCell((*rit).mOrigin); 
     1834                                        if (vc == mCurrentViewCell) 
     1835                                                viewPoints.push_back(*rit); 
     1836                                } 
     1837                        } 
     1838 
     1839                        renderer->mPvsErrorBuffer.clear(); 
     1840 
     1841                        if (viewPoints.size() != renderer->mPvsErrorBuffer.size())  
     1842                        { 
     1843                                renderer->mPvsErrorBuffer.resize(viewPoints.size()); 
     1844                                renderer->ClearErrorBuffer(); 
     1845                        } 
     1846 
     1847                        cout << "evaluating list of " << viewPoints.size() << " pts" << endl; 
     1848                        renderer->EvalPvsStat(viewPoints); 
     1849                }  
     1850                else 
     1851                { 
     1852                        cout << "evaluating random points" << endl; 
     1853                        renderer->EvalPvsStat(); 
     1854                } 
     1855 
     1856                mStats << 
     1857                        "#AvgPvsRenderError\n" <<renderer->mPvsStat.GetAvgError()<<endl<< 
     1858                        "#AvgPixelError\n" <<renderer->GetAvgPixelError()<<endl<< 
     1859                        "#MaxPixelError\n" <<renderer->GetMaxPixelError()<<endl<< 
     1860                        "#MaxPvsRenderError\n" <<renderer->mPvsStat.GetMaxError()<<endl<< 
     1861                        "#ErrorFreeFrames\n" <<renderer->mPvsStat.GetErrorFreeFrames()<<endl<< 
     1862                        "#AvgRenderPvs\n" <<renderer->mPvsStat.GetAvgPvs()<<endl; 
     1863        } 
     1864} 
     1865 
     1866 
     1867SimpleRay GvsPreprocessor::GenerateJitteredSample(const SimpleRay &sray) 
     1868{ 
     1869        // mutate the origin 
     1870        Vector3 d = sray.mDirection; 
     1871   
     1872        // Compute right handed coordinate system from direction 
     1873        Vector3 U, V; 
     1874        d.RightHandedBase(U, V); 
     1875 
     1876        float rr[2]; 
     1877 
     1878        rr[0] = RandomValue(0, 1); 
     1879        rr[1] = RandomValue(0, 1); 
     1880 
     1881        Vector2 vr2(rr[0], rr[1]); 
     1882        Vector2 gaussvec2; 
     1883 
     1884        const float sigma = 0.2f; 
     1885 
     1886        GaussianOn2D(vr2, sigma, // input 
     1887                         gaussvec2); // output 
     1888         
     1889        Vector3 shift = gaussvec2.xx * U + gaussvec2.yy * V; 
     1890         
     1891        d += shift; 
     1892   
     1893        d.Normalize(); 
     1894 
     1895        return SimpleRay(sray.mOrigin, d, SamplingStrategy::GVS, 1.0f); 
     1896} 
     1897 
     1898 
     1899} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.h

    r2729 r2730  
    272272        void CastRayBundle16(const SimpleRay &ray, VssRayContainer &vssRays); 
    273273 
     274        virtual void ComputeRenderError(); 
     275 
     276        SimpleRay GenerateJitteredSample(const SimpleRay &ray); 
     277 
    274278 
    275279        ////////////////////// 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp

    r2725 r2730  
    174174void QtGlRendererBuffer::RenderTrianglePvs() 
    175175{ 
     176        //Intersectable::NewMail; 
     177 
    176178        ObjectContainer::const_iterator oit, oit_end =  
    177179                mViewCellsManager->GetPreprocessor()->mTrianglePvs.end(); 
     
    179181        //int sz = mViewCellsManager->GetPreprocessor()->mDummyBuffer.size(); 
    180182 
    181         int i = 0; 
    182183        for (oit = mViewCellsManager->GetPreprocessor()->mTrianglePvs.begin(); 
    183                  oit != oit_end; ++ oit, ++ i) 
    184         { 
     184                 oit != oit_end; ++ oit) 
     185        { 
     186                TriangleIntersectable *triObj = static_cast<TriangleIntersectable *>(*oit); 
     187 
    185188                //int dum = mViewCellsManager->GetPreprocessor()->mDummyBuffer[i]; 
    186189                //glColor3f(0, (float)dum / 20.0f, 1); 
    187                 if (mUseFalseColors) SetupFalseColor((*oit)->mId); 
    188  
    189                 RenderIntersectable(*oit); 
     190                if (mUseFalseColors) SetupFalseColor(triObj->mId); 
     191 
     192                RenderIntersectable(triObj); 
     193 
     194                /*if (!triObj->Mailed()) 
     195                        triObj->Mail(); 
     196                else 
     197                        cerr << "böser fehler" << endl; 
     198                */ 
    190199        } 
    191200} 
     
    194203 
    195204// reimplemented here so that we can snap the error windows 
    196 float QtGlRendererBuffer::GetPixelError(int &pvsSize, int pass) 
     205float QtGlRendererBuffer::GetPixelError(int &pvsSize, int currentPass) 
    197206{ 
    198207        MakeLive(); 
     
    301310 
    302311        KdNode::NewMail2(); 
    303         Intersectable::NewMail(); 
    304  
     312        //Intersectable::NewMail(); 
     313 
     314        //mUseFalseColors = true; 
     315        // hack for gvs 
     316        RenderTrianglePvs(); 
    305317        // render pvs once 
    306         RenderPvs(pvs); 
     318        //RenderPvs(pvs); 
    307319 
    308320        //glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE); 
     
    320332 
    321333        KdNode::NewMail2(); 
    322         Intersectable::NewMail(); 
     334        //Intersectable::NewMail(); 
    323335 
    324336        query->BeginQuery(); 
     
    357369                        //sprintf(filename, "error-frame-%04d-%05d.bmp", pass, mFrame); 
    358370                        //sprintf(filename, "error-frame-%05d-%0.5f.png", mFrame, pErrorPixels); 
    359                         sprintf_s(filename, "error-frame-%05d-%04d-%08d.png", mFrame, viewcell->GetId(), pixelCount); 
     371                        sprintf_s(filename, "error-frame-%05d-%05d-%08d.png", viewcell->GetId(), mFrame, pixelCount); 
    360372 
    361373                        QImage im = toImage(); 
     
    379391 
    380392                                KdNode::NewMail2(); 
    381                                 Intersectable::NewMail(); 
     393                                //Intersectable::NewMail(); 
    382394 
    383395                                ++ mCurrentFrame; 
     
    385397                                // render pvs once 
    386398                                RenderPvs(pvs); 
    387                                 // hack for gvs vis 
     399                                // hack for gvs visualization 
    388400                                //RenderTrianglePvs(); 
    389401 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h

    r2725 r2730  
    7676        int ComputePvs(ObjectContainer &objects, ObjectContainer &pvs) const; 
    7777 
    78         /** quick hack in order to be able to render gvs pvs. 
     78        /** quick hack in order to be able to render gvs based triangle pvs. 
    7979        */ 
    8080        void RenderTrianglePvs(); 
Note: See TracChangeset for help on using the changeset viewer.