Changeset 400


Ignore:
Timestamp:
11/10/05 02:28:42 (19 years ago)
Author:
mattausch
Message:

fixed pvs criterium

Location:
trunk/VUT
Files:
5 edited

Legend:

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

    r399 r400  
    5656 
    5757Sampling { 
    58         totalSamples    100000 
     58        totalSamples    300000 
    5959        samplesPerPass  3 
    6060} 
     
    8888        #       input fromViewCells 
    8989        #       input fromSceneGeometry 
    90                 samples 50000 
     90                samples 100000 
    9191                sideTolerance 0.005 
    9292        } 
     
    126126        #splitPlaneStrategy 130 
    127127         
    128         splitPlaneStrategy 8 
     128        splitPlaneStrategy 1024 
    129129         
    130130        maxPolyCandidates 50 
     
    133133        Termination { 
    134134                # autopartition 
    135                 maxRays 200 
    136                 maxPolygons 20 
    137                 maxDepth 30 
    138                 minPvs -1 
    139                 minArea -0.001 
     135                maxRays 100 
     136                maxPolygons 10 
     137                maxDepth 50 
     138                minPvs 20 
     139                minArea 0.001 
    140140                 
    141141                # axis aligned splits 
     
    158158                exportSplits true 
    159159                # how much samples should be used in visualization 
    160                 samples 100000 
     160                samples 1000 
    161161        } 
    162162} 
  • trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp

    r399 r400  
    726726                        // throw away samples because BSP leaves not stored in order  
    727727                        // Need ordered rays for post processing => collect new rays 
    728                         //CLEAR_CONTAINER(mSampleRays); 
     728                        CLEAR_CONTAINER(mSampleRays); 
    729729                } 
    730730        } 
     
    885885                        ViewCellPvsMap::iterator it = vc->GetPvs().mEntries.begin(); 
    886886 
    887                         //exporter->SetWireframe(); 
    888                         exporter->SetFilled(); 
     887                        exporter->SetWireframe(); 
     888                        //exporter->SetFilled(); 
    889889 
    890890                        Material m;//= RandomMaterial(); 
     
    907907 
    908908                        // export rays piercing this view cell 
    909                         exporter->ExportRays(vcRays[i], 10000, RgbColor(0, 1, 0)); 
     909                        exporter->ExportRays(vcRays[i], 1000, RgbColor(0, 1, 0)); 
    910910 
    911911                        m.mDiffuseColor = RgbColor(1, 0, 0); 
     
    982982                        Exporter *exporter = Exporter::GetExporter(s); 
    983983                         
    984                         exporter->SetFilled();//Wireframe(); 
     984                        exporter->SetWireframe(); 
    985985 
    986986                        Material m;//= RandomMaterial(); 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp

    r399 r400  
    1717int BspTree::sTermMinPvs = 20; 
    1818int BspTree::sTermMaxDepth = 20; 
    19 float BspTree::sTermMinArea = 0.001; 
     19float BspTree::sTermMinArea = 0.001f; 
    2020int BspTree::sMaxPolyCandidates = 10; 
    2121int BspTree::sMaxRayCandidates = 10; 
     
    747747                DEL_PTR(tData.mPolygons); 
    748748                DEL_PTR(tData.mRays); 
    749                 DEL_PTR(tData.mCell); 
     749                DEL_PTR(tData.mGeometry); 
    750750                 
    751751                return leaf; 
     
    762762         
    763763        BspTraversalData tFrontData(NULL, new PolygonContainer(), tData.mDepth + 1, mRootCell,  
    764                                                                 new BoundedRayContainer(), 0, NULL, 0); 
     764                                                                new BoundedRayContainer(), 0, 0, new BspNodeGeometry()); 
    765765        BspTraversalData tBackData(NULL, new PolygonContainer(), tData.mDepth + 1, mRootCell,  
    766                                                            new BoundedRayContainer(), 0, NULL, 0); 
     766                                                           new BoundedRayContainer(), 0, 0, new BspNodeGeometry()); 
    767767 
    768768        // create new interior node and two leaf nodes 
     
    801801        DEL_PTR(tData.mPolygons); 
    802802        DEL_PTR(tData.mRays); 
    803         DEL_PTR(tData.mCell);            
     803        DEL_PTR(tData.mGeometry);                
    804804 
    805805        return interior; 
     
    844844        // select subdivision plane 
    845845        BspInterior *interior =  
    846                 new BspInterior(SelectPlane(leaf, tData, frontData, backData));  
     846                new BspInterior(SelectPlane(leaf, tData));  
    847847 
    848848#ifdef _DEBUG 
     
    858858                                                                                        *backData.mPolygons,  
    859859                                                                                        coincident); 
     860 
     861        // split geometry 
     862        tData.mGeometry->SplitGeometry(*frontData.mGeometry, *backData.mGeometry,  
     863                                                                   *this, interior->mPlane); 
     864         
     865        // compute area 
     866        frontData.mArea = frontData.mGeometry->GetArea(); 
     867        backData.mArea = backData.mGeometry->GetArea(); 
     868 
     869        // compute pvs 
     870        frontData.mPvs = ComputePvsSize(*frontData.mRays); 
     871        backData.mPvs = ComputePvsSize(*backData.mRays); 
     872 
     873 
    860874 
    861875        BspInterior *parent = leaf->GetParent(); 
     
    10221036 
    10231037Plane3 BspTree::SelectPlane(BspLeaf *leaf,  
    1024                                                         BspTraversalData &data, 
    1025                                                         BspTraversalData &frontData, 
    1026                                                         BspTraversalData &backData) 
     1038                                                        BspTraversalData &data) 
    10271039{ 
    10281040        if (data.mPolygons->empty() && data.mRays->empty()) 
     
    10681080 
    10691081        // use heuristics to find appropriate plane 
    1070         return SelectPlaneHeuristics(leaf, data, frontData, backData);  
     1082        return SelectPlaneHeuristics(leaf, data);  
    10711083} 
    10721084 
    10731085Plane3 BspTree::SelectPlaneHeuristics(BspLeaf *leaf, 
    1074                                                                           BspTraversalData &data, 
    1075                                                                           BspTraversalData &frontData, 
    1076                                                                           BspTraversalData &backData) 
     1086                                                                          BspTraversalData &data) 
    10771087{ 
    10781088        float lowestCost = MAX_FLOAT; 
     
    10911101                // evaluate current candidate 
    10921102                const float candidateCost =  
    1093                         SplitPlaneCost(poly->GetSupportingPlane(), data, frontData, backData); 
     1103                        SplitPlaneCost(poly->GetSupportingPlane(), data); 
    10941104 
    10951105                if (candidateCost < lowestCost) 
     
    11461156                } 
    11471157                 
    1148                 const float candidateCost =  
    1149                         SplitPlaneCost(plane, data, frontData, backData); 
     1158                const float candidateCost = SplitPlaneCost(plane, data); 
    11501159 
    11511160                if (candidateCost < lowestCost) 
     
    13151324                                                          const int pvs, 
    13161325                                                          const float area, 
    1317                                                           const BspNodeGeometry &cell,  
    1318                                                           BspTraversalData &frontData, 
    1319                                                           BspTraversalData &backData) const 
     1326                                                          const BspNodeGeometry &cell) const 
    13201327{ 
    13211328        float val = 0; 
     
    13281335        int frontAndBackId = 0; 
    13291336 
    1330         frontData.mPvs = 0; 
    1331         backData.mPvs = 0; 
    1332         frontData.mArea = 0; 
    1333         backData.mArea = 0; 
     1337        int frontPvs = 0; 
     1338        int backPvs = 0; 
    13341339 
    13351340        // probability that view point lies in child 
     
    13481353                {        
    13491354                        // construct child geometry with regard to the candidate split plane 
    1350                         frontData.mCell = new BspNodeGeometry(); 
    1351                         backData.mCell = new BspNodeGeometry(); 
    1352  
    1353                         cell.SplitGeometry(*frontData.mCell, *backData.mCell, *this, candidatePlane); 
    1354                  
    1355                         pFront = frontData.mArea = frontData.mCell->GetArea(); 
    1356                         pBack = backData.mArea = backData.mCell->GetArea(); 
     1355                        BspNodeGeometry frontCell; 
     1356                        BspNodeGeometry backCell; 
     1357 
     1358                        cell.SplitGeometry(frontCell, backCell, *this, candidatePlane); 
     1359                 
     1360                        pFront = frontCell.GetArea(); 
     1361                        pBack = backCell.GetArea(); 
    13571362 
    13581363                        pOverall = area; 
     
    13921397                                // assure that we only count a object  
    13931398                                // once for the front and once for the back side of the plane 
    1394                                 IncPvs(*ray->intersections[0].mObject, frontData.mPvs, backData.mPvs,  
     1399                                IncPvs(*ray->intersections[0].mObject, frontPvs, backPvs,  
    13951400                                           cf, frontId, backId, frontAndBackId); 
    13961401                        } 
     
    13991404                        if (ray->sourceObject.mObject) 
    14001405                        { 
    1401                                 IncPvs(*ray->sourceObject.mObject, frontData.mPvs, backData.mPvs,  
     1406                                IncPvs(*ray->sourceObject.mObject, frontPvs, backPvs,  
    14021407                                           cf, frontId, backId, frontAndBackId); 
    14031408                        } 
     
    14191424        if ((sSplitPlaneStrategy & BALANCED_RAYS) && !rays.empty()) 
    14201425                        val += sBalancedRaysFactor * fabs(sumBalancedRays) / (float)rays.size(); 
    1421 pOverall = 1; pFront = 1; pBack = 1; 
     1426 
    14221427        if ((sSplitPlaneStrategy & PVS) && area && pvs) 
    1423                 val += sPvsFactor * (frontData.mPvs * pFront + (backData.mPvs * pBack)) / 
     1428                val += sPvsFactor * (frontPvs * pFront + (backPvs * pBack)) / 
    14241429                           (pOverall * (float)pvs * 2); 
    14251430 
    1426         Debug << "totalpvs: " << pvs << " ptotal: " << pOverall 
    1427                   << " frontpvs: " << frontData.mPvs << " pFront: " << pFront  
    1428                   << " backpvs: " << backData.mPvs << " pBack: " << pBack  
     1431/*      Debug << "totalpvs: " << pvs << " ptotal: " << pOverall 
     1432                  << " frontpvs: " << frontPvs << " pFront: " << pFront  
     1433                  << " backpvs: " << backPvs << " pBack: " << pBack  
    14291434                  << " val " << val << endl; 
    1430  
     1435*/ 
    14311436        return val; 
    14321437} 
     
    14851490 
    14861491float BspTree::SplitPlaneCost(const Plane3 &candidatePlane, 
    1487                                                           BspTraversalData &data, 
    1488                                                           BspTraversalData &frontData, 
    1489                                                           BspTraversalData &backData) const 
     1492                                                          BspTraversalData &data) const 
    14901493{ 
    14911494        float val = 0; 
     
    15161519        { 
    15171520                val += SplitPlaneCost(candidatePlane, *data.mRays, data.mPvs,  
    1518                                                           data.mArea, *data.mCell, frontData, backData); 
     1521                                                          data.mArea, *data.mGeometry); 
    15191522        } 
    15201523 
     
    24032406        } 
    24042407 
    2405         Debug << "returning new geometry " << mPolys.size() << " f: " << front.mPolys.size() << " b: " << back.mPolys.size() << endl; 
    2406         Debug << "old area " << GetArea() << " f: " << front.GetArea() << " b: " << back.GetArea() << endl; 
     2408        //Debug << "returning new geometry " << mPolys.size() << " f: " << front.mPolys.size() << " b: " << back.mPolys.size() << endl; 
     2409        //Debug << "old area " << GetArea() << " f: " << front.GetArea() << " b: " << back.GetArea() << endl; 
    24072410} 
    24082411 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h

    r399 r400  
    345345                /// area of current node 
    346346                float mArea; 
    347                 BspNodeGeometry *mCell; 
     347                BspNodeGeometry *mGeometry; 
    348348 
    349349                /// pvs size 
     
    358358                mPvs(0), 
    359359                mArea(0.0), 
    360                 mCell(NULL) 
     360                mGeometry(NULL) 
    361361                {} 
    362362                 
     
    376376                mPvs(pvs), 
    377377                mArea(area), 
    378                 mCell(cell) 
     378                mGeometry(cell) 
    379379                {} 
    380380    }; 
     
    541541        */ 
    542542        Plane3 SelectPlane(BspLeaf *leaf,  
    543                                            BspTraversalData &data, 
    544                                            BspTraversalData &frontData, 
    545                                            BspTraversalData &backData); 
     543                                           BspTraversalData &data); 
    546544 
    547545        /** Evaluates the contribution of the candidate split plane. 
     
    554552        */ 
    555553        float SplitPlaneCost(const Plane3 &candidatePlane, 
    556                                                  BspTraversalData &data, 
    557                                                  BspTraversalData &frontData, 
    558                                                  BspTraversalData &backData) const; 
     554                                                 BspTraversalData &data) const; 
    559555 
    560556        /** Strategies where the effect of the split plane is tested 
     
    574570                                                 const int pvs, 
    575571                                                 const float area, 
    576                                                  const BspNodeGeometry &cell,  
    577                                                  BspTraversalData &frontData, 
    578                                                  BspTraversalData &backData) const; 
     572                                                 const BspNodeGeometry &cell) const; 
    579573 
    580574        /** Filters next view cell down the tree and inserts it into the appropriate leaves 
     
    624618        */ 
    625619        Plane3 SelectPlaneHeuristics(BspLeaf *leaf, 
    626                                                                  BspTraversalData &data, 
    627                                                                  BspTraversalData &frontData, 
    628                                                                  BspTraversalData &backData); 
     620                                                                 BspTraversalData &data); 
    629621 
    630622        /** Extracts the meshes of the objects and adds them to polygons.  
Note: See TracChangeset for help on using the changeset viewer.