Changeset 2730 for GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp
- Timestamp:
- 06/02/08 19:02:06 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp
r2729 r2730 14 14 #include "IntersectableWrapper.h" 15 15 #include "Timer/PerfTimer.h" 16 #include "Vector2.h" 17 #include "RndGauss.h" 18 16 19 17 20 … … 1326 1329 // export the preprocessed information to a file 1327 1330 if (0 && mExportVisibility) 1328 {1329 1331 ExportPreprocessedData(mVisibilityFileName); 1330 }1331 1332 1332 1333 // compute the pixel error of this visibility solution 1333 if (mEvaluatePixelError) 1334 { 1334 if (0 && mEvaluatePixelError) 1335 1335 ComputeRenderError(); 1336 }1337 1336 1338 1337 return true; … … 1424 1423 mGvsStats.mGvsSamples = 0; 1425 1424 1425 //renderer->mPvsStat.currentPass = 0; 1426 mPass = 0; 1427 1426 1428 int oldContribution = 0; 1427 1429 int passSamples = 0; … … 1507 1509 mGvsStats.mPassContribution = 0; 1508 1510 passSamples = 0; 1511 1512 // compute the pixel error of this visibility solution 1513 if (mEvaluatePixelError) 1514 ComputeRenderError(); 1509 1515 } 1510 1516 } … … 1627 1633 cout << "raw cast time : " << rawCastTime << endl; 1628 1634 1629 float randomRaysPerSec = mGvsStats.mRandomSamples / (1e6f* initialTime);1630 float gvsRaysPerSec = mGvsStats.mGvsSamples / (1e6f* gvsTime);1631 float rawRaysPerSec = mGvsStats.mPerViewCellSamples / (1e6f* rawCastTime);1635 double randomRaysPerSec = mGvsStats.mRandomSamples / (1e6 * initialTime); 1636 double gvsRaysPerSec = mGvsStats.mGvsSamples / (1e6 * gvsTime); 1637 double rawRaysPerSec = mGvsStats.mPerViewCellSamples / (1e6 * rawCastTime); 1632 1638 1633 1639 cout << "cast " << randomRaysPerSec << " M random rays/s: " << endl; … … 1804 1810 } 1805 1811 1806 } 1812 1813 void GvsPreprocessor::ComputeRenderError() 1814 { 1815 // compute rendering error 1816 if (renderer && renderer->mPvsStatFrames) 1817 { 1818 if (!mViewCellsManager->GetViewCellPointsList()->empty()) 1819 { 1820 ViewCellPointsList *vcPoints = mViewCellsManager->GetViewCellPointsList(); 1821 ViewCellPointsList::const_iterator vit = vcPoints->begin(), vit_end = vcPoints->end(); 1822 1823 SimpleRayContainer viewPoints; 1824 1825 for (; vit != vit_end; ++ vit) 1826 { 1827 ViewCellPoints *vp = *vit; 1828 1829 SimpleRayContainer::const_iterator rit = vp->second.begin(), rit_end = vp->second.end(); 1830 1831 for (; rit!=rit_end; ++rit) 1832 { 1833 ViewCell *vc = mViewCellsManager->GetViewCell((*rit).mOrigin); 1834 if (vc == mCurrentViewCell) 1835 viewPoints.push_back(*rit); 1836 } 1837 } 1838 1839 renderer->mPvsErrorBuffer.clear(); 1840 1841 if (viewPoints.size() != renderer->mPvsErrorBuffer.size()) 1842 { 1843 renderer->mPvsErrorBuffer.resize(viewPoints.size()); 1844 renderer->ClearErrorBuffer(); 1845 } 1846 1847 cout << "evaluating list of " << viewPoints.size() << " pts" << endl; 1848 renderer->EvalPvsStat(viewPoints); 1849 } 1850 else 1851 { 1852 cout << "evaluating random points" << endl; 1853 renderer->EvalPvsStat(); 1854 } 1855 1856 mStats << 1857 "#AvgPvsRenderError\n" <<renderer->mPvsStat.GetAvgError()<<endl<< 1858 "#AvgPixelError\n" <<renderer->GetAvgPixelError()<<endl<< 1859 "#MaxPixelError\n" <<renderer->GetMaxPixelError()<<endl<< 1860 "#MaxPvsRenderError\n" <<renderer->mPvsStat.GetMaxError()<<endl<< 1861 "#ErrorFreeFrames\n" <<renderer->mPvsStat.GetErrorFreeFrames()<<endl<< 1862 "#AvgRenderPvs\n" <<renderer->mPvsStat.GetAvgPvs()<<endl; 1863 } 1864 } 1865 1866 1867 SimpleRay GvsPreprocessor::GenerateJitteredSample(const SimpleRay &sray) 1868 { 1869 // mutate the origin 1870 Vector3 d = sray.mDirection; 1871 1872 // Compute right handed coordinate system from direction 1873 Vector3 U, V; 1874 d.RightHandedBase(U, V); 1875 1876 float rr[2]; 1877 1878 rr[0] = RandomValue(0, 1); 1879 rr[1] = RandomValue(0, 1); 1880 1881 Vector2 vr2(rr[0], rr[1]); 1882 Vector2 gaussvec2; 1883 1884 const float sigma = 0.2f; 1885 1886 GaussianOn2D(vr2, sigma, // input 1887 gaussvec2); // output 1888 1889 Vector3 shift = gaussvec2.xx * U + gaussvec2.yy * V; 1890 1891 d += shift; 1892 1893 d.Normalize(); 1894 1895 return SimpleRay(sray.mOrigin, d, SamplingStrategy::GVS, 1.0f); 1896 } 1897 1898 1899 }
Note: See TracChangeset
for help on using the changeset viewer.