Changeset 1917


Ignore:
Timestamp:
12/21/06 00:42:55 (17 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
6 edited

Legend:

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

    r1916 r1917  
    638638        // high avg ray contri, the result is influenced by undersampling 
    639639        splitCandidate.SetAvgRayContribution(avgRayContri); 
    640  
    641         const float oldVolume = EvalViewCellsVolume(leaf->mObjects) / GetViewSpaceVolume(); 
    642         const float oldRatio = tData.mVolume > 0 ? oldVolume / tData.mVolume : 1; 
     640        const float viewSpaceVol =  GetViewSpaceVolume(); 
     641 
     642        const float oldVolume = EvalViewCellsVolume(leaf->mObjects) / viewSpaceVol; 
     643        const float oldRatio = (tData.mVolume) > 0 ? oldVolume / tData.mVolume : 1; 
    643644        const float parentVol = tData.mCorrectedVolume * oldRatio; 
    644645 
    645646        // this leaf is a pvs entry in all the view cells 
    646647        // that see one of the objects. 
    647         const float frontVol = EvalViewCellsVolume(splitCandidate.mFrontObjects) / GetViewSpaceVolume(); 
    648         const float backVol = EvalViewCellsVolume(splitCandidate.mBackObjects) / GetViewSpaceVolume(); 
     648        const float frontVol = EvalViewCellsVolume(splitCandidate.mFrontObjects) / viewSpaceVol; 
     649        const float backVol = EvalViewCellsVolume(splitCandidate.mBackObjects) / viewSpaceVol; 
    649650 
    650651        splitCandidate.mCorrectedFrontVolume =  
     
    670671        splitCandidate.SetPvsEntriesIncr(pvsEntriesIncr); 
    671672 
     673        if (0) 
    672674        cout << "bvh volume cost" 
    673675                 << " avg ray contri: " << avgRayContri << " ratio: " << oldRatio  
    674                  << " parent: " << parentVol << " " << " old vol: " << oldVolume  
     676                 << " parent: " << parentVol << " old vol: " << oldVolume  
    675677                 << " frontvol: " << frontVol << " corr. " << splitCandidate.mCorrectedFrontVolume  
    676678                 << " backvol: " << backVol << " corr. " << splitCandidate.mCorrectedBackVolume << endl; 
     
    707709                mHierarchyManager->EvalCorrectedPvs((float)backViewCells, parentPvs, avgRayContri); 
    708710 
     711        if (0) 
    709712        cout << "bvh pvs" 
    710713                 << " avg ray contri: " << avgRayContri << " ratio: " << oldPvsRatio  
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp

    r1916 r1917  
    747747        } 
    748748        // assume pvs not sampled sufficiently => take total pvs 
    749         if (avgRayContri > mMaxAvgRayContri) 
     749        if (avgRayContri >= mMaxAvgRayContri) 
    750750        { 
    751751                return totalPvs; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r1900 r1917  
    12121212} 
    12131213 
    1214 void 
    1215 Preprocessor::EvalViewCellHistogram() 
    1216 { 
    1217   char filename[256]; 
    1218   Environment::GetSingleton()->GetStringValue("Preprocessor.histogram.file", 
    1219                                                                                           filename); 
     1214void Preprocessor::EvalViewCellHistogram() 
     1215{ 
     1216        char filename[256]; 
     1217        Environment::GetSingleton()->GetStringValue("Preprocessor.histogram.file", filename); 
    12201218   
    1221   // mViewCellsManager->EvalViewCellHistogram(filename, 1000000); 
    1222   mViewCellsManager->EvalViewCellHistogramForPvsSize(filename, 1000000); 
     1219        // mViewCellsManager->EvalViewCellHistogram(filename, 1000000); 
     1220        mViewCellsManager->EvalViewCellHistogramForPvsSize(filename, 1000000); 
    12231221} 
    12241222 
  • GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj

    r1912 r1917  
    206206                                Name="VCLinkerTool" 
    207207                                AdditionalDependencies="xerces-c_2.lib glew32.lib zdll.lib zziplib.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib Preprocessor.lib RTScene.lib RTWorld.lib QtCore4.lib qtmain.lib QtOpenGL4.lib Qt3Support4.lib QtTest4.lib QtGui4.lib QtGlRenderer.lib" 
    208                                 OutputFile="../bin/release/Preprocessor2.exe" 
     208                                OutputFile="../bin/release/Preprocessor.exe" 
    209209                                LinkIncremental="1" 
    210210                                AdditionalLibraryDirectories="..\src\GL;..\lib\release;..\..\Preprocessing\lib\release;..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib;..\MultiLevelRayTracing\RTScene\Release;..\MultiLevelRayTracing\RTWorld\Release;&quot;$(QTDIR)\lib&quot;;.\QtGlRenderer\Release" 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1916 r1917  
    706706        int smallerCostSum = 0; 
    707707         
    708         // note can skip computations for view cells already evaluated and delete them from vector ... 
     708        // note can skip computations for view cells already  
     709        // evaluated and delete them from vector ... 
    709710    while (1) 
    710711        { 
     
    746747 
    747748 
    748  
    749749ViewCellsManager *ViewCellsManager::LoadViewCells(const string &filename,  
    750750                                                                                                  ObjectContainer *objects, 
     
    904904        viewCells = mViewCells; 
    905905#endif 
    906         ViewCellContainer::iterator it = viewCells.begin(), 
    907           it_end = viewCells.end();              
    908         for (; it != it_end; ++it) { 
    909           //(*it)->UpdatePvsCost(); 
    910           (*it)->SetPvsCost((float)(*it)->GetFilteredPvsSize()); 
     906        ViewCellContainer::iterator it = viewCells.begin(), it_end = viewCells.end();            
     907        for (; it != it_end; ++it)  
     908        { 
     909                if (1) 
     910                        (*it)->UpdatePvsCost(); 
     911                else 
     912                        (*it)->SetPvsCost((float)(*it)->GetFilteredPvsSize()); 
    911913        } 
    912914 
     
    921923        // hack: normalize pvs size 
    922924        int histoMaxVal; 
    923         Environment::GetSingleton()->GetIntValue( 
    924                                                                                          "Preprocessor.histogram.maxValue", histoMaxVal); 
     925        Environment::GetSingleton()->GetIntValue("Preprocessor.histogram.maxValue", histoMaxVal); 
    925926        maxVal = max((float)histoMaxVal, maxPvs); 
    926927                 
     
    938939        if (!stepSize) stepSize = 1; 
    939940         
     941        Debug << "intervals " << histoIntervals << endl; 
    940942        Debug << "stepsize: " << stepSize << endl; 
    941          
     943        cout << "intervals " << histoIntervals << endl; 
     944        cout << "stepsize: " << stepSize << endl; 
     945 
    942946        const float totalRenderCost = mViewCellsTree->GetRoot()->GetRenderCost(); 
    943947        const float totalVol = GetViewSpaceBox().GetVolume(); 
     
    987991 
    988992        outstream.close(); 
    989  
    990993} 
    991994 
     
    60446047 
    60456048        // mix of sampling strategies 
    6046         mStrategies.push_back(SamplingStrategy::OBJECT_DIRECTION_BASED_DISTRIBUTION); 
     6049        evalStrats.push_back(SamplingStrategy::OBJECT_DIRECTION_BASED_DISTRIBUTION); 
    60476050 
    60486051        //evalStrats.push_back(SamplingStrategy::OBJECT_BASED_DISTRIBUTION); 
     
    61686171                disposeRays(evaluationSamples, NULL); 
    61696172        } 
    6170          
    6171 } 
     6173 
     6174        //////////// 
     6175        //-- histogram 
     6176 
     6177        const int numLeaves = mViewCellsTree->GetNumInitialViewCells(mViewCellsTree->GetRoot()); 
     6178        bool useHisto; 
     6179        int histoStepSize; 
     6180 
     6181        Environment::GetSingleton()->GetBoolValue("ViewCells.Evaluation.histogram", useHisto); 
     6182        Environment::GetSingleton()->GetIntValue("ViewCells.Evaluation.histoStepSize", histoStepSize); 
     6183 
     6184        if (useHisto) 
     6185        { 
     6186                // evaluate view cells in a histogram            
     6187                char s[64]; 
     6188 
     6189                // hack: just show final view cells 
     6190                int pass = (int)mViewCells.size(); 
     6191                //for (int pass = histoStepSize; pass <= numLeaves; pass += histoStepSize) 
     6192                if (1) 
     6193                { 
     6194                        string filename; 
     6195 
     6196                        cout << "computing histogram for " << pass << " view cells" << endl; 
     6197#if 0 
     6198                        //-- evaluate histogram for render cost 
     6199                        sprintf(s, "-%09d-histo.log", pass); 
     6200                        filename = string(statsPrefix) + string(s); 
     6201 
     6202                        EvalViewCellHistogram(filename, pass); 
     6203 
    61726204#endif 
    6173  
    6174  
    6175  
    6176 } 
     6205                        ////////////////////////////////////////// 
     6206            //-- evaluate histogram for pvs size 
     6207 
     6208                        cout << "computing pvs histogram for " << pass << " view cells" << endl; 
     6209 
     6210                        sprintf(s, "-%09d-histo-pvs.log", pass); 
     6211                        filename = string(statsPrefix) + string(s); 
     6212 
     6213                        EvalViewCellHistogramForPvsSize(filename, pass); 
     6214                } 
     6215        } 
     6216} 
     6217 
     6218#endif 
     6219 
     6220 
     6221 
     6222} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp

    r1916 r1917  
    908908                                                                                        splitCandidate.GetAvgRayContribution()); 
    909909         
    910          
     910        if (0) 
    911911        cout << "vsp pvs" 
    912912                 << " avg ray contri: " << splitCandidate.GetAvgRayContribution() << " ratio: " << oldPvsRatio  
     
    16211621        const float renderCostDecrease = (oldRenderCost - newRenderCost) / viewSpaceVol; 
    16221622 
     1623        if (0) 
    16231624        cout << "vsp render cost" 
    16241625                 << " avg ray contri: " << avgRayContri << " ratio: " << oldRenderCostRatio 
Note: See TracChangeset for help on using the changeset viewer.