Ignore:
Timestamp:
11/02/05 23:59:16 (19 years ago)
Author:
mattausch
Message:

added render heuristics evaluation

Location:
trunk/VUT/GtpVisibilityPreprocessor
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env

    r370 r371  
    8282        #       input fromViewCells 
    8383        #       input fromSceneGeometry 
    84                 samples 200000 
     84                samples 100000 
    8585                sideTolerance 0.005 
    8686        } 
  • trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp

    r370 r371  
    531531                cout << "#totalPvsSize=" << mKdTree->CollectLeafPvs() << endl; 
    532532   
    533         // merge or subdivide view cells 
    534533        if (mBspTree) 
    535534        { 
     
    538537                Debug << "original pvs size: " << mBspTree->CountViewCellPvs() << endl; 
    539538 
     539                // merge or subdivide view cells 
    540540                long startTime = GetTime(); 
    541541                int merged = PostprocessViewCells(mSampleRays); 
     
    548548                Debug << "merged pvs size: " << mBspTree->CountViewCellPvs() << endl; 
    549549 
     550 
     551                cout << "evaluating render time heuristics ... "; 
     552                Real rt = EvaluateRenderHeuristics(); 
     553                cout << "finished" << endl; 
     554 
     555                Debug << "render time: " << rt * 1e-3 << endl; 
    550556        } 
    551557         
     
    881887        } 
    882888} 
     889 
     890Real SamplingPreprocessor::EvaluateRenderHeuristics() 
     891{ 
     892        Real renderTime = 0; 
     893 
     894        const float objRt = 1.0f; // render time for 1 object of PVS 
     895        const float vcOverhead = 1.0f; // const overhead for crossing a view cell border 
     896         
     897        float totalArea = 0; 
     898 
     899        ViewCellContainer viewCells; 
     900 
     901        mBspTree->CollectViewCells(viewCells); 
     902 
     903        ViewCellContainer::const_iterator it, it_end = viewCells.end(); 
     904        PolygonContainer::const_iterator pit; 
     905 
     906        for (it = viewCells.begin(); it != it_end; ++ it) 
     907        { 
     908                // surface area substitute for probability 
     909                PolygonContainer cell; 
     910                float area = 0; 
     911 
     912                mBspTree->ConstructGeometry(dynamic_cast<BspViewCell *>(*it), cell); 
     913 
     914                for (pit = cell.begin(); pit != cell.end(); ++ pit) 
     915                        area += (*pit)->GetArea(); 
     916                 
     917                renderTime += area * (*it)->GetPvs().GetSize() * objRt; 
     918                totalArea += area; 
     919        } 
     920 
     921        renderTime /= totalArea; 
     922 
     923        renderTime += (float)viewCells.size() * vcOverhead; 
     924         
     925        return renderTime; 
     926} 
  • trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.h

    r369 r371  
    9797        int PostprocessViewCells(const RayContainer &rays); 
    9898 
     99        /** Simulated rendering using a simple render heuristics. Used to evaluate the  
     100                quality of the view cell partition. 
     101        */ 
     102        Real EvaluateRenderHeuristics(); 
    99103}; 
    100104 
Note: See TracChangeset for help on using the changeset viewer.