Changeset 752 for GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
- Timestamp:
- 04/20/06 13:25:41 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
r744 r752 472 472 473 473 mSubdivisionStats 474 << "#ViewCells\n1 \n" << endl475 << "#RenderCostDecrease\n0 \n" << endl474 << "#ViewCells\n1" << endl 475 << "#RenderCostDecrease\n0" << endl 476 476 << "#TotalRenderCost\n" << mTotalCost << endl 477 477 << "#AvgRenderCost\n" << mTotalPvsSize << endl; … … 578 578 << "#ViewCells\n1\n" << endl 579 579 << "#RenderCostDecrease\n0\n" << endl 580 << "# dummy\n0\n" << endl580 << "#SplitCandidateCost\n0\n" << endl 581 581 << "#TotalRenderCost\n" << mTotalCost << endl 582 582 << "#AvgRenderCost\n" << mTotalPvsSize << endl; … … 773 773 AddToPvs(leaf, *tData.mRays, sampCon, conSamp); 774 774 775 // update single pvs parameter 776 viewCell->mPvsSize = viewCell->GetPvs().GetSize(); 777 viewCell->mPvsSizeValid = true; 778 779 775 780 mBspStats.contributingSamples += conSamp; 776 781 mBspStats.sampleContributions +=(int) sampCon; … … 869 874 << "#ViewCells\n" << mBspStats.Leaves() << endl 870 875 << "#RenderCostDecrease\n" << -costDecr << endl 871 << "# dummy\n" << splitCandidate.GetCost() << endl876 << "#SplitCandidateCost\n" << splitCandidate.GetCost() << endl 872 877 << "#TotalRenderCost\n" << mTotalCost << endl 873 878 << "#AvgRenderCost\n" << (float)mTotalPvsSize / (float)mBspStats.Leaves() << endl; … … 902 907 float sampCon = 0.0f; 903 908 AddToPvs(leaf, *tData.mRays, sampCon, conSamp); 909 910 viewCell->mPvsSize = viewCell->GetPvs().GetSize(); 911 viewCell->mPvsSizeValid = true; 904 912 905 913 mBspStats.contributingSamples += conSamp; … … 1763 1771 if ((pFront < 0.0) || (pBack < 0.0)) 1764 1772 { 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; 1775 1777 } 1776 1778 } … … 1795 1797 1796 1798 //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 1798 1811 } 1799 1812 … … 1871 1884 !geomFront.Valid() || !geomBack.Valid())) 1872 1885 { 1873 Debug << "error f: " << pFront << " b: " << pBack << endl; 1886 //Debug << "error f: " << pFront << " b: " << pBack << endl; 1887 // high penalty for this split 1874 1888 return 99999.9f; 1875 1889 } … … 1887 1901 1888 1902 // 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); 1892 1906 1893 1907 const float oldRenderCost = pOverall * penaltyOld; … … 2762 2776 BspNodeGeometry nodeGeom; 2763 2777 ConstructGeometry(n, nodeGeom); 2764 2778 const float eps = 0.01f; 2779 2765 2780 // split planes from the root to this node 2766 2781 // needed to verify that we found neighbor leaf … … 2799 2814 Polygon3::ClassifyPlane(geom->GetPolys(), 2800 2815 halfSpaces[i], 2801 mEpsilon);2816 eps); 2802 2817 2803 2818 if (cf == Polygon3::FRONT_SIDE) … … 2818 2833 Polygon3::ClassifyPlane(geom->GetPolys(), 2819 2834 poly->GetSupportingPlane(), 2820 mEpsilon);2835 eps); 2821 2836 2822 2837 if (cf == Polygon3::FRONT_SIDE) … … 2839 2854 const int cf = Polygon3::ClassifyPlane(nodeGeom.GetPolys(), 2840 2855 interior->GetPlane(), 2841 mEpsilon);2856 eps); 2842 2857 2843 2858 BspNode *front = interior->GetFront(); … … 2852 2867 mBox, 2853 2868 //0.0000001f); 2854 mEpsilon);2869 eps); 2855 2870 2856 2871 if (cf == Polygon3::BACK_SIDE) … … 2891 2906 ConstructGeometry(n, nodeGeom); 2892 2907 2908 float eps = 0.01f; 2893 2909 // split planes from the root to this node 2894 2910 // needed to verify that we found neighbor leaf … … 2932 2948 const int cf = Polygon3::ClassifyPlane(nodeGeom.GetPolys(), 2933 2949 interior->GetPlane(), 2934 mEpsilon);2950 eps); 2935 2951 2936 2952 BspNode *front = interior->GetFront(); … … 2945 2961 mBox, 2946 2962 //0.0000001f); 2947 mEpsilon);2963 eps); 2948 2964 2949 2965 if (cf == Polygon3::BACK_SIDE) … … 3164 3180 3165 3181 float t; 3166 const float thresh = 1e-6f; // matt: change this 3182 const float thresh = 1e-6f; // matt: change this to adjustable value 3167 3183 3168 3184 while (1)
Note: See TracChangeset
for help on using the changeset viewer.