Changeset 1917 for GTP/trunk/Lib/Vis/Preprocessing/src
- Timestamp:
- 12/21/06 00:42:55 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1916 r1917 638 638 // high avg ray contri, the result is influenced by undersampling 639 639 splitCandidate.SetAvgRayContribution(avgRayContri); 640 641 const float oldVolume = EvalViewCellsVolume(leaf->mObjects) / GetViewSpaceVolume(); 642 const float oldRatio = tData.mVolume > 0 ? oldVolume / tData.mVolume : 1; 640 const float viewSpaceVol = GetViewSpaceVolume(); 641 642 const float oldVolume = EvalViewCellsVolume(leaf->mObjects) / viewSpaceVol; 643 const float oldRatio = (tData.mVolume) > 0 ? oldVolume / tData.mVolume : 1; 643 644 const float parentVol = tData.mCorrectedVolume * oldRatio; 644 645 645 646 // this leaf is a pvs entry in all the view cells 646 647 // that see one of the objects. 647 const float frontVol = EvalViewCellsVolume(splitCandidate.mFrontObjects) / GetViewSpaceVolume();648 const float backVol = EvalViewCellsVolume(splitCandidate.mBackObjects) / GetViewSpaceVolume();648 const float frontVol = EvalViewCellsVolume(splitCandidate.mFrontObjects) / viewSpaceVol; 649 const float backVol = EvalViewCellsVolume(splitCandidate.mBackObjects) / viewSpaceVol; 649 650 650 651 splitCandidate.mCorrectedFrontVolume = … … 670 671 splitCandidate.SetPvsEntriesIncr(pvsEntriesIncr); 671 672 673 if (0) 672 674 cout << "bvh volume cost" 673 675 << " avg ray contri: " << avgRayContri << " ratio: " << oldRatio 674 << " parent: " << parentVol << " " << "old vol: " << oldVolume676 << " parent: " << parentVol << " old vol: " << oldVolume 675 677 << " frontvol: " << frontVol << " corr. " << splitCandidate.mCorrectedFrontVolume 676 678 << " backvol: " << backVol << " corr. " << splitCandidate.mCorrectedBackVolume << endl; … … 707 709 mHierarchyManager->EvalCorrectedPvs((float)backViewCells, parentPvs, avgRayContri); 708 710 711 if (0) 709 712 cout << "bvh pvs" 710 713 << " avg ray contri: " << avgRayContri << " ratio: " << oldPvsRatio -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r1916 r1917 747 747 } 748 748 // assume pvs not sampled sufficiently => take total pvs 749 if (avgRayContri > mMaxAvgRayContri)749 if (avgRayContri >= mMaxAvgRayContri) 750 750 { 751 751 return totalPvs; -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r1900 r1917 1212 1212 } 1213 1213 1214 void 1215 Preprocessor::EvalViewCellHistogram() 1216 { 1217 char filename[256]; 1218 Environment::GetSingleton()->GetStringValue("Preprocessor.histogram.file", 1219 filename); 1214 void Preprocessor::EvalViewCellHistogram() 1215 { 1216 char filename[256]; 1217 Environment::GetSingleton()->GetStringValue("Preprocessor.histogram.file", filename); 1220 1218 1221 1222 1219 // mViewCellsManager->EvalViewCellHistogram(filename, 1000000); 1220 mViewCellsManager->EvalViewCellHistogramForPvsSize(filename, 1000000); 1223 1221 } 1224 1222 -
GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj
r1912 r1917 206 206 Name="VCLinkerTool" 207 207 AdditionalDependencies="xerces-c_2.lib glew32.lib zdll.lib zziplib.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib Preprocessor.lib RTScene.lib RTWorld.lib QtCore4.lib qtmain.lib QtOpenGL4.lib Qt3Support4.lib QtTest4.lib QtGui4.lib QtGlRenderer.lib" 208 OutputFile="../bin/release/Preprocessor 2.exe"208 OutputFile="../bin/release/Preprocessor.exe" 209 209 LinkIncremental="1" 210 210 AdditionalLibraryDirectories="..\src\GL;..\lib\release;..\..\Preprocessing\lib\release;..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib;..\MultiLevelRayTracing\RTScene\Release;..\MultiLevelRayTracing\RTWorld\Release;"$(QTDIR)\lib";.\QtGlRenderer\Release" -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1916 r1917 706 706 int smallerCostSum = 0; 707 707 708 // note can skip computations for view cells already evaluated and delete them from vector ... 708 // note can skip computations for view cells already 709 // evaluated and delete them from vector ... 709 710 while (1) 710 711 { … … 746 747 747 748 748 749 749 ViewCellsManager *ViewCellsManager::LoadViewCells(const string &filename, 750 750 ObjectContainer *objects, … … 904 904 viewCells = mViewCells; 905 905 #endif 906 ViewCellContainer::iterator it = viewCells.begin(), 907 it_end = viewCells.end(); 908 for (; it != it_end; ++it) { 909 //(*it)->UpdatePvsCost(); 910 (*it)->SetPvsCost((float)(*it)->GetFilteredPvsSize()); 906 ViewCellContainer::iterator it = viewCells.begin(), it_end = viewCells.end(); 907 for (; it != it_end; ++it) 908 { 909 if (1) 910 (*it)->UpdatePvsCost(); 911 else 912 (*it)->SetPvsCost((float)(*it)->GetFilteredPvsSize()); 911 913 } 912 914 … … 921 923 // hack: normalize pvs size 922 924 int histoMaxVal; 923 Environment::GetSingleton()->GetIntValue( 924 "Preprocessor.histogram.maxValue", histoMaxVal); 925 Environment::GetSingleton()->GetIntValue("Preprocessor.histogram.maxValue", histoMaxVal); 925 926 maxVal = max((float)histoMaxVal, maxPvs); 926 927 … … 938 939 if (!stepSize) stepSize = 1; 939 940 941 Debug << "intervals " << histoIntervals << endl; 940 942 Debug << "stepsize: " << stepSize << endl; 941 943 cout << "intervals " << histoIntervals << endl; 944 cout << "stepsize: " << stepSize << endl; 945 942 946 const float totalRenderCost = mViewCellsTree->GetRoot()->GetRenderCost(); 943 947 const float totalVol = GetViewSpaceBox().GetVolume(); … … 987 991 988 992 outstream.close(); 989 990 993 } 991 994 … … 6044 6047 6045 6048 // mix of sampling strategies 6046 mStrategies.push_back(SamplingStrategy::OBJECT_DIRECTION_BASED_DISTRIBUTION);6049 evalStrats.push_back(SamplingStrategy::OBJECT_DIRECTION_BASED_DISTRIBUTION); 6047 6050 6048 6051 //evalStrats.push_back(SamplingStrategy::OBJECT_BASED_DISTRIBUTION); … … 6168 6171 disposeRays(evaluationSamples, NULL); 6169 6172 } 6170 6171 } 6173 6174 //////////// 6175 //-- histogram 6176 6177 const int numLeaves = mViewCellsTree->GetNumInitialViewCells(mViewCellsTree->GetRoot()); 6178 bool useHisto; 6179 int histoStepSize; 6180 6181 Environment::GetSingleton()->GetBoolValue("ViewCells.Evaluation.histogram", useHisto); 6182 Environment::GetSingleton()->GetIntValue("ViewCells.Evaluation.histoStepSize", histoStepSize); 6183 6184 if (useHisto) 6185 { 6186 // evaluate view cells in a histogram 6187 char s[64]; 6188 6189 // hack: just show final view cells 6190 int pass = (int)mViewCells.size(); 6191 //for (int pass = histoStepSize; pass <= numLeaves; pass += histoStepSize) 6192 if (1) 6193 { 6194 string filename; 6195 6196 cout << "computing histogram for " << pass << " view cells" << endl; 6197 #if 0 6198 //-- evaluate histogram for render cost 6199 sprintf(s, "-%09d-histo.log", pass); 6200 filename = string(statsPrefix) + string(s); 6201 6202 EvalViewCellHistogram(filename, pass); 6203 6172 6204 #endif 6173 6174 6175 6176 } 6205 ////////////////////////////////////////// 6206 //-- evaluate histogram for pvs size 6207 6208 cout << "computing pvs histogram for " << pass << " view cells" << endl; 6209 6210 sprintf(s, "-%09d-histo-pvs.log", pass); 6211 filename = string(statsPrefix) + string(s); 6212 6213 EvalViewCellHistogramForPvsSize(filename, pass); 6214 } 6215 } 6216 } 6217 6218 #endif 6219 6220 6221 6222 } -
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp
r1916 r1917 908 908 splitCandidate.GetAvgRayContribution()); 909 909 910 910 if (0) 911 911 cout << "vsp pvs" 912 912 << " avg ray contri: " << splitCandidate.GetAvgRayContribution() << " ratio: " << oldPvsRatio … … 1621 1621 const float renderCostDecrease = (oldRenderCost - newRenderCost) / viewSpaceVol; 1622 1622 1623 if (0) 1623 1624 cout << "vsp render cost" 1624 1625 << " avg ray contri: " << avgRayContri << " ratio: " << oldRenderCostRatio
Note: See TracChangeset
for help on using the changeset viewer.