Changeset 2736 for GTP/trunk/Lib
- Timestamp:
- 06/04/08 11:13:41 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/run_gvs_vps.sh
r2735 r2736 43 43 -gvs_initial_samples=16 \ 44 44 -gvs_max_viewcells=3 \ 45 -gvs_min_contribution= 100 \45 -gvs_min_contribution=200 \ 46 46 -gvs_per_viewcell=true \ 47 47 -preprocessor_detect_empty_viewspace+ \ -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r2731 r2736 840 840 GlRenderer::RenderKdNode(KdNode *node) 841 841 { 842 if (node->IsLeaf()) 843 { 844 #if !EVAL_ERROR 842 if (node->IsLeaf()) 843 { 845 844 RenderKdLeaf(static_cast<KdLeaf *>(node)); 846 #else 847 KdLeaf *leaf = static_cast<KdLeaf *>(node); 848 for (int i=0; i < leaf->mObjects.size(); i++) 849 { 850 RenderIntersectable(leaf->mObjects[i]); 851 852 } 853 #endif 845 854 846 } 855 847 else … … 1946 1938 1947 1939 1948 1949 } 1940 void GlRenderer::_RenderColoredPvs(const ObjectPvs &pvs) 1941 { 1942 // note: could be done more efficiently using color buffers 1943 ObjectPvsIterator it = pvs.GetIterator(); 1944 1945 PvsData pvsData; 1946 1947 while (it.HasMoreEntries()) 1948 { 1949 Intersectable *obj = it.Next(pvsData); 1950 1951 RgbColor color; 1952 1953 //cerr << "sumpdf: " << pvsData.mSumPdf << endl; 1954 if (1)//mUseRandomColorPerPvsObject) 1955 { 1956 if (obj->Type() == Intersectable::KD_INTERSECTABLE) 1957 { 1958 KdIntersectable *kdint = static_cast<KdIntersectable *>(obj); 1959 1960 if (kdint->mGenericIdx == -1) 1961 { 1962 kdint->mGenericIdx = (int)mColors.size(); 1963 mColors.push_back(RandomColor(0, 1)); 1964 } 1965 color = mColors[kdint->mGenericIdx]; 1966 } 1967 } 1968 else 1969 { 1970 color = RainbowColorMapping(log10(pvsData.mSumPdf + 1)); 1971 } 1972 1973 glColor3f(color.r, color.g, color.b); 1974 1975 mUseForcedColors = true; 1976 RenderIntersectable(obj); 1977 mUseForcedColors = false; 1978 } 1979 } 1980 1981 1982 1983 } -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h
r2730 r2736 8 8 #include "Renderer.h" 9 9 #include "Beam.h" 10 #include <vector> 11 #include "Material.h" 10 12 11 13 … … 221 223 bool GetUseVbos() const { return mUseVbos; } 222 224 225 /** Render pvs using false colors. 226 */ 227 void _RenderColoredPvs(const ObjectPvs &pvs); 223 228 224 229 public: … … 296 301 297 302 int mRenderedNodes; 303 304 std::vector<RgbColor> mColors; 298 305 }; 299 306 -
GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp
r2735 r2736 192 192 else 193 193 { 194 float scale = 0.01f; 195 194 196 if (0) 195 197 CastRayBundle4(simpleRay, reverseRays, mViewCellsManager->GetViewSpaceBox()); 196 198 else 197 CastRayBundle16(simpleRay, reverseRays );199 CastRayBundle16(simpleRay, reverseRays, scale); 198 200 } 199 201 … … 502 504 1.0f); 503 505 504 GenerateJitteredRays(simpleRays, mainRay, numRandomRays, 0 );506 GenerateJitteredRays(simpleRays, mainRay, numRandomRays, 0, 0.01f); 505 507 } 506 508 else … … 625 627 SamplingStrategy::GVS, 1.0f); 626 628 627 GenerateJitteredRays(simpleRays, mainRay, numRandomRays, 0 );629 GenerateJitteredRays(simpleRays, mainRay, numRandomRays, 0, 0.01f); 628 630 //GenerateRays(numRandomRays, *mDistribution, simpleRays, sInvalidSamples); 629 631 … … 799 801 generationTimer.Entry(); 800 802 801 if (mUseProbablyVisibleSampling && (RandomValue(0, 1) > 0.5))803 if (mUseProbablyVisibleSampling)// && (RandomValue(0, 1) > 0.5)) 802 804 { 803 805 ProbablyVisibleDistribution distr(*this, mCurrentViewCell, &mProbablyVisibleTriangles); … … 827 829 else 828 830 { 831 float scale = 0.1f; 829 832 if (0) 830 833 // casting bundles of 4 rays generated from the simple rays 831 834 CastRayBundles4(simpleRays, vssRays); 832 835 else 833 CastRayBundles16(simpleRays, vssRays );836 CastRayBundles16(simpleRays, vssRays, scale); 834 837 } 835 838 … … 1820 1823 1821 1824 1822 void GvsPreprocessor::CastRayBundle16(const SimpleRay &ray, VssRayContainer &vssRays )1825 void GvsPreprocessor::CastRayBundle16(const SimpleRay &ray, VssRayContainer &vssRays, float scale) 1823 1826 { 1824 1827 static SimpleRayContainer simpleRays; … … 1826 1829 1827 1830 simpleRays.push_back(ray); 1828 GenerateJitteredRays(simpleRays, ray, 15, 0 );1831 GenerateJitteredRays(simpleRays, ray, 15, 0, scale); 1829 1832 1830 1833 CastRays(simpleRays, vssRays, false, false); … … 1832 1835 1833 1836 1834 void GvsPreprocessor::CastRayBundles16(const SimpleRayContainer &rays, VssRayContainer &vssRays )1837 void GvsPreprocessor::CastRayBundles16(const SimpleRayContainer &rays, VssRayContainer &vssRays, float scale) 1835 1838 { 1836 1839 SimpleRayContainer::const_iterator it, it_end = rays.end(); 1837 1840 1838 1841 for (it = rays.begin(); it != it_end; ++ it) 1839 CastRayBundle16(*it, vssRays );1842 CastRayBundle16(*it, vssRays, scale); 1840 1843 } 1841 1844 -
GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.h
r2735 r2736 258 258 void CastRayBundles4(const SimpleRayContainer &rays, VssRayContainer &vssRays); 259 259 260 void CastRayBundles16(const SimpleRayContainer &rays, VssRayContainer &vssRays );260 void CastRayBundles16(const SimpleRayContainer &rays, VssRayContainer &vssRays, float scale); 261 261 262 262 /** Generates a ray bundle of 4 jittered rays and casts them using optimized 4 eye ray casting. … … 270 270 void Cast4Rays(float *dist, Vector3 *dirs, Vector3 *origs, VssRayContainer &vssRays, const AxisAlignedBox3 &box); 271 271 272 void CastRayBundle16(const SimpleRay &ray, VssRayContainer &vssRays );272 void CastRayBundle16(const SimpleRay &ray, VssRayContainer &vssRays, float scale); 273 273 274 274 virtual void ComputeRenderError(); -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2729 r2736 1328 1328 const SimpleRay &mainRay, 1329 1329 int number, 1330 int pertubType) const 1331 { 1332 //rayBundle.push_back(mainRay); 1333 //const float pertubOrigin = 0.0f; 1334 const float pertubDir = 0.01f; 1330 int pertubType, 1331 float scale) const 1332 { 1335 1333 Vector3 pertub; 1336 1334 1337 1335 for (int i = 0; i < number; ++ i) 1338 1336 { 1339 pertub.x = RandomValue(- pertubDir, pertubDir);1340 pertub.y = RandomValue(- pertubDir, pertubDir);1341 pertub.z = RandomValue(- pertubDir, pertubDir);1337 pertub.x = RandomValue(-scale, scale); 1338 pertub.y = RandomValue(-scale, scale); 1339 pertub.z = RandomValue(-scale, scale); 1342 1340 1343 1341 Vector3 newDir = mainRay.mDirection + pertub; -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h
r2726 r2736 144 144 const SimpleRay &mainRay, 145 145 int number, 146 int shuffleType) const; 146 int shuffleType, 147 float scale) const; 147 148 148 149 virtual void CastRays(SimpleRayContainer &rays, -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2730 r2736 377 377 im.save(qstr, "PNG"); 378 378 379 if ( 0)379 if (1) 380 380 { 381 381 /////////// … … 391 391 392 392 KdNode::NewMail2(); 393 //Intersectable::NewMail();394 393 395 394 ++ mCurrentFrame; 396 395 397 396 // render pvs once 398 RenderPvs(pvs); 397 //RenderPvs(pvs); 398 _RenderColoredPvs(pvs); 399 399 // hack for gvs visualization 400 400 //RenderTrianglePvs(); … … 405 405 406 406 im = toImage(); 407 sprintf_s(filename, "error-frame-%0 4d-%04d-%08d-pvs.png", mFrame, viewcell->GetId(), pixelCount);407 sprintf_s(filename, "error-frame-%05d-%05d-%08d-pvs.png", viewcell->GetId(), mFrame, pixelCount); 408 408 str = mSnapPrefix + filename; 409 409 qstr = str.c_str(); … … 713 713 _RenderPvs(); 714 714 else 715 _RenderColoredPvs( );715 _RenderColoredPvs(mPvsCache.mPvs); 716 716 } 717 717 … … 2634 2634 2635 2635 2636 void QtGlRendererWidget::_RenderColoredPvs()2637 {2638 // note: could be done more efficiently using color buffers2639 mPvsSize = mPvsCache.mPvs.GetSize();2640 2641 ObjectPvsIterator it = mPvsCache.mPvs.GetIterator();2642 2643 PvsData pvsData;2644 2645 while (it.HasMoreEntries())2646 {2647 Intersectable *obj = it.Next(pvsData);2648 2649 RgbColor color;2650 2651 //cerr << "sumpdf: " << pvsData.mSumPdf << endl;2652 if (mUseRandomColorPerPvsObject)2653 {2654 if (obj->Type() == Intersectable::KD_INTERSECTABLE)2655 {2656 KdIntersectable *kdint = static_cast<KdIntersectable *>(obj);2657 2658 if (kdint->mGenericIdx == -1)2659 {2660 kdint->mGenericIdx = (int)mColors.size();2661 mColors.push_back(RandomColor(0, 1));2662 }2663 color = mColors[kdint->mGenericIdx];2664 }2665 }2666 else2667 {2668 color = RainbowColorMapping(mTransferFunction * log10(pvsData.mSumPdf + 1));2669 }2670 2671 glColor3f(color.r, color.g, color.b);2672 2673 mUseForcedColors = true;2674 RenderIntersectable(obj);2675 mUseForcedColors = false;2676 }2677 }2678 2679 2636 2680 2637 void QtGlRendererWidget::UpdateDynamicObjects() -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h
r2730 r2736 239 239 int mCurrentPvsCost; 240 240 241 vector<RgbColor> mColors;242 243 241 bool mUseRandomColorPerPvsObject; 244 242 … … 590 588 */ 591 589 void _RenderPvs(); 592 /** Render pvs using false colors.593 */594 void _RenderColoredPvs();595 590 596 591 float ComputeRenderCost(ViewCell *vc);
Note: See TracChangeset
for help on using the changeset viewer.