Changeset 2742 for GTP/trunk/Lib/Vis/Preprocessing
- Timestamp:
- 06/06/08 17:40:59 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/run_demo_vienna
r2725 r2742 8 8 9 9 10 #SCENE=../data/vienna/vienna_cropped.obj10 SCENE=../data/vienna/vienna_cropped.obj 11 11 #SCENE=../data/vienna/city_full.obj 12 SCENE=../data/vienna/city_full_hp.obj12 #SCENE=../data/vienna/city_full_hp.obj 13 13 #SCENE=../data/vienna/vienna_rep.obj 14 14 … … 40 40 -preprocessor_detect_empty_viewspace+ \ 41 41 -preprocessor_use_vbos- \ 42 -preprocessor_ray_cast_method= 3\42 -preprocessor_ray_cast_method=1 \ 43 43 -view_cells_random_viewpoint_list=$VIEWPOINTS \ 44 44 demo1.env -
GTP/trunk/Lib/Vis/Preprocessing/scripts/run_gvs_vps.sh
r2741 r2742 17 17 #SCENE=../data/roofs_new.obj 18 18 SCENE=../data/vienna/city_full_hp.obj 19 SCENE=../data/vienna/vienna_rep.obj20 #SCENE=../data/vienna/vienna_cropped.obj19 #SCENE=../data/vienna/vienna_rep.obj 20 SCENE=../data/vienna/vienna_cropped.obj 21 21 22 22 VIEWCELLS=../data/vienna/vienna_cropped-gradient-viewcells.xml.gz … … 43 43 -gvs_initial_samples=16 \ 44 44 -gvs_max_viewcells=1 \ 45 -gvs_min_contribution= 50 \45 -gvs_min_contribution=20 \ 46 46 -gvs_per_viewcell=true \ 47 47 -gvs_radius_of_influence=5.0 \ 48 -gvs_use_deterministic_gvs -\48 -gvs_use_deterministic_gvs+ \ 49 49 -gvs_initial_jitter=0.1 \ 50 50 -preprocessor_detect_empty_viewspace+ \ -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r2738 r2742 97 97 98 98 // for sg snapshot 99 100 99 mViewPoint = Vector3(32.8596, 9.86079, -1023.79); 100 mViewDirection = Vector3(-0.92196, 0, 0.387286); 101 101 102 102 // inside … … 106 106 if (1) { 107 107 108 // outside 109 mViewPoint = Vector3(35.092, 17.7078, -857.966); 110 mViewDirection = Vector3(-0.411287, 0, -0.911506); 111 112 // strange viewcell for error measurements (id 534) 113 mViewPoint = Vector3(1405.9, 218.284, -736.785); 114 mViewDirection = Vector3(0.989155, 0, 0.146877); 115 116 // high error for city_full 117 mViewPoint = Vector3(842.521, 194.708, -136.708); 118 mViewDirection = Vector3(0.730514, 0, -0.682897); 119 120 // also high error for city_full 121 mViewPoint = Vector3(1038.7f, 192.4f, -471.0f); 122 mViewDirection = Vector3(-0.8f, 0.0f, -0.6f); 123 124 mViewPoint = Vector3(440.295, 196.959, -781.302); 125 mViewDirection = Vector3(-0.0566328, 0, -0.998395); 126 127 mViewPoint = Vector3(680.682, 189.552, -278.177); 128 mViewDirection = Vector3(0.942709, -0, -0.333584); 129 130 // strange error for gvs 131 mViewPoint = Vector3(1186.9, 193.552, -377.044); 132 mViewDirection = Vector3(-0.963031, -0, -0.269365); 133 134 mViewPoint = Vector3(1189.54, 220.087, -462.869); 135 mViewDirection = Vector3(-0.996972, -0, -0.0776569); 136 137 mViewPoint = Vector3(1199.53, 257.677, -457.145); 138 mViewDirection = Vector3(-0.71206, -0, -0.702108); 139 140 mViewPoint = Vector3(1188.22, 187.427, -381.739); 141 mViewDirection = Vector3(-0.963031, -0, -0.269365); 108 // outside 109 mViewPoint = Vector3(35.092, 17.7078, -857.966); 110 mViewDirection = Vector3(-0.411287, 0, -0.911506); 111 112 // strange viewcell for error measurements (id 534) 113 mViewPoint = Vector3(1405.9, 218.284, -736.785); 114 mViewDirection = Vector3(0.989155, 0, 0.146877); 115 116 // high error for city_full 117 mViewPoint = Vector3(842.521, 194.708, -136.708); 118 mViewDirection = Vector3(0.730514, 0, -0.682897); 119 120 // also high error for city_full 121 mViewPoint = Vector3(1038.7f, 192.4f, -471.0f); 122 mViewDirection = Vector3(-0.8f, 0.0f, -0.6f); 123 124 mViewPoint = Vector3(440.295, 196.959, -781.302); 125 mViewDirection = Vector3(-0.0566328, 0, -0.998395); 126 127 mViewPoint = Vector3(680.682, 189.552, -278.177); 128 mViewDirection = Vector3(0.942709, -0, -0.333584); 129 130 // strange error for gvs 131 /*mViewPoint = Vector3(1186.9, 193.552, -377.044); 132 mViewDirection = Vector3(-0.963031, -0, -0.269365); 133 134 mViewPoint = Vector3(1189.54, 220.087, -462.869); 135 mViewDirection = Vector3(-0.996972, -0, -0.0776569); 136 137 mViewPoint = Vector3(1199.53, 257.677, -457.145); 138 mViewDirection = Vector3(-0.71206, -0, -0.702108); 139 140 mViewPoint = Vector3(1188.22, 187.427, -381.739); 141 mViewDirection = Vector3(-0.963031, -0, -0.269365); 142 143 mViewPoint = Vector3(1188.22, 187.427, -381.739); 144 mViewDirection = Vector3(-0.963031, -0, -0.269365); 145 */ 142 146 } 143 147 } -
GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp
r2741 r2742 140 140 141 141 // note: deletion of the ray is handled by ray pool 142 mRayCaster->SheduleRayForDeletion(ray); 142 143 } 143 144 } … … 209 210 210 211 mGvsStats.mReverseSamples += (int)reverseRays.size(); 211 212 212 EnqueueRays(reverseRays); 213 213 … … 234 234 simpleRays.clear(); 235 235 236 CreateRandomizedReverseRays(currentRay, predictedHit, simpleRays, 16 );236 CreateRandomizedReverseRays(currentRay, predictedHit, simpleRays, 16, hitTriangle); 237 237 238 238 static VssRayContainer reverseRays; … … 344 344 bool GvsPreprocessor::HandleRay(VssRay *vssRay) 345 345 { 346 if (!vssRay || !HasContribution(*vssRay))346 if (!vssRay) 347 347 return false; 348 348 349 if (!HasContribution(*vssRay)) 350 { 351 mRayCaster->SheduleRayForDeletion(vssRay); 352 return false; 353 } 354 349 355 if (0 && GVS_DEBUG) 350 356 mVssRays.push_back(new VssRay(*vssRay)); … … 354 360 355 361 ++ mGvsStats.mTotalContribution; 362 363 if (mRayQueue.size() % 10000 == 0) 364 cout << "ray queue size: " << mRayQueue.size() << endl; 365 366 if (mGvsStats.mTotalContribution % 10000 == 0) 367 cout << "contri: " << mGvsStats.mTotalContribution << endl; 356 368 357 369 return true; … … 452 464 // cast single ray to check if a triangle was missed. note: not efficient!! 453 465 newRay = mRayCaster->CastRay(sray, mViewCellsManager->GetViewSpaceBox(), !mPerViewCell); 466 ++ castRays; 467 454 468 castTimer.Exit(); 455 469 456 ++ castRays; 457 458 // this ray will not be further processed 459 // note: ray deletion is handled by ray pool 460 if (!newRay) return castRays; 461 462 rayTimer.Entry(); 463 464 // new triangle discovered? => add new ray to queue 465 HandleRay(newRay); 466 467 rayTimer.Exit(); 468 470 if (!newRay) 471 return castRays; 472 469 473 //newRay->mFlags |= VssRay::BorderSample; 470 474 471 475 // cast reverse rays if necessary 472 castRays += CheckDiscontinuity( ray2, hitTriangle, oldRay);473 476 castRays += CheckDiscontinuity(*newRay, hitTriangle, oldRay); 477 474 478 // subdivide further 475 479 castRays += SubdivideEdge(hitTriangle, p1, p, ray1, *newRay, oldRay); 476 480 castRays += SubdivideEdge(hitTriangle, p, p2, *newRay, ray2, oldRay); 477 481 482 rayTimer.Entry(); 483 484 // new triangle discovered? => add new ray to queue 485 HandleRay(newRay); 486 487 rayTimer.Exit(); 488 478 489 return castRays; 479 490 } … … 549 560 int castRays = (int)simpleRays.size(); 550 561 551 // handle cast rays552 EnqueueRays(vssRays);553 554 562 if (0) 555 563 { … … 567 575 (*rit)->mFlags |= VssRay::BorderSample; 568 576 } 569 577 #if 0 570 578 // recursivly subdivide each edge 571 579 for (int i = 0; i < numBorderSamples; ++ i) … … 580 588 currentRay); 581 589 } 582 590 #endif 583 591 mGvsStats.mBorderSamples += castRays; 584 592 593 // handle cast rays 594 EnqueueRays(vssRays); 595 585 596 return castRays; 586 597 } … … 602 613 cout << "error: gvs sampling for " << Intersectable::GetTypeName(tObj) << " not implemented" << endl; 603 614 615 616 static SimpleRayContainer simpleRays; 617 simpleRays.clear(); 618 619 604 620 generationTimer.Entry(); 605 621 #if 0 606 622 static VertexContainer enlargedTriangle; 607 623 enlargedTriangle.clear(); … … 625 641 } 626 642 627 /// create rays from sample points and handle them628 static SimpleRayContainer simpleRays;629 simpleRays.clear();630 631 643 VertexContainer::const_iterator vit, vit_end = subdivEnlargedTri.end(); 632 644 … … 639 651 } 640 652 641 653 #endif 642 654 ////////// 643 655 //-- fill up simple rays with random rays so we can cast 16 rays at a time … … 675 687 int castRays = (int)simpleRays.size(); 676 688 677 // handle cast rays 678 EnqueueRays(vssRays); 679 680 681 #if 1 689 #if 0 682 690 for (size_t i = 0; i < vssRays.size(); ++ i) 683 691 { … … 685 693 castRays += CheckDiscontinuity2(*vssRays[i], hitTriangle, currentRay); 686 694 } 687 695 #endif 696 #if 0 688 697 689 698 // recursivly subdivide each edge … … 702 711 703 712 mGvsStats.mBorderSamples += castRays; 704 713 714 // handle cast rays 715 EnqueueRays(vssRays); 716 705 717 return castRays; 706 718 } … … 844 856 else 845 857 { 846 GenerateRays(mUseDeterministicGvs ? numSamples : numSamples / 16, *mDistribution, simpleRays, sInvalidSamples); 858 GenerateRays(mUseDeterministicGvs ? 859 numSamples : numSamples / 16, *mDistribution, simpleRays, sInvalidSamples); 847 860 } 848 861 … … 883 896 884 897 885 void GvsPreprocessor::EnqueueRays( VssRayContainer &samples)898 void GvsPreprocessor::EnqueueRays(const VssRayContainer &samples) 886 899 { 887 900 rayTimer.Entry(); … … 893 906 VssRay *ray = *vit; 894 907 HandleRay(ray); 895 // note: deletion of invalid samples handked by ray pool896 908 } 897 909 … … 918 930 else 919 931 castSamples += AdaptiveBorderSamplingOpt(*ray); 920 921 // note: don't have to delete because handled by ray pool922 932 } 923 933 … … 2001 2011 void GvsPreprocessor::PrepareProbablyVisibleSampling() 2002 2012 { 2003 2004 2013 // warning: using mailing! 2005 2014 Intersectable::NewMail(); … … 2043 2052 const Vector3 &predictedPoint, 2044 2053 SimpleRayContainer &rays, 2045 int number) 2054 int number, 2055 const Triangle3 &triangle) 2046 2056 { 2047 2057 size_t currentNumber = rays.size(); … … 2052 2062 { 2053 2063 SimpleRay simpleRay; 2054 if (CreateRandomizedReverseRay(ray, predictedPoint, simpleRay ))2064 if (CreateRandomizedReverseRay(ray, predictedPoint, simpleRay, triangle)) 2055 2065 rays.push_back(simpleRay); 2056 2066 } 2057 2067 2068 if (rays.size() != 16) 2069 cout << "x"; 2070 //else cout <<"y"; 2058 2071 //cout << "generated " << rays.size() << " rays" << endl; 2059 2072 } … … 2062 2075 bool GvsPreprocessor::CreateRandomizedReverseRay(const VssRay &ray, 2063 2076 const Vector3 &predictedPoint, 2064 SimpleRay &simpleRay) 2065 { 2066 //Vector3 nd = ray.GetNormalizedDir(); 2077 SimpleRay &simpleRay, 2078 const Triangle3 &triangle) 2079 { 2080 /*Vector3 nd = ray.GetNormalizedDir(); 2067 2081 const AxisAlignedBox3 box = mCurrentViewCell->GetBox(); 2068 2082 //Vector3 nd = box.GetNearestFace(origin).GetNormal(); … … 2070 2084 2071 2085 // Compute right handed coordinate system from direction 2072 /*Vector3 U, V;2086 Vector3 U, V; 2073 2087 nd.RightHandedBase(U, V); 2074 2088 … … 2079 2093 2080 2094 Vector2 vr2(rr[0], rr[1]); 2081 const float sigma = 1.0f;//triangle.GetBoundingBox().Radius() * mRadiusOfInfluence;2095 const float sigma = triangle.GetBoundingBox().Radius() * 1.0f; 2082 2096 Vector2 gaussvec2; 2083 2097 2084 2098 GaussianOn2D(vr2, sigma, // input 2085 2099 gaussvec2); // output 2086 2087 const Vector3 shift = gaussvec2.xx * U + gaussvec2.yy * V;2088 2089 Vector3 newOrigin = ray.mOrigin + shift;2090 2100 */ 2101 const Vector3 shift = 0;//gaussvec2.xx * U + gaussvec2.yy * V; 2102 2103 const Vector3 newTermination = ray.mTermination + shift; 2104 2091 2105 //cout << "o: " << origin << " new o: " << newOrigin << endl; 2092 Vector3 newOrigin = box.GetRandomPoint();2093 Vector3 direction = predictedPoint- newOrigin;2106 Vector3 newOrigin = mCurrentViewCell->GetBox().GetRandomPoint(); 2107 Vector3 direction = newTermination - newOrigin; 2094 2108 2095 2109 const float len = Magnitude(direction); … … 2101 2115 2102 2116 if (0 && !IntersectsViewCell(newOrigin, -direction)) 2103 {2104 //cout << "x";2105 2117 return false; 2106 }2107 2118 2108 2119 //cout << "y"; … … 2114 2125 } 2115 2126 2116 2117 } 2127 } -
GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.h
r2741 r2742 178 178 with respect to the previous ray. 179 179 */ 180 void EnqueueRays( VssRayContainer &samples);180 void EnqueueRays(const VssRayContainer &samples); 181 181 /** Hepler function for adaptive border sampling. It finds 182 182 new sample points around a triangle in a eps environment … … 300 300 const Vector3 &predictedPoint, 301 301 SimpleRayContainer &rays, 302 int number); 302 int number, 303 const Triangle3 &triangle); 303 304 304 305 bool CreateRandomizedReverseRay(const VssRay &ray, 305 306 const Vector3 &predictedPoint, 306 SimpleRay &simpleray); 307 SimpleRay &simpleray, 308 const Triangle3 &triangle); 307 309 308 310 inline bool IntersectsViewCell(Vector3 &origin, const Vector3 &dir) const; 311 312 void DeleteOldRays(); 313 309 314 310 315 -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2736 r2742 1182 1182 const int n = 4; 1183 1183 reserveRays = mSamplesPerPass * n; 1184 cout << "setting ray pool size to " << reserveRays << endl; 1185 1186 } 1184 1185 } 1186 1187 #ifdef USE_RAY_POOL 1188 cout << "setting ray pool size to " << reserveRays << endl; 1187 1189 1188 1190 cout << "======================" << endl; … … 1192 1194 1193 1195 cout<<"done."<<endl<<flush; 1194 1196 #endif 1197 1195 1198 return true; 1196 1199 } -
GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.cpp
r2718 r2742 373 373 const float pdf) 374 374 { 375 #ifdef USE_RAY_POOL 376 375 377 #if DEBUG_RAYCAST 376 378 Debug<<"PR2a"<<flush; … … 392 394 #endif 393 395 396 #else 397 VssRay *vssRay = new VssRay(origin, termination, originObject, terminationObject, pass, pdf); 398 #endif 394 399 return vssRay; 395 400 } 401 402 403 void RayCaster::SheduleRayForDeletion(VssRay *ray) 404 { 405 #ifndef USE_RAY_POOL 406 delete ray; 407 #endif 408 } 409 410 411 /*void RayCaster::DeleteOldRays() 412 { 413 CLEAR_CONTAINER(mOldRays); 414 }*/ 396 415 397 416 -
GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.h
r2729 r2742 107 107 { } 108 108 109 109 void SheduleRayForDeletion(VssRay *ray); 110 110 111 /*virtual void CastRaysEye4(SimpleRayContainer &rays, 111 112 VssRayContainer &vssRays, -
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp
r2741 r2742 809 809 static Vector3 point; 810 810 static Vector3 normal; 811 static float r[2]; 811 812 float r[2]; 812 813 813 814 sHalton.GetNext(2, r); … … 831 832 //origin = mViewCell->GetBox().GetRandomSurfacePoint(); 832 833 origin = mViewCell->GetBox().GetRandomPoint(); 833 834 //origin = Vector3(680.682, 189.552, -278.177); 834 835 // move a little bit back to avoid piercing through walls 835 836 // that bound the view cell
Note: See TracChangeset
for help on using the changeset viewer.