Changeset 605


Ignore:
Timestamp:
02/08/06 15:05:04 (18 years ago)
Author:
mattausch
Message:
 
Location:
trunk/VUT/GtpVisibilityPreprocessor
Files:
10 edited

Legend:

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

    r601 r605  
    1313#;../data/vienna/vienna-plane.x3d 
    1414#       filename ../data/vienna/viewcells-25-sel.x3d 
    15 #       filename ../data/atlanta/atlanta2.x3d 
     15        filename ../data/atlanta/atlanta2.x3d 
    1616#       filename ../data/soda/soda.dat 
    17         filename ../data/soda/soda5.dat 
     17#       filename ../data/soda/soda5.dat 
    1818} 
    1919 
     
    2525        type vss 
    2626#       type rss 
    27         detectEmptyViewSpace true 
     27        detectEmptyViewSpace false 
    2828} 
    2929 
     
    3636        loadInitialSamples  false 
    3737        storeInitialSamples false 
    38         useViewSpaceBox true 
     38        useViewSpaceBox false 
    3939#       testBeamSampling true 
    4040} 
     
    176176        # samples used for view cell construction 
    177177        Construction { 
    178                 samples 1400000 
     178                samples 2500000 
    179179                samplesPerPass 500000 
    180180        } 
     
    213213                useRaysForMerge false 
    214214                refine false 
    215                 compress true 
    216                 merge true 
     215                compress false 
     216                merge false 
    217217        } 
    218218 
     
    288288VspBspTree { 
    289289        Construction { 
    290                 samples 800000 
     290                samples 500000 
    291291                epsilon 0.005 
    292292                randomize false 
     
    304304         
    305305        # maximal candidates for split planes 
    306         maxPolyCandidates 250 
     306        maxPolyCandidates 0 
    307307 
    308308         
     
    322322        Termination { 
    323323                # parameters used for autopartition 
    324                 minRays                 20 
     324                minRays                 -1 
    325325                minPolygons             -1 
    326326                maxDepth                40 
    327327                minPvs                  -1 
    328                 minProbability          0.00000001 
    329                 maxRayContribution      0.15 
    330                 maxCostRatio            0.8 
    331                 missTolerance           3 
    332                  
    333                 maxViewCells            100000 
     328                minProbability          0.0000001 
     329                maxRayContribution      100000000.2 
     330                maxCostRatio            9.85 
     331                missTolerance           2 
     332                 
     333                maxViewCells            2048 
    334334                 
    335335                # used for pvs criterium 
     
    337337                 
    338338                AxisAligned { 
    339                         minRays                 50000 
     339                        minRays                 1 
    340340                        maxRayContribution      9.9 
    341341                } 
    342342        } 
    343343         
    344         splitUseOnlyDrivingAxis false 
     344        splitUseOnlyDrivingAxis true 
    345345         
    346346        Visualization { 
  • trunk/VUT/GtpVisibilityPreprocessor/src/RenderSimulator.cpp

    r580 r605  
    100100                const float pInVc = mViewCellsManager->GetProbability(vc); 
    101101 
     102                //Debug << "vc prob: " << pInVc << endl; 
     103 
    102104                // compute render time of PVS times probability 
    103105                // that view point is in view cell 
     
    105107                        mViewCellsManager->GetRendercost(vc, mObjRenderCost); 
    106108         
     109                renderTime += vcCost; 
     110 
    107111                // crossing the border of a view cell is depending on the move  
    108112                // speed and the probability that a view cell border is crossed 
    109113                loadPvsOverhead += GetCrossVcProbability() * mVcOverhead; 
    110                 renderTime += vcCost; 
    111  
     114                 
    112115                //-- update statistics 
    113116 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.cpp

    r604 r605  
    160160 
    161161 
    162 void ViewCell::UpdateViewCellsStats(ViewCellsStatistics &vcStat) 
    163 { 
    164         ++ vcStat.viewCells; 
    165                  
    166         const int pvsSize = mPvs.GetSize(); 
    167  
    168         vcStat.pvs += pvsSize; 
    169  
    170         if (pvsSize == 0) 
    171                 ++ vcStat.emptyPvs; 
    172  
    173         if (pvsSize > vcStat.maxPvs) 
    174                 vcStat.maxPvs = pvsSize; 
    175  
    176         if (pvsSize < vcStat.minPvs) 
    177                 vcStat.minPvs = pvsSize; 
    178  
    179         if (!mValid) 
    180                 ++ vcStat.invalid; 
    181 } 
    182  
    183  
    184162float ViewCell::GetArea() const 
    185163{ 
     
    477455        mViewCellsManager->GetPvsStatistics(pvsStats); 
    478456 
    479         static float expectedValue = pvsStats.avgPvs; 
     457        //static float expectedValue = pvsStats.avgPvs; 
    480458         
    481459        // the current view cells are kept in this container 
     
    521499 
    522500        mStats << "#Pass\n" << pass << endl 
    523                 << "#Merged\n" << mergeStats.merged << endl  
    524                 << "#Viewcells\n" << realNumActiveViewCells << endl  
    525                 << "#RenderCostIncrease\n" << 0 << endl 
    526                 << "#TotalRenderCost\n" << totalRenderCost << endl 
    527                 << "#CurrentPvs\n" << 0 << endl 
    528                 << "#ExpectedCost\n" << realExpectedCost << endl 
    529                 << "#AvgRenderCost\n" << realAvgRenderCost << endl 
    530                 << "#Deviation\n" << mDeviation << endl 
    531                 << "#TotalPvs\n" << totalPvs << endl 
    532                 << "#PvsSizeDecrease\n" << 0 << endl 
    533                 << "#Volume\n" << 0 << endl 
    534                 << "#Dummy\n" << 0 << endl; 
     501                   << "#Merged\n" << mergeStats.merged << endl  
     502                   << "#Viewcells\n" << realNumActiveViewCells << endl  
     503                   << "#RenderCostIncrease\n" << 0 << endl 
     504                   << "#TotalRenderCost\n" << totalRenderCost << endl 
     505                   << "#CurrentPvs\n" << 0 << endl 
     506                   << "#ExpectedCost\n" << realExpectedCost << endl 
     507                   << "#AvgRenderCost\n" << realAvgRenderCost << endl 
     508                   << "#Deviation\n" << mDeviation << endl 
     509                   << "#TotalPvs\n" << totalPvs << endl 
     510                   << "#PvsSizeDecrease\n" << 0 << endl 
     511                   << "#Volume\n" << endl; 
    535512 
    536513        //-- use priority queue to merge leaf pairs 
     
    584561                } 
    585562 
    586 #ifdef _DEBUG 
    587                 Debug << "abs mergecost: " << mMergeQueue.top().GetMergeCost() <<  
    588                           << " rel mergecost: " << mMergeQueue.top().GetRenderCost() / mExpectedCost <<  
    589                           << " max ratio: " << mMergeMaxCostRatio << endl 
    590                           << " expected value: " << realExpectedCost << endl; 
    591 #endif 
    592563 
    593564         
     
    637608                                ++ mergeStats.siblings; 
    638609#endif 
    639                 //      if (((mergeStats.merged % statsOut) == 0) ||  
    640                 //              (realNumActiveViewCells == mMergeMinViewCells)) 
    641                 //      { 
     610                        if (((mergeStats.merged % statsOut) == 0) ||  
     611                        (realNumActiveViewCells == mMergeMinViewCells)) 
     612                        { 
    642613                                cout << "merged " << mergeStats.merged << " view cells" << endl; 
    643614 
     
    646617                                        << "#Merged\n" << mergeStats.merged << endl  
    647618                                        << "#Viewcells\n" << realNumActiveViewCells << endl  
    648                                         << "#RenderCostIncrease\n" << renderCostIncr << endl 
     619                    << "#RenderCostIncrease\n" << renderCostIncr << endl 
    649620                                        << "#TotalRenderCost\n" << totalRenderCost << endl 
    650621                                        << "#CurrentPvs\n" << mergedVc->GetPvs().GetSize() << endl 
    651                                         << "#ExpectedCost\n" << realExpectedCost / (float) realNumActiveViewCells << endl 
     622                    << "#ExpectedCost\n" << realExpectedCost << endl 
    652623                                        << "#AvgRenderCost\n" << realAvgRenderCost << endl 
    653624                                        << "#Deviation\n" << mDeviation << endl 
    654625                                        << "#TotalPvs\n" << totalPvs << endl 
    655626                                        << "#PvsSizeDecrease\n" << -pvsDiff << endl 
    656                                         <<  "#Volume\n" << mergedVc->GetVolume() << endl 
    657                                         << "#Dummy\n" << (float)mergedVc->GetPvs().GetSize() * mergedVc->GetVolume() / mViewCellsManager->GetViewSpaceBox().GetVolume() << endl; 
    658                 //      } 
     627                                        << "#Volume\n" << mergedVc->GetVolume() << endl; 
     628                        } 
    659629                } 
    660630                else 
     
    14891459        tstack.push(vc); 
    14901460 
    1491         Debug << "current size: " << pvsSize << endl; 
    1492  
    14931461        while (!tstack.empty()) 
    14941462        { 
     
    15631531        return vc; 
    15641532} 
     1533 
     1534 
     1535 
     1536void  ViewCellsTree::UpdateViewCellsStats(ViewCell *vc, ViewCellsStatistics &vcStat) 
     1537{ 
     1538        ++ vcStat.viewCells; 
     1539                 
     1540        const int pvsSize = GetPvsSize(vc); 
     1541 
     1542        vcStat.pvs += pvsSize; 
     1543 
     1544        if (pvsSize == 0) 
     1545                ++ vcStat.emptyPvs; 
     1546 
     1547        if (pvsSize > vcStat.maxPvs) 
     1548                vcStat.maxPvs = pvsSize; 
     1549 
     1550        if (pvsSize < vcStat.minPvs) 
     1551                vcStat.minPvs = pvsSize; 
     1552 
     1553        if (!vc->GetValid()) 
     1554                ++ vcStat.invalid; 
     1555} 
     1556 
    15651557 
    15661558 
     
    16431635 
    16441636 
     1637 
    16451638/************************************************************************/ 
    16461639/*                    MergeStatistics implementation                    */ 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.h

    r604 r605  
    129129        void SetArea(float area); 
    130130 
    131         /** Updates the view cell statstics for this particular view cell. 
    132         */ 
    133         virtual void UpdateViewCellsStats(ViewCellsStatistics &vcStat); 
    134131 
    135132        /** if this view cell is the root of a view cell hierarchy 
     
    238235                ViewCell(mesh), mLeaf(NULL) {} 
    239236 
    240         void UpdateViewCellsStats(ViewCellsStatistics &vcStat) 
    241         { 
    242                 ViewCell::UpdateViewCellsStats(vcStat); 
    243 // TODO 
    244                 //if ((int)mLeaves.size() > vcStat.maxLeaves) 
    245                 //      vcStat.maxLeaves = (int)mLeaves.size(); 
    246                 //vcStat.leaves += (int)mLeaves.size(); 
    247         } 
     237         
    248238 
    249239        bool IsLeaf() const 
     
    289279        int RefineViewCells(const VssRayContainer &rays, const ObjectContainer &objects); 
    290280 
     281        /** Updates view cell stats for this particular view cell 
     282        */ 
     283        void UpdateViewCellsStats(ViewCell *vc, ViewCellsStatistics &vcStat); 
    291284         
    292285 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp

    r600 r605  
    16281628                { 
    16291629                        pFront = frontCell.GetVolume(); 
    1630                         pBack = backCell.GetVolume(); 
     1630                        pBack = pOverall - pFront; 
    16311631                } 
    16321632                 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp

    r601 r605  
    1616#include "RssPreprocessor.h" 
    1717 
     18#define SAMPLE_AFTER_SUBDIVISION 1 
    1819 
    1920 
     
    189190 
    190191                // TODO: leak? 
    191                 if(0)ComputeSampleContributions(constructionSamples, true, false); 
     192                if (SAMPLE_AFTER_SUBDIVISION) 
     193                        ComputeSampleContributions(constructionSamples, true, false); 
    192194                cout << "finished" << endl; 
    193195 
     
    211213        // store viewCells for postprocessing 
    212214        const bool storeViewCells = true; 
    213         if(0)ComputeSampleContributions(postProcessSamples, true, storeViewCells); 
     215 
     216        if (SAMPLE_AFTER_SUBDIVISION) 
     217                ComputeSampleContributions(postProcessSamples, true, storeViewCells); 
    214218        // merge the view cells 
    215219        PostProcess(preprocessor->mObjects, postProcessSamples); 
     
    224228                                        visualizationSamples); 
    225229 
    226         if(0)ComputeSampleContributions(visualizationSamples, true, storeViewCells); 
     230        if (SAMPLE_AFTER_SUBDIVISION) 
     231                ComputeSampleContributions(visualizationSamples, true, storeViewCells); 
    227232 
    228233        //Debug << "visualizationsamples: " << mVisualizationSamples << " " << visualizationSamples.size() << endl; 
     
    377382        for (it = mViewCells.begin(); it != it_end; ++ it) 
    378383        { 
    379                 (*it)->UpdateViewCellsStats(mViewCellsStats); 
     384                mViewCellsTree->UpdateViewCellsStats(*it, mViewCellsStats); 
    380385        } 
    381386} 
     
    858863 
    859864 
     865float ViewCellsManager::GetRendercost(ViewCell *viewCell, float objRendercost) const 
     866{ 
     867        return mViewCellsTree->GetPvsSize(viewCell) * objRendercost; 
     868} 
     869 
     870 
    860871float ViewCellsManager::GetAccVcArea() 
    861872{ 
     
    10821093 
    10831094 
    1084 float BspViewCellsManager::GetRendercost(ViewCell *viewCell,  
    1085                                                                                  float objRendercost) const 
    1086 { 
    1087         return viewCell->GetPvs().GetSize() * objRendercost; 
    1088 } 
    1089  
    10901095 
    10911096int BspViewCellsManager::CastLineSegment(const Vector3 &origin, 
     
    11571162    // reset view cells and stats 
    11581163        ResetViewCells(); 
     1164        Debug << "\nView cells after merge:\n" << mViewCellsStats << endl; 
    11591165 
    11601166        int savedColorCode  = mColorCode; 
    1161  
     1167         
    11621168        //BspLeaf::NewMail(); 
    11631169        if (1) // export merged view cells 
    11641170        { 
    11651171                mColorCode = 0; 
    1166                 cout << "reseting view cells ... "; 
    1167                 ResetViewCells(); 
    1168                 cout << "finished" << endl; 
    1169  
     1172                 
    11701173                Exporter *exporter = Exporter::GetExporter("merged_view_cells.x3d"); 
    1171                 Debug << "\nView cells after merge:\n" << mViewCellsStats << endl; 
     1174                 
    11721175 
    11731176                cout << "exporting view cells after merge ... "; 
     
    13871390                ExportViewCellGeometry(exporter, vc); 
    13881391                 
    1389  
    1390                 Debug << i << ": pvs size=" << (int)mViewCellsTree->GetPvsSize(vc) 
    1391                           << ", piercing rays=" << (int)vcRays.size() << endl; 
    1392                          // << ", leaves=" << (int)vc->mLeaves.size() << endl; 
    1393  
    1394  
    13951392                // export rays piercing this view cell 
    13961393                exporter->ExportRays(vcRays, RgbColor(0, 1, 0)); 
     
    16771674} 
    16781675 
     1676 
    16791677float KdViewCellsManager::GetProbability(ViewCell *viewCell) 
    16801678{ 
    16811679        // compute view cell area / volume as subsititute for probability 
    1682 #if 0 
    1683         return GetArea(viewCell) / GetViewSpaceBox().SurfaceArea(); 
    1684 #endif 
    1685 #if 1 
    1686         return GetArea(viewCell) / GetAccVcArea(); 
    1687 #endif 
    1688 #if 0 
    1689         return GetVolume(viewCell) / GetViewSpaceBox().GetVolume(); 
    1690 #endif 
    1691 } 
    1692  
    1693  
    1694 float KdViewCellsManager::GetRendercost(ViewCell *viewCell, float objRendercost) const 
    1695 { 
    1696         return viewCell->GetPvs().GetSize() * objRendercost; 
    1697 } 
     1680        if (0) 
     1681                return GetArea(viewCell) / GetViewSpaceBox().SurfaceArea(); 
     1682        else 
     1683                return GetVolume(viewCell) / GetViewSpaceBox().GetVolume(); 
     1684} 
     1685 
     1686 
    16981687 
    16991688 
     
    18101799                        AxisAlignedBox3 box = mKdTree->GetBox(leaf); 
    18111800                        exporter->ExportBox(box); 
    1812  
    1813                         Debug << i << ": pvs size=" << (int)vc->GetPvs().GetSize() 
    1814                                 << ", piercing rays=" << (int)vcRays.size() << endl; 
    18151801 
    18161802                        // export rays piercing this view cell 
     
    19951981float VspKdViewCellsManager::GetProbability(ViewCell *viewCell) 
    19961982{ 
    1997         // volume or area substitutes for view point probability 
    1998 #if 0 
    1999         return GetArea(viewCell) / GetViewSpaceBox().SurfaceArea(); 
    2000 #else 
    2001         return GetArea(viewCell) / GetAccVcArea(); 
    2002 #endif 
    2003 } 
    2004  
    2005  
    2006 float VspKdViewCellsManager::GetRendercost(ViewCell *viewCell, float objRendercost) const 
    2007 { 
    2008         return viewCell->GetPvs().GetSize() * objRendercost; 
    2009 } 
     1983        // compute view cell area / volume as subsititute for probability 
     1984        if (0) 
     1985                return GetArea(viewCell) / GetViewSpaceBox().SurfaceArea(); 
     1986        else 
     1987                return GetVolume(viewCell) / GetViewSpaceBox().GetVolume(); 
     1988} 
     1989 
     1990 
    20101991 
    20111992 
     
    21442125                VspKdViewCell *vc = dynamic_cast<VspKdViewCell *>(mViewCells[idx]); 
    21452126 
    2146                 cout << "Output view cell " << i << " with pvs size " << vc->GetPvs().GetSize() << endl; 
    2147                 Debug << "Output view cell " << i << " with pvs size " << vc->GetPvs().GetSize() << endl; 
    21482127                //-- export geometry 
    21492128                Material m; 
     
    23932372 
    23942373 
    2395 float VspBspViewCellsManager::GetRendercost(ViewCell *viewCell, 
    2396                                                                                         float objRendercost) const 
    2397 { 
    2398         return viewCell->GetPvs().GetSize() * objRendercost; 
    2399 } 
    2400  
    24012374 
    24022375bool VspBspViewCellsManager::ViewCellsConstructed() const 
     
    25152488 
    25162489        cout << "Computing remaining ray contributions ... "; 
     2490 
    25172491        // recast rest of rays 
    2518         if (0) 
    2519         ComputeSampleContributions(savedRays, true, false); 
     2492        if (SAMPLE_AFTER_SUBDIVISION) 
     2493                ComputeSampleContributions(savedRays, true, false); 
    25202494        cout << "finished" << endl; 
    25212495 
     
    26972671 
    26982672        VssRayContainer postProcessRays; 
    2699         if(0)GetRaySets(rays, mPostProcessSamples, postProcessRays); 
     2673 
     2674        GetRaySets(rays, mPostProcessSamples, postProcessRays); 
    27002675 
    27012676        Debug << "post processing using " << (int)postProcessRays.size() << " samples" << endl; 
     
    27182693                RefineViewCells(postProcessRays, objects); 
    27192694 
    2720          
    2721         if (1) 
    2722         {                
    2723                 float totalCost, erc, var, dev, avg; 
    2724                 int totalpvs; 
    2725  
    2726                 mViewCellsStats.Reset(); 
    2727  
    2728         EvaluateRenderStatistics(totalCost, erc, dev, var, totalpvs, avg); 
    2729                  
    2730                 Debug << "statistics after merge "   
    2731                           << " erc: " << erc  
    2732                           << " dev: " << dev 
    2733                           << " totalpvs: " << totalpvs  
    2734                           << " avg: " << avg << endl; 
    2735         } 
    2736  
    27372695        //-- render simulation after merge 
    2738   cout << "\nevaluating bsp view cells render time before compress ... "; 
    2739   dynamic_cast<RenderSimulator *>(mRenderer)->RenderScene(); 
    2740   SimulationStatistics ss; 
    2741   dynamic_cast<RenderSimulator *>(mRenderer)->GetStatistics(ss); 
     2696        cout << "\nevaluating bsp view cells render time before compress ... "; 
     2697        dynamic_cast<RenderSimulator *>(mRenderer)->RenderScene(); 
     2698        SimulationStatistics ss; 
     2699        dynamic_cast<RenderSimulator *>(mRenderer)->GetStatistics(ss); 
    27422700   
    2743   cout << " finished" << endl; 
    2744   cout << ss << endl; 
    2745   Debug << ss << endl; 
     2701 
     2702        cout << " finished" << endl; 
     2703        cout << ss << endl; 
     2704        Debug << ss << endl; 
    27462705 
    27472706 
     
    27582717                pvsEntries = mViewCellsTree->GetNumPvsEntries(mViewCellsTree->GetRoot()); 
    27592718                Debug << "number of entries after compress: " << pvsEntries << endl; 
    2760         } 
    2761  
    2762  
    2763         //-- export refined (shuffled) view cells 
    2764         if (0) 
    2765         { 
    2766                 cout << "exporting shuffled view cells ... "; 
    2767  
    2768                 Exporter *exporter = Exporter::GetExporter("shuffled_view_cells.x3d"); 
    2769                 if (exporter) 
    2770                 { 
    2771                         if (1) 
    2772                         { 
    2773                                 exporter->SetWireframe(); 
    2774                                 exporter->ExportBox(mViewSpaceBox); 
    2775                                 exporter->SetFilled(); 
    2776                         } 
    2777  
    2778                         if (mExportGeometry) 
    2779                         { 
    2780                                 exporter->ExportGeometry(objects); 
    2781                         } 
    2782  
    2783                         ViewCellContainer::const_iterator vit, vit_end = mViewCells.end(); 
    2784  
    2785                         Material vm, lm; 
    2786  
    2787                         for (vit = mViewCells.begin(); vit != mViewCells.end(); ++ vit) 
    2788                         { 
    2789                                 ViewCell *vc = *vit; 
    2790  
    2791                                 vm = RandomMaterial(); 
    2792  
    2793                                 lm = vm; 
    2794  
    2795                                 vm.mDiffuseColor.r -= 0.45f; 
    2796                                 vm.mDiffuseColor.g -= 0.45f; 
    2797                                 vm.mDiffuseColor.b -= 0.45f; 
    2798  
    2799  
    2800                                 ViewCellContainer leaves; 
    2801                                 mViewCellsTree->CollectLeaves(vc, leaves); 
    2802  
    2803                                 ViewCellContainer::const_iterator lit, lit_end = leaves.end(); 
    2804  
    2805                                 for (lit = leaves.begin(); lit != lit_end; ++ lit) 
    2806                                 { 
    2807                                         BspLeaf *leaf = dynamic_cast<BspViewCell *>(*lit)->mLeaf; 
    2808  
    2809                                         if (leaf->Mailed()) 
    2810                                                 exporter->SetForcedMaterial(lm); 
    2811                                         else 
    2812                                                 exporter->SetForcedMaterial(vm); 
    2813  
    2814                                         BspNodeGeometry geom; 
    2815                                         mVspBspTree->ConstructGeometry(leaf, geom); 
    2816                                         exporter->ExportPolygons(geom.mPolys); 
    2817                                 } 
    2818                         } 
    2819  
    2820                         delete exporter; 
    2821                 } 
    2822  
    2823  
    2824                 cout << "finished" << endl; 
    28252719        } 
    28262720 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h

    r600 r605  
    213213        /** Returns render cost of a single view cell given the render cost of an object. 
    214214        */ 
    215         virtual float GetRendercost(ViewCell *viewCell, float objRendercost) const = 0; 
     215        virtual float GetRendercost(ViewCell *viewCell, float objRendercost) const ; 
    216216 
    217217        /** Returns container of loaded / generated view cells. 
     
    521521         
    522522        float GetProbability(ViewCell *viewCell); 
    523         float GetRendercost(ViewCell *viewCell, float objRendercost) const; 
     523         
    524524 
    525525        /** Get a viewcell containing the specified point */ 
     
    603603 
    604604        float GetProbability(ViewCell *viewCell); 
    605         float GetRendercost(ViewCell *viewCell, float objRendercost) const; 
     605 
    606606 
    607607        void CreateMesh(ViewCell *vc); 
     
    669669 
    670670        float GetProbability(ViewCell *viewCell); 
    671         float GetRendercost(ViewCell *viewCell, float objRendercost) const; 
     671         
    672672 
    673673        void CreateMesh(ViewCell *vc); 
     
    728728 
    729729        float GetProbability(ViewCell *viewCell); 
    730         float GetRendercost(ViewCell *viewCell, float objRendercost) const; 
     730         
    731731         
    732732        ViewCell *GetViewCell(const Vector3 &point) const; 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp

    r604 r605  
    6767mOutOfBoundsCell(NULL), 
    6868mStoreRays(false), 
    69 mRenderCostWeight(0.5) 
     69mRenderCostWeight(0.5), 
     70mUseRandomAxis(false) 
    7071{ 
    7172        bool randomize = false; 
     
    429430        tQueue.push(tData); 
    430431 
    431         mTotalCost = tData.GetCost() / mBox.GetVolume(); 
     432        mTotalCost = tData.mPvs * tData.mProbability / mBox.GetVolume(); 
    432433 
    433434        mSubdivisionStats  
    434                         << "#Leaves\n1\n" <<  endl 
     435                        << "#ViewCells\n1\n" <<  endl 
    435436                        << "#RenderCostDecrease\n0\n" << endl  
    436437                        << "#TotalRenderCost\n" << mTotalCost << endl; 
     
    528529                        if (1) 
    529530                        { 
     531                                float cFront = tFrontData.mPvs * tFrontData.mProbability; 
     532                                float cBack = tBackData.mPvs * tBackData.mProbability; 
     533                                float cData = tData.mPvs * tData.mProbability;; 
     534 
    530535                                float costDecr =  
    531                                         (tFrontData.GetCost() + tBackData.GetCost() - tData.GetCost()) / mBox.GetVolume(); 
     536                                        (cFront + cBack - cData) / mBox.GetVolume(); 
    532537                                mTotalCost += costDecr; 
    533538 
    534539                                mSubdivisionStats  
    535                                                 << "#Leaves\n" << mBspStats.Leaves() << endl 
     540                                                << "#ViewCells\n" << mBspStats.Leaves() << endl 
    536541                                                << "#RenderCostDecrease\n" << -costDecr << endl  
    537542                                                << "#TotalRenderCost\n" << mTotalCost << endl; 
     
    957962        } 
    958963 
    959         const int sAxis = box.Size().DrivingAxis(); 
     964        const int sAxis = mUseRandomAxis ? Random(3) : box.Size().DrivingAxis(); 
    960965 
    961966        for (axis = 0; axis < 3; ++ axis) 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.h

    r600 r605  
    710710        ofstream mSubdivsionStats; 
    711711 
     712        bool mUseRandomAxis; 
    712713private: 
    713714 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp

    r600 r605  
    791791  //-- render simulation after merge 
    792792  cout << "\nevaluating bsp view cells render time after sampling ... "; 
     793  Debug << "\nStatistics after sampling: " << endl; 
     794 
    793795  mRenderSimulator->RenderScene(); 
    794796  SimulationStatistics ss; 
Note: See TracChangeset for help on using the changeset viewer.