Ignore:
Timestamp:
04/20/06 13:25:41 (18 years ago)
Author:
mattausch
Message:

after rendering workshop submissioin
x3dparser can use def - use constructs
implemented improved evaluation (samples are only stored in leaves, only propagate pvs size)

File:
1 edited

Legend:

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

    r744 r752  
    472472         
    473473        mSubdivisionStats  
    474                         << "#ViewCells\n1\n" <<  endl 
    475                         << "#RenderCostDecrease\n0\n" << endl  
     474                        << "#ViewCells\n1" <<  endl 
     475                        << "#RenderCostDecrease\n0" << endl  
    476476                        << "#TotalRenderCost\n" << mTotalCost << endl 
    477477                        << "#AvgRenderCost\n" << mTotalPvsSize << endl; 
     
    578578                        << "#ViewCells\n1\n" <<  endl 
    579579                        << "#RenderCostDecrease\n0\n" << endl  
    580                         << "#dummy\n0\n" << endl 
     580                        << "#SplitCandidateCost\n0\n" << endl 
    581581                        << "#TotalRenderCost\n" << mTotalCost << endl 
    582582                        << "#AvgRenderCost\n" << mTotalPvsSize << endl; 
     
    773773                AddToPvs(leaf, *tData.mRays, sampCon, conSamp); 
    774774 
     775                // update single pvs parameter 
     776                viewCell->mPvsSize = viewCell->GetPvs().GetSize();  
     777                viewCell->mPvsSizeValid = true; 
     778 
     779 
    775780                mBspStats.contributingSamples += conSamp; 
    776781                mBspStats.sampleContributions +=(int) sampCon; 
     
    869874                                        << "#ViewCells\n" << mBspStats.Leaves() << endl 
    870875                                        << "#RenderCostDecrease\n" << -costDecr << endl 
    871                                         << "#dummy\n" << splitCandidate.GetCost() << endl 
     876                                        << "#SplitCandidateCost\n" << splitCandidate.GetCost() << endl 
    872877                                        << "#TotalRenderCost\n" << mTotalCost << endl 
    873878                                        << "#AvgRenderCost\n" << (float)mTotalPvsSize / (float)mBspStats.Leaves() << endl; 
     
    902907                float sampCon = 0.0f; 
    903908                AddToPvs(leaf, *tData.mRays, sampCon, conSamp); 
     909 
     910                viewCell->mPvsSize = viewCell->GetPvs().GetSize(); 
     911                viewCell->mPvsSizeValid = true; 
    904912 
    905913                mBspStats.contributingSamples += conSamp; 
     
    17631771                if ((pFront < 0.0) || (pBack < 0.0)) 
    17641772                { 
    1765                         Debug << "vol f " << pFront << " b " << pBack << " p " << pOverall << endl; 
    1766                         Debug << "real vol f " << pFront << " b " << geomBack.GetVolume() << " p " << pOverall << endl; 
    1767                         Debug << "polys f " << geomFront.Size() << " b " << geomBack.Size() << " data " << data.mGeometry->Size() << endl; 
    1768                 } 
    1769  
    1770                 // clamp because of possible precision issues 
    1771                 if (0) 
    1772                 { 
    1773                         if (pFront < 0) pFront = 0; 
    1774                         if (pBack < 0) pBack = 0; 
     1773                        Debug << "ERROR in volume:\n" 
     1774                                  << "volume f :" << pFront << " b: " << pBack << " p: " << pOverall  
     1775                                  << ", real volume f: " << pFront << " b: " << geomBack.GetVolume() 
     1776                                  << ", #polygons f: " << geomFront.Size() << " b: " << geomBack.Size() << " p: " << data.mGeometry->Size() << endl; 
    17751777                } 
    17761778        } 
     
    17951797 
    17961798        //Debug << "decrease: " << oldRenderCost - newRenderCost << endl; 
    1797         return (oldRenderCost - newRenderCost) / mBox.GetVolume(); 
     1799        const float renderCostDecrease = (oldRenderCost - newRenderCost) / mBox.GetVolume(); 
     1800         
     1801 
     1802#if 1 
     1803        // take render cost of node into account 
     1804        const float normalizedOldRenderCost = oldRenderCost / mBox.GetVolume(); 
     1805        //Debug << "rendercostdecr: " << 0.99f * renderCostDecrease << " old render cost: " << 0.01f * normalizedOldRenderCost << endl; 
     1806        //return 0.5f * renderCostDecrease + 0.5f * normalizedOldRenderCost; 
     1807        return 0.99f * renderCostDecrease + 0.01f * normalizedOldRenderCost; 
     1808#else 
     1809        return renderCostDecrease; 
     1810#endif 
    17981811} 
    17991812 
     
    18711884                        !geomFront.Valid() || !geomBack.Valid())) 
    18721885                { 
    1873                         Debug << "error f: " << pFront << " b: " << pBack << endl; 
     1886                        //Debug << "error f: " << pFront << " b: " << pBack << endl; 
     1887                        // high penalty for this split 
    18741888                        return 99999.9f; 
    18751889                } 
     
    18871901 
    18881902        // only render cost heuristics or combined with standard deviation 
    1889         const float penaltyOld = EvalPvsPenalty(totalPvs, lowerPvsLimit, upperPvsLimit); 
    1890     const float penaltyFront = EvalPvsPenalty(pvsFront, lowerPvsLimit, upperPvsLimit); 
    1891         const float penaltyBack = EvalPvsPenalty(pvsBack, lowerPvsLimit, upperPvsLimit); 
     1903        const float penaltyOld = EvalPvsPenalty((int)totalPvs, lowerPvsLimit, upperPvsLimit); 
     1904    const float penaltyFront = EvalPvsPenalty((int)pvsFront, lowerPvsLimit, upperPvsLimit); 
     1905        const float penaltyBack = EvalPvsPenalty((int)pvsBack, lowerPvsLimit, upperPvsLimit); 
    18921906                         
    18931907        const float oldRenderCost = pOverall * penaltyOld; 
     
    27622776        BspNodeGeometry nodeGeom; 
    27632777        ConstructGeometry(n, nodeGeom); 
    2764          
     2778        const float eps = 0.01f; 
     2779 
    27652780        // split planes from the root to this node 
    27662781        // needed to verify that we found neighbor leaf 
     
    27992814                                                        Polygon3::ClassifyPlane(geom->GetPolys(), 
    28002815                                                                                                        halfSpaces[i], 
    2801                                                                                                         mEpsilon); 
     2816                                                                                                        eps); 
    28022817 
    28032818                                                if (cf == Polygon3::FRONT_SIDE) 
     
    28182833                                                        Polygon3::ClassifyPlane(geom->GetPolys(), 
    28192834                                                                                                        poly->GetSupportingPlane(), 
    2820                                                                                                         mEpsilon); 
     2835                                                                                                        eps); 
    28212836 
    28222837                                                if (cf == Polygon3::FRONT_SIDE) 
     
    28392854                        const int cf = Polygon3::ClassifyPlane(nodeGeom.GetPolys(), 
    28402855                                                                                                   interior->GetPlane(), 
    2841                                                                                                    mEpsilon); 
     2856                                                                                                   eps); 
    28422857                         
    28432858                        BspNode *front = interior->GetFront(); 
     
    28522867                                                                mBox, 
    28532868                                                                //0.0000001f); 
    2854                                                                 mEpsilon); 
     2869                                                                eps); 
    28552870                 
    28562871                        if (cf == Polygon3::BACK_SIDE) 
     
    28912906        ConstructGeometry(n, nodeGeom); 
    28922907         
     2908        float eps = 0.01f; 
    28932909        // split planes from the root to this node 
    28942910        // needed to verify that we found neighbor leaf 
     
    29322948                        const int cf = Polygon3::ClassifyPlane(nodeGeom.GetPolys(), 
    29332949                                                                                                   interior->GetPlane(), 
    2934                                                                                                    mEpsilon); 
     2950                                                                                                   eps); 
    29352951                         
    29362952                        BspNode *front = interior->GetFront(); 
     
    29452961                                                                mBox, 
    29462962                                                                //0.0000001f); 
    2947                                                                 mEpsilon); 
     2963                                                                eps); 
    29482964                 
    29492965                        if (cf == Polygon3::BACK_SIDE) 
     
    31643180 
    31653181        float t; 
    3166         const float thresh = 1e-6f; // matt: change this 
     3182        const float thresh = 1e-6f; // matt: change this to adjustable value 
    31673183         
    31683184        while (1) 
Note: See TracChangeset for help on using the changeset viewer.