Changeset 2738
- Timestamp:
- 06/04/08 18:40:13 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/run_gvs_vps.sh
r2737 r2738 14 14 SCENE=../data/Arena/arena_trees.obj 15 15 #VIEWCELLS=../data/Arena/arena-high-lods-5000-viewcells.xml.gz 16 #SCENE=../data/vienna/ vienna_cropped.obj16 #SCENE=../data/vienna/2vienna_cropped.obj 17 17 #SCENE=../data/roofs_new.obj 18 #SCENE=../data/vienna/city_full_hp.obj19 SCENE=../data/vienna/vienna_rep.obj18 SCENE=../data/vienna/city_full_hp.obj 19 #SCENE=../data/vienna/vienna_rep.obj 20 20 21 21 #SCENE=../data/vienna/vienna_cropped.obj … … 25 25 26 26 #LOG_PREFIX=../src/SG08/rebut-arena-pixel2 27 LOG_PREFIX=../src/SG08/test 27 LOG_PREFIX=../src/SG08/test_jitter_0.1 28 28 29 29 ENVIRONMENT=gvs.env … … 43 43 -gvs_initial_samples=16 \ 44 44 -gvs_max_viewcells=3 \ 45 -gvs_min_contribution= 50 \45 -gvs_min_contribution=200 \ 46 46 -gvs_per_viewcell=true \ 47 -gvs_radius_of_influence=5.0 \ 48 -gvs_use_deterministic_gvs- \ 49 -gvs_initial_jitter=0.1 \ 47 50 -preprocessor_detect_empty_viewspace+ \ 48 51 -preprocessor_snap_error_frames+ \ -
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r2731 r2738 1399 1399 "5"); 1400 1400 1401 RegisterOption("GvsPreprocessor.initialJitter", 1402 optFloat, 1403 "gvs_initial_jitter=", 1404 "0.1"); 1405 1406 RegisterOption("GvsPreprocessor.radiusOfInfluence", 1407 optFloat, 1408 "gvs_radius_of_influence=", 1409 "5.0"); 1410 1411 RegisterOption("GvsPreprocessor.useDeterministicGvs", 1412 optBool, 1413 "gvs_use_deterministic_gvs", 1414 "false"); 1415 1416 1401 1417 1402 1418 /**********************************************************************/ -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r2736 r2738 1963 1963 mColors.push_back(RandomColor(0, 1)); 1964 1964 } 1965 1965 1966 color = mColors[kdint->mGenericIdx]; 1966 1967 } -
GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp
r2736 r2738 25 25 #define NOT_ACCOUNTED_OBJECT 0 26 26 #define ACCOUNTED_OBJECT 2 27 #define DETERMINISTIC_GVS 0 27 28 28 29 29 static const float MIN_DIST = 0.001f; … … 31 31 static ObjectContainer myobjects; 32 32 static int sInvalidSamples = 0; 33 34 33 35 34 36 /////////// … … 87 89 Environment::GetSingleton()->GetBoolValue("ViewCells.useKdPvs", mUseKdPvs); 88 90 91 Environment::GetSingleton()->GetFloatValue("GvsPreprocessor.initialJitter", mInitialJitter); 92 Environment::GetSingleton()->GetBoolValue("GvsPreprocessor.useDeterministicGvs", mUseDeterministicGvs); 93 94 Environment::GetSingleton()->GetFloatValue("GvsPreprocessor.radiusOfInfluence", mRadiusOfInfluence); 89 95 90 96 char gvsStatsLog[100]; … … 162 168 const VssRay &oldRay) 163 169 { 164 // the predicted hitpoint : we expect to hit the same mesh again170 // the predicted hitpoint is the point where the ray would have intersected the hit triangle 165 171 Vector3 predictedHit = CalcPredictedHitPoint(currentRay, hitTriangle, oldRay); 166 172 … … 168 174 float len = Magnitude(currentRay.mTermination - currentRay.mOrigin); 169 175 170 // distance large => this is likely to be a discontinuity 171 if (!((predictedLen - len) > mThreshold)) 176 // discrepancy between predicted and actual hit point large => this is likely to be a discontinuity 177 178 // matt: problem: this does only find CLOSER discontinuities, but not discontinuities which are FARTHER away 179 if ((predictedLen - len) < mThreshold) 180 //if ((fabs(predictedLen - len) < mThreshold) 172 181 // q: rather use relative distance? 173 //if ((predictedLen / len) >mThreshold)182 //if ((predictedLen / len) < mThreshold) 174 183 return 0; 175 184 … … 183 192 reverseRays.clear(); 184 193 185 if ( DETERMINISTIC_GVS)194 if (mUseDeterministicGvs) 186 195 { 187 196 VssRay *reverseRay = … … 395 404 int castRays = 0; 396 405 397 // cast reverse rays if necessary398 castRays += CheckDiscontinuity(ray1, hitTriangle, oldRay);399 castRays += CheckDiscontinuity(ray2, hitTriangle, oldRay);400 401 406 if (EqualVisibility(ray1, ray2) || (SqrMagnitude(p1 - p2) <= MIN_DIST)) 402 {403 407 return castRays; 404 }405 408 409 406 410 // the new subdivision point 407 411 const Vector3 p = (p1 + p2) * 0.5f; … … 433 437 434 438 //newRay->mFlags |= VssRay::BorderSample; 439 440 // cast reverse rays if necessary 441 castRays += CheckDiscontinuity(ray2, hitTriangle, oldRay); 435 442 436 443 // subdivide further … … 495 502 const int numRandomRays = 16 - (int)simpleRays.size(); 496 503 497 if (! DETERMINISTIC_GVS)504 if (!mUseDeterministicGvs) 498 505 { 499 506 if (0) … … 514 521 generationTimer.Exit(); 515 522 523 516 524 ///////////////////// 517 525 //-- cast rays to vertices and determine visibility … … 547 555 (*rit)->mFlags |= VssRay::BorderSample; 548 556 } 557 558 for (size_t i = 0; i < vssRays.size(); ++ i) 559 { 560 // check for discontinuity and cast reverse rays if necessary 561 castRays += CheckDiscontinuity(*vssRays[i], hitTriangle, currentRay); 562 } 563 549 564 550 565 // recursivly subdivide each edge … … 578 593 hitTriangle = static_cast<TriangleIntersectable *>(tObj)->GetItem(); 579 594 else 580 cout << " border sampling: " << Intersectable::GetTypeName(tObj) << " not yet implemented" << endl;595 cout << "error: gvs sampling for " << Intersectable::GetTypeName(tObj) << " not implemented" << endl; 581 596 582 597 generationTimer.Entry(); … … 623 638 const int numRandomRays = 16 - ((int)simpleRays.size() % 16); 624 639 625 SimpleRay mainRay = SimpleRay(currentRay.GetOrigin(), 626 currentRay.GetNormalizedDir(), 627 SamplingStrategy::GVS, 1.0f); 628 629 GenerateJitteredRays(simpleRays, mainRay, numRandomRays, 0, 0.01f); 630 //GenerateRays(numRandomRays, *mDistribution, simpleRays, sInvalidSamples); 640 if (!mUseDeterministicGvs) 641 { 642 if (0) 643 { 644 SimpleRay mainRay = SimpleRay(currentRay.GetOrigin(), 645 currentRay.GetNormalizedDir(), 646 SamplingStrategy::GVS, 647 1.0f); 648 649 GenerateJitteredRays(simpleRays, mainRay, numRandomRays, 0, 0.01f); 650 } 651 else 652 GenerateImportanceSamples(currentRay, hitTriangle, numRandomRays, simpleRays); 653 } 654 else 655 GenerateRays(numRandomRays, *mDistribution, simpleRays, sInvalidSamples); 631 656 632 657 generationTimer.Exit(); 658 633 659 634 660 … … 660 686 EnqueueRays(vssRays); 661 687 688 for (size_t i = 0; i < vssRays.size(); ++ i) 689 { 690 // check for discontinuity and cast reverse rays if necessary 691 castRays += CheckDiscontinuity(*vssRays[i], hitTriangle, currentRay); 692 } 693 662 694 #if 0 663 695 … … 726 758 SimpleRay &reverseRay) 727 759 { 728 // get triangle occluding the path to the hitmesh760 // optain triangle that occludes the path to the currently processed mesh 729 761 Triangle3 occluder; 730 762 Intersectable *tObj = currentRay.mTerminationObject; … … 749 781 const Vector3 predicted = CalcPredictedHitPoint(currentRay, hitTriangle, oldRay); 750 782 751 Vector3 newDir, newOrigin;752 753 783 ////////////// 754 784 //-- Construct the mutated ray with xnew, 755 785 //-- dir = predicted(x)- pnew as direction vector 756 786 757 newDir = predicted - newPoint;787 Vector3 newDir = newDir = predicted - newPoint; 758 788 759 789 // take xnew, p = intersect(viewcell, line(pnew, predicted(x)) as origin ? 760 790 // difficult to say!! 761 791 const float offset = 0.5f; 762 newOrigin = newPoint - newDir * offset;792 Vector3 newOrigin = newPoint - newDir * offset; 763 793 764 794 … … 777 807 // check if ray intersects view cell 778 808 if (!mCurrentViewCell->CastRay(ray)) 779 return NULL;809 return false; 780 810 781 811 Ray::Intersection &hit = ray.intersections[0]; … … 808 838 else 809 839 { 810 GenerateRays( DETERMINISTIC_GVS? numSamples : numSamples / 16, *mDistribution, simpleRays, sInvalidSamples);840 GenerateRays(mUseDeterministicGvs ? numSamples : numSamples / 16, *mDistribution, simpleRays, sInvalidSamples); 811 841 } 812 842 … … 819 849 castTimer.Entry(); 820 850 821 if ( DETERMINISTIC_GVS)851 if (mUseDeterministicGvs) 822 852 { 823 853 const bool castDoubleRays = !mPerViewCell; … … 829 859 else 830 860 { 831 float scale = 0.1f;832 861 if (0) 833 862 // casting bundles of 4 rays generated from the simple rays 834 863 CastRayBundles4(simpleRays, vssRays); 835 864 else 836 CastRayBundles16(simpleRays, vssRays, scale);865 CastRayBundles16(simpleRays, vssRays, mInitialJitter); 837 866 } 838 867 … … 879 908 mRayQueue.pop(); 880 909 881 if ( 1)910 if (0) 882 911 castSamples += AdaptiveBorderSampling(*ray); 883 912 else … … 1515 1544 mGvsStats.mPassContribution = mGvsStats.mTotalContribution - oldContribution; 1516 1545 1517 if ( mGvsStats.mPassContribution < 2000)1546 if (!mUseDeterministicGvs && (mGvsStats.mPassContribution < 2000)) 1518 1547 mUseProbablyVisibleSampling = true; 1519 1548 … … 1935 1964 1936 1965 Vector2 vr2(rr[0], rr[1]); 1937 const float sigma = triangle.GetBoundingBox().Radius() * 5.0f;1966 const float sigma = triangle.GetBoundingBox().Radius() * mRadiusOfInfluence; 1938 1967 Vector2 gaussvec2; 1939 1968 -
GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.h
r2736 r2738 4 4 #include <fstream> 5 5 #include <stack> 6 7 6 #include "Preprocessor.h" 7 #include "FlexibleHeap.h" 8 9 8 10 9 11 namespace GtpVisibilityPreprocessor { … … 93 95 94 96 97 struct ProbablyVisibleTriangleContainer 98 { 99 KdNode *node; 100 ObjectContainer mTriangles; 101 }; 102 103 104 typedef FlexibleHeap<ProbablyVisibleTriangleContainer *> ProbablyVisibleTriangleQueue; 105 106 107 95 108 /** Sampling based visibility preprocessing. The implementation is 96 109 based on heuristical sampling of view space. … … 336 349 337 350 bool mUseProbablyVisibleSampling; 351 352 float mInitialJitter; 353 354 bool mUseDeterministicGvs; 355 356 float mRadiusOfInfluence; 338 357 }; 339 358 340 }; 359 360 } 341 361 342 362 #endif -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2737 r2738 382 382 //-- output computed pvs 383 383 384 //mUseFalseColors = false;385 mUseFalseColors = true;384 mUseFalseColors = false; 385 //mUseFalseColors = true; 386 386 glPushAttrib(GL_CURRENT_BIT); 387 387 glColor3f(0, 1, 0);
Note: See TracChangeset
for help on using the changeset viewer.