Ignore:
Timestamp:
11/14/05 15:59:20 (19 years ago)
Author:
mattausch
Message:

worked on kd view space partitioning structure
worked on render simulation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp

    r407 r409  
    1414#include "Plane3.h" 
    1515 
     16int BspTree::sMaxPolyCandidates = 10; 
     17int BspTree::sMaxRayCandidates = 10; 
     18int BspTree::sSplitPlaneStrategy = BALANCED_POLYS;  
     19int BspTree::sConstructionMethod = FROM_INPUT_VIEW_CELLS; 
     20 
     21 
    1622int BspTree::sTermMaxPolygons = 10; 
    1723int BspTree::sTermMinPvs = 20; 
    1824int BspTree::sTermMaxDepth = 20; 
    1925float BspTree::sTermMinArea = 0.001f; 
    20 int BspTree::sMaxPolyCandidates = 10; 
    21 int BspTree::sMaxRayCandidates = 10; 
    22 int BspTree::sSplitPlaneStrategy = BALANCED_POLYS;  
    23 int BspTree::sConstructionMethod = FROM_INPUT_VIEW_CELLS; 
    2426int BspTree::sTermMaxPolysForAxisAligned = 50; 
    2527int BspTree::sTermMaxObjectsForAxisAligned = 50; 
    2628int BspTree::sTermMaxRaysForAxisAligned = -1; 
    2729int BspTree::sTermMaxRays = -1; 
     30float BspTree::sTermMaxRayContribution = 0.05f; 
     31float BspTree::sTermMaxAccRayLength = 50; 
     32 
     33 
    2834int BspTree::sMinPvsDif = 10; 
    2935int BspTree::sMinPvs = 10; 
     
    704710                 (data.mPvs <= sTermMinPvs) || 
    705711                 (data.mArea <= sTermMinArea) || 
    706                  (data.mDepth >= sTermMaxDepth)); 
     712                 (data.mDepth >= sTermMaxDepth) || 
     713                 (((float)data.mPvs / (float)data.mRays->size()) < sTermMaxRayContribution)); 
    707714} 
    708715 
     
    863870                                                                                        coincident); 
    864871 
    865         // split geometry 
    866         tData.mGeometry->SplitGeometry(*frontData.mGeometry, *backData.mGeometry,  
    867                                                                    *this, interior->mPlane); 
    868          
    869         // compute area 
    870         frontData.mArea = frontData.mGeometry->GetArea(); 
    871         backData.mArea = backData.mGeometry->GetArea(); 
    872  
    873         // compute pvs 
     872    // compute pvs 
    874873        frontData.mPvs = ComputePvsSize(*frontData.mRays); 
    875874        backData.mPvs = ComputePvsSize(*backData.mRays); 
    876875 
     876        // split geometry and compute area 
     877        if (1) 
     878        { 
     879                tData.mGeometry->SplitGeometry(*frontData.mGeometry,  
     880                                                                           *backData.mGeometry,  
     881                                                                           *this,  
     882                                                                           interior->mPlane); 
     883         
     884                 
     885                frontData.mArea = frontData.mGeometry->GetArea(); 
     886                backData.mArea = backData.mGeometry->GetArea(); 
     887        } 
     888 
     889        // compute accumulated ray length 
     890        //frontData.mAccRayLength = AccumulatedRayLength(*frontData.mRays); 
     891        //backData.mAccRayLength = AccumulatedRayLength(*backData.mRays); 
    877892 
    878893        //-- create front and back leaf 
     
    15021517                           (pOverall * (float)pvs * 2); 
    15031518 
    1504                 // give penalty for unbalanced cell 
    1505                 if (((pFront * 0.2 + 0.00001) > pBack) || (pFront < (pBack * 0.2 + 0.00001))) 
     1519                // give penalty to unbalanced split 
     1520                if (((pFront * 0.2 + Limits::Small) > pBack) || (pFront < (pBack * 0.2 + Limits::Small))) 
    15061521                        val += 0.5; 
    15071522        } 
     
    16331648        environment->GetIntValue("BspTree.Termination.maxPolygons", sTermMaxPolygons); 
    16341649        environment->GetIntValue("BspTree.Termination.maxRays", sTermMaxRays); 
    1635         environment->GetFloatValue("BspTree.Termination.minArea", sTermMinArea); 
     1650        environment->GetFloatValue("BspTree.Termination.minArea", sTermMinArea);         
     1651        environment->GetFloatValue("BspTree.Termination.maxRayContribution", sTermMaxRayContribution); 
     1652        environment->GetFloatValue("BspTree.Termination.maxAccRayLenght", sTermMaxAccRayLength); 
    16361653 
    16371654        //-- termination criteria for axis aligned split 
     
    17431760                mStat.minDepth = data.mDepth; 
    17441761 
    1745         // store minimal and maximal pvs 
    1746         /*if (data.mPvs > mStat.pvs)mStat.pvs = data.mPvs; 
    1747         if (data.mPvs < mStat.pvs)      mStat.pvs = data.mPvs;*/ 
    1748  
    1749         // accumulate depth to compute average 
     1762        // accumulate depth to compute average depth 
    17501763        mStat.accumDepth += data.mDepth; 
    17511764         
     
    17571770                  << "#polygons: " << (int)data.mPolygons->size() << " (max: " << sTermMaxPolygons << "), " 
    17581771                  << "#rays: " << (int)data.mRays->size() << " (max: " << sTermMaxRays << "), "  
    1759                   << "#pvs: " << leaf->GetViewCell()->GetPvs().GetSize() << endl; 
     1772                  << "#pvs: " << leaf->GetViewCell()->GetPvs().GetSize() << "=, " 
     1773                  << "#avg ray contrib (pvs): " << (float)data.mPvs / (float)data.mRays->size() << endl; 
    17601774//#endif 
    17611775} 
     
    20282042{ 
    20292043        return mStat; 
     2044} 
     2045 
     2046float BspTree::AccumulatedRayLength(BoundedRayContainer &rays) const 
     2047{ 
     2048        float len = 0; 
     2049 
     2050        BoundedRayContainer::const_iterator it, it_end = rays.end(); 
     2051 
     2052        for (it = rays.begin(); it != it_end; ++ it) 
     2053        { 
     2054                len += SqrDistance((*it)->mRay->Extrap((*it)->mMinT),  
     2055                                                   (*it)->mRay->Extrap((*it)->mMaxT)); 
     2056        } 
     2057 
     2058        return len; 
    20302059} 
    20312060 
     
    20772106 
    20782107                                DEL_PTR(bRay); 
    2079  
    2080                                 ++ splits; 
    20812108                        } 
    20822109                        break; 
     
    20892116                                backRays.push_back(new BoundedRay(ray, bRay->mMinT, newT)); 
    20902117                                frontRays.push_back(new BoundedRay(ray, newT, bRay->mMaxT)); 
    2091                                  
    20922118                                DEL_PTR(bRay); 
    20932119 
Note: See TracChangeset for help on using the changeset viewer.