Changeset 1715 for GTP/trunk/Lib/Vis
- Timestamp:
- 11/06/06 20:47:06 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/AxisAlignedBox3.cpp
r1581 r1715 8 8 #include "Polygon3.h" 9 9 #include "Mesh.h" 10 #include "Halton.h" 10 11 11 12 namespace GtpVisibilityPreprocessor { … … 2259 2260 } 2260 2261 2261 } 2262 Vector3 2263 AxisAlignedBox3::GetRandomPoint() const 2264 { 2265 Vector3 size = Size(); 2266 2267 #if 0 2268 static HaltonSequence halton; 2269 2270 halton.GenerateNext(); 2271 2272 return mMin + size*Vector3(halton.GetNumber(1), 2273 halton.GetNumber(2), 2274 halton.GetNumber(3)); 2275 2276 #else 2277 return mMin + Vector3(RandomValue(0.0f, size.x), 2278 RandomValue(0.0f, size.y), 2279 RandomValue(0.0f, size.z)); 2280 #endif 2281 } 2282 2283 } 2284 -
GTP/trunk/Lib/Vis/Preprocessing/src/AxisAlignedBox3.h
r1486 r1715 181 181 182 182 183 Vector3 GetRandomPoint() const { 184 Vector3 size = Size(); 185 return mMin + Vector3(RandomValue(0.0f, size.x), 186 RandomValue(0.0f, size.y), 187 RandomValue(0.0f, size.z)); 188 } 183 Vector3 GetRandomPoint() const; 189 184 190 185 -
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1713 r1715 565 565 splitCandidate.SetPvsEntriesIncr(pvsEntriesIncr); 566 566 567 #ifdef _DEBUG567 #ifdef GTP_DEBUG 568 568 Debug << "old render cost: " << oldRenderCost << endl; 569 569 Debug << "new render cost: " << newRenderCost << endl; … … 642 642 ); 643 643 644 #ifdef _DEBUG644 #ifdef GTP_DEBUG 645 645 if (terminationCriteriaMet) 646 646 { … … 1119 1119 float ratio = newCost / totalRenderCost; 1120 1120 1121 #ifdef _DEBUG1121 #ifdef GTP_DEBUG 1122 1122 // if (objectsBack.empty() ||objectsFront.empty()) 1123 1123 cout << "\n\nobjects=(" << (int)objectsBack.size() << "," << (int)objectsFront.size() << " of " … … 1209 1209 float newRenderCost = nTotalObjects * totalVol; 1210 1210 1211 #ifdef _DEBUG1211 #ifdef GTP_DEBUG 1212 1212 ofstream sumStats; 1213 1213 ofstream vollStats; … … 1245 1245 1e25 : volLeft * (float)nObjectsLeft + volRight * (float)nObjectsRight; 1246 1246 1247 #ifdef _DEBUG1247 #ifdef GTP_DEBUG 1248 1248 if (printStats) 1249 1249 { … … 1284 1284 const float ratio = newRenderCost / oldRenderCost; 1285 1285 1286 #ifdef _DEBUG1286 #ifdef GTP_DEBUG 1287 1287 Debug << "\n§§§§ bvh eval const decrease §§§§" << endl 1288 1288 << "back pvs: " << (int)objectsBack.size() << " front pvs: " -
GTP/trunk/Lib/Vis/Preprocessing/src/FromPointVisibilityTree.cpp
r1006 r1715 1115 1115 BspInterior *interior = new BspInterior(splitPlane); 1116 1116 1117 #ifdef _DEBUG1117 #ifdef GTP_DEBUG 1118 1118 Debug << interior << endl; 1119 1119 #endif … … 1808 1808 } 1809 1809 1810 #ifdef _DEBUG1810 #ifdef GTP_DEBUG 1811 1811 Debug << "plane lowest cost: " << lowestCost << endl; 1812 1812 #endif … … 2114 2114 2115 2115 2116 #ifdef _DEBUG2116 #ifdef GTP_DEBUG 2117 2117 Debug << "totalpvs: " << data.mPvs << " ptotal: " << pOverall 2118 2118 << " frontpvs: " << pvsFront << " pFront: " << pFront … … 2263 2263 } 2264 2264 2265 #ifdef _DEBUG2265 #ifdef GTP_DEBUG 2266 2266 Debug << axis << " " << pvsSize << " " << pvsBack << " " << pvsFront << endl; 2267 2267 Debug << pFront << " " << pBack << " " << pOverall << endl; … … 2419 2419 ++ mCreatedViewCells; 2420 2420 2421 #ifdef _DEBUG2421 #ifdef GTP_DEBUG 2422 2422 Debug << "BSP stats: " 2423 2423 << "Depth: " << data.mDepth << " (max: " << mTermMaxDepth << "), " -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r1713 r1715 314 314 ); 315 315 316 #if _DEBUG316 #if GTP_DEBUG 317 317 if (terminationCriteriaMet) 318 318 { … … 1326 1326 cout << "."; 1327 1327 1328 #ifdef _DEBUG1328 #ifdef GTP_DEBUG 1329 1329 Debug << "candidate " << sc << " reevaluated\n" 1330 1330 << "render cost decrease diff " << rcd - sc->GetRenderCostDecrease() -
GTP/trunk/Lib/Vis/Preprocessing/src/Makefile
r1694 r1715 1 1 ############################################################################# 2 2 # Makefile for building: preprocessor 3 # Generated by qmake (2.00a) (Qt 4.1.2) on: s o 28. X 21:20:40 20063 # Generated by qmake (2.00a) (Qt 4.1.2) on: st 1. XI 14:21:30 2006 4 4 # Project: preprocessor.pro 5 5 # Template: app -
GTP/trunk/Lib/Vis/Preprocessing/src/OspTree.cpp
r1694 r1715 584 584 mOspStats.maxObjectRefs = (int)leaf->mObjects.size(); 585 585 586 #ifdef _DEBUG586 #ifdef GTP_DEBUG 587 587 Debug << "BSP stats: " 588 588 << "Depth: " << data.mDepth << " (max: " << mTermMaxDepth << "), " … … 715 715 ratio = minRenderCost / totalRenderCost; 716 716 } 717 #if _DEBUG717 #if GTP_DEBUG 718 718 Debug << "\n§§§§ eval local cost §§§§" << endl 719 719 << "old rc: " << totalRenderCost / viewSpaceVol << " new rc: " << minRenderCost / viewSpaceVol << endl -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r1713 r1715 640 640 { 641 641 Environment::GetSingleton()->GetStringValue("ViewCells.filename", buf); 642 cout << "loading view cells from " << buf << endl ;642 cout << "loading view cells from " << buf << endl<<flush; 643 643 644 644 mViewCellsManager = ViewCellsManager::LoadViewCells(buf, &mObjects, true, NULL); 645 645 646 cout << "view cells loaded." << endl<<flush; 647 646 648 if (!mViewCellsManager) 647 649 { -
GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h
r1707 r1715 97 97 { 98 98 public: 99 Pvs(): /*mSamples(0), */mEntries() {} 99 Pvs(): mSamples(0), mEntries() {} 100 100 101 101 102 //virtual ~Pvs(); … … 199 200 /// Map of PVS entries 200 201 std::map<T, S, LtSample<T> > mEntries; 202 203 /// Number of samples used to create the PVS 204 int mSamples; 201 205 }; 202 206 … … 340 344 Pvs<T, S>::AddSample(T sample, const float pdf) 341 345 { 342 S *data = Find(sample); 343 344 if (data) 345 { 346 data->mSumPdf += pdf; 347 return data->mSumPdf; 348 } 349 else 350 { 351 mEntries[sample] = S(pdf); 352 return pdf; 346 mSamples++; 347 S *data = Find(sample); 348 349 if (data) 350 { 351 data->mSumPdf += pdf; 352 return data->mSumPdf; 353 } 354 else 355 { 356 mEntries[sample] = S(pdf); 357 return pdf; 353 358 } 354 359 } … … 358 363 S * Pvs<T, S>::AddSample2(T sample, const float pdf) 359 364 { 360 S *data = Find(sample); 361 362 if (data) 363 { 364 data->mSumPdf += pdf; 365 } 366 else 367 { 368 mEntries[sample] = S(pdf); 369 data = Find(sample); 370 } 371 372 return data; 365 mSamples++; 366 S *data = Find(sample); 367 368 if (data) 369 { 370 data->mSumPdf += pdf; 371 } 372 else 373 { 374 mEntries[sample] = S(pdf); 375 data = Find(sample); 376 } 377 378 return data; 373 379 } 374 380 … … 378 384 float &contribution) 379 385 { 386 mSamples++; 380 387 S *data = Find(sample); 381 388 … … 415 422 const float pdf) 416 423 { 424 mSamples--; 425 417 426 std::map<T, S, LtSample<T> >:: 418 427 iterator it = mEntries.find(sample); … … 436 445 int Pvs<T, S>::AddPvs(const Pvs<T, S> &pvs) 437 446 { 447 mSamples += pvs.mSamples; 438 448 std::map<T, S, LtSample<T> >:: 439 449 const_iterator it, it_end = pvs.mEntries.end(); … … 452 462 int Pvs<T, S>::SubtractPvs(const Pvs<T, S> &pvs) 453 463 { 464 mSamples -= pvs.mSamples; 454 465 std::map<T, S, LtSample<T> >:: 455 466 const_iterator it, it_end = pvs.mEntries.end(); -
GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer.cpp
r1694 r1715 779 779 Normalize(CrossProd(beam.mPlanes[0].mNormal, beam.mPlanes[4].mNormal)); 780 780 781 #ifdef _DEBUG781 #ifdef GTP_DEBUG 782 782 Debug << "view point: " << viewPoint << endl; 783 783 Debug << "eye: " << center << endl; -
GTP/trunk/Lib/Vis/Preprocessing/src/QtPreprocessorThread.cpp
r1520 r1715 17 17 { 18 18 if (p->mQuitOnFinish) 19 19 { 20 20 connect(this, SIGNAL(finished()), qApp, SLOT(closeAllWindows(void))); 21 21 } 22 22 } 23 23 -
GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.cpp
r1694 r1715 15 15 16 16 17 #define USE_RSS_TREE 1 18 17 19 namespace GtpVisibilityPreprocessor { 18 20 … … 62 64 { 63 65 bool result = false; 66 67 Debug<<"Generate rays...\n"<<flush; 64 68 65 69 switch (sampleType) { … … 77 81 78 82 // rays.NormalizePdf(); 79 83 Debug<<"done.\n"<<flush; 84 80 85 return result; 81 86 } 87 82 88 83 89 … … 372 378 for (i=0 ; i < 3; i++) 373 379 ratios[i]/=sumRatios; 374 #define MIN_RATIO 0.03f 375 for (i=0 ; i < 3; i++) 380 381 #define MIN_RATIO 0.1f 382 383 #if USE_RSS_TREE 384 i = 0; 385 #else 386 i = 1; 387 #endif 388 389 for (; i < 3; i++) 376 390 if (ratios[i] < MIN_RATIO) 377 391 ratios[i] = MIN_RATIO; … … 525 539 526 540 if (mUseImportanceSampling) { 527 541 542 #if USE_RSS_TREE 528 543 mRssTree->Construct(mObjects, mVssRays); 544 #endif 529 545 530 546 mRssTree->stat.Print(mStats); … … 545 561 546 562 563 547 564 while (1) { 565 548 566 static SimpleRayContainer rays; 549 567 static VssRayContainer vssRays; 550 568 static VssRayContainer tmpVssRays; 569 570 rays.reserve((int)(1.1f*mRssSamplesPerPass)); 571 551 572 rays.clear(); 552 573 vssRays.clear(); 553 574 tmpVssRays.clear(); 575 554 576 int castRays = 0; 555 577 if (mUseImportanceSampling) { 556 578 579 #if USE_RSS_TREE 557 580 static float ratios[] = {0.9f,0.05f,0.05f}; 581 #else 582 static float ratios[] = {0.0f,0.05f,0.05f}; 583 #endif 584 NormalizeRatios(ratios); 585 586 cout<<"New ratios: "<<ratios[0]<<" "<<ratios[1]<<" "<<ratios[2]<<endl; 587 558 588 //float ratios[] = {1.0f,0.0f,0.0f}; 559 589 … … 566 596 t1 = GetTime(); 567 597 568 GenerateRays(int(mRssSamplesPerPass*ratios[0]), SamplingStrategy::RSS_BASED_DISTRIBUTION, rays); 569 598 GenerateRays(int(mRssSamplesPerPass*ratios[0]), 599 SamplingStrategy::RSS_BASED_DISTRIBUTION, 600 rays); 601 570 602 rays.NormalizePdf((float)rays.size()); 571 603 … … 632 664 #define TIME_WEIGHT 0.5f 633 665 666 #if 1 634 667 ratios[0] = sqr(contributions[0]/(TIME_WEIGHT*times[0] + (1 - TIME_WEIGHT)*nrays[0])); 635 668 ratios[1] = sqr(contributions[1]/(TIME_WEIGHT*times[1] + (1 - TIME_WEIGHT)*nrays[1])); 636 669 ratios[2] = sqr(contributions[2]/(TIME_WEIGHT*times[2] + (1 - TIME_WEIGHT)*nrays[2])); 637 638 NormalizeRatios(ratios); 639 640 cout<<"New ratios: "<<ratios[0]<<" "<<ratios[1]<<" "<<ratios[2]<<endl; 670 #else 671 ratios[0] = contributions[0]/(TIME_WEIGHT*times[0] + (1 - TIME_WEIGHT)*nrays[0]); 672 ratios[1] = contributions[1]/(TIME_WEIGHT*times[1] + (1 - TIME_WEIGHT)*nrays[1]); 673 ratios[2] = contributions[2]/(TIME_WEIGHT*times[2] + (1 - TIME_WEIGHT)*nrays[2]); 674 #endif 675 676 #if !USE_RSS_TREE 677 ratios[0] = 0; 678 #endif 641 679 642 680 // add contributions of all rays at once... … … 658 696 cout<<"done."<<endl; 659 697 660 cout<<"Casting rays..."<<endl; 661 CastRays(rays, vssRays, true); 698 cout<<"Casting rays..."<<endl; CastRays(rays, vssRays, true); 662 699 cout<<"done."<<endl; 663 700 castRays += (int)rays.size(); … … 691 728 692 729 if (mUseViewcells) { 730 Debug<<"Print statistics...\n"<<flush; 693 731 vssRays.PrintStatistics(mStats); 694 732 mViewCellsManager->PrintPvsStatistics(mStats); 733 Debug<<"done.\n"<<flush; 695 734 } 696 735 … … 744 783 // already when adding into the tree 745 784 // do not add those rays which have too low or no contribution.... 746 785 786 #if USE_RSS_TREE 747 787 if (mUseImportanceSampling) { 788 Debug<<"Adding rays...\n"<<flush; 748 789 mRssTree->AddRays(vssRays); 749 790 Debug<<"done.\n"<<flush; 750 791 if (mUpdateSubdivision) { 751 792 int updatePasses = 1; 752 793 if (mPass % updatePasses == 0) { 794 Debug<<"Updating rss tree...\n"<<flush; 753 795 int subdivided = mRssTree->UpdateSubdivision(); 796 Debug<<"done.\n"<<flush; 754 797 cout<<"subdivided leafs = "<<subdivided<<endl; 755 798 cout<<"#total leaves = "<<mRssTree->stat.Leaves()<<endl; … … 757 800 } 758 801 } 802 #endif 759 803 760 804 if (mExportPvs) { -
GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.cpp
r1632 r1715 1888 1888 rays.push_back(SimpleRay(origin, direction)); 1889 1889 } 1890 1891 1890 } else { 1892 1891 RssTreeInterior *in = (RssTreeInterior *)node; … … 2168 2167 } 2169 2168 2169 2170 void 2171 RssTree::GenerateLeafRaysSimple(RssTreeLeaf *leaf, 2172 const int numberOfRays, 2173 SimpleRayContainer &rays) 2174 { 2175 2176 if (numberOfRays == 0) 2177 return; 2178 2179 int startIndex = (int)rays.size(); 2180 2181 Debug<<"B"<<flush; 2182 2183 AxisAlignedBox3 box = GetBBox(leaf); 2184 AxisAlignedBox3 dirBox = GetDirBBox(leaf); 2185 2186 float boxSize = Magnitude(box.Diagonal()); 2187 2188 const float smoothRange = 0.1f; 2189 if (smoothRange != 0.0f) { 2190 box.Scale(1.0f + smoothRange); 2191 dirBox.Scale(1.0f + smoothRange); 2192 } 2193 2194 Debug<<"R"<<flush; 2195 2196 for (int i=0; i < numberOfRays; i++) { 2197 // Debug<<i<<flush; 2198 2199 Vector3 origin, direction; 2200 Vector3 dirVector; 2201 2202 Vector3 pVector; 2203 Vector3 dVector; 2204 2205 bool useHalton = false; 2206 2207 2208 if (useHalton) { 2209 // generate a random 5D vector 2210 pVector = Vector3(leaf->halton.GetNumber(1), 2211 leaf->halton.GetNumber(2), 2212 leaf->halton.GetNumber(3)); 2213 2214 dVector = Vector3(leaf->halton.GetNumber(4), 2215 leaf->halton.GetNumber(5), 2216 0.0f); 2217 2218 leaf->halton.GenerateNext(); 2219 } else { 2220 pVector = Vector3(RandomValue(0.0f, 1.0f), 2221 RandomValue(0.0f, 1.0f), 2222 RandomValue(0.0f, 1.0f)); 2223 2224 dVector = Vector3(RandomValue(0.0f, 1.0f), 2225 RandomValue(0.0f, 1.0f), 2226 0.0f); 2227 } 2228 2229 origin = box.GetPoint(pVector); 2230 dirVector = dirBox.GetPoint(dVector); 2231 2232 direction = Vector3(sin(dirVector.x), sin(dirVector.y), cos(dirVector.x)); 2233 2234 2235 2236 // shift the origin a little bit 2237 direction.Normalize(); 2238 2239 // float dist = Min(avgLength*0.5f, Magnitude(GetBBox(leaf).Size())); 2240 float dist = 0.0f; 2241 float minT, maxT; 2242 2243 // compute interection of the ray with the box 2244 #if 1 2245 if (box.ComputeMinMaxT(origin, direction, &minT, &maxT) && minT < maxT) 2246 dist = maxT; 2247 #else 2248 dist = 0.5f*boxSize; 2249 #endif 2250 2251 origin += direction*dist; 2252 2253 #if 0 2254 static int counter = 0; 2255 Debug<<counter++<<flush; 2256 2257 if (counter > 10374968) { 2258 Debug<<"size="<<rays.size()<<endl; 2259 Debug<<"capacity="<<rays.capacity()<<endl; 2260 Debug<<"o="<<origin<<endl; 2261 Debug<<"d="<<direction<<endl; 2262 } 2263 #endif 2264 //Debug<<"dir vector.x="<<dirVector.x<<"direction'.x="<<atan2(direction.x, direction.y)<<endl; 2265 rays.push_back(SimpleRay(origin, direction)); 2266 // Debug<<endl; 2267 2268 } 2269 2270 Debug<<"D"<<flush; 2271 2272 float density = 1.0f; 2273 float p = 1.0f/density; //(box.GetVolume()*dirBox.GetVolume())/i; 2274 for (i=startIndex; i < rays.size(); i++) { 2275 rays[i].mPdf = p; 2276 } 2277 } 2278 2170 2279 void 2171 2280 RssTree::GenerateLeafRays(RssTreeLeaf *leaf, … … 2190 2299 dirBox.Scale(1.0f + smoothRange); 2191 2300 } 2192 2193 2301 2194 2302 Exporter *exporter = NULL; … … 2377 2485 if (leaf->rays[i].mRay->mWeightedPvsContribution > contributionThreshold) { 2378 2486 // copy a valid sample 2379 if (i!=j) 2380 leaf->rays[j] = leaf->rays[i]; 2487 leaf->rays[j] = leaf->rays[i]; 2381 2488 j++; 2382 2489 } else { … … 2552 2659 2553 2660 vector<RssTreeLeaf *> leaves; 2554 2661 2662 Debug<<"Collecting leaves..."<<endl<<flush; 2555 2663 CollectLeaves(leaves); 2556 2557 if (numberOfLeaves != leaves.size()) 2664 Debug<<"done."<<endl<<flush; 2665 2666 2667 if (numberOfLeaves != leaves.size()) { 2668 Debug<<"sorting leaves..."<<endl<<flush; 2558 2669 sort(leaves.begin(), 2559 2670 leaves.end(), 2560 2671 GreaterContribution); 2672 Debug<<"done."<<endl<<flush; 2673 } 2561 2674 2675 2676 Debug<<"Evaluating leaf importance..."<<endl<<flush; 2562 2677 2563 2678 float sumContrib = 0.0; … … 2571 2686 k++; 2572 2687 } 2573 2688 2689 Debug<<"done."<<endl<<flush; 2690 2574 2691 float avgContrib = sumContrib/numberOfLeaves; 2575 2692 … … 2582 2699 2583 2700 k = 0; 2701 2702 Debug<<"generating leaf rays..."<<endl<<flush; 2703 2584 2704 for (i=0; i < leaves.size() && k < numberOfLeaves; i++) 2585 2705 if (ValidLeaf(leaves[i])) { 2586 k++;2587 2706 RssTreeLeaf *leaf = leaves[i]; 2588 2707 float c = leaf->GetImportance(); 2589 2708 2590 2709 int num = fixedPerLeaf + (int)(c*ratioPerLeaf + 0.5f); 2591 GenerateLeafRays(leaf, num, rays); 2592 } 2710 GenerateLeafRaysSimple(leaf, num, rays); 2711 2712 k++; 2713 } 2714 2715 Debug<<"done."<<endl<<flush; 2593 2716 2594 2717 return (int)rays.size(); -
GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.h
r1581 r1715 1006 1006 SimpleRayContainer &rays); 1007 1007 1008 void 1009 GenerateLeafRaysSimple(RssTreeLeaf *leaf, 1010 const int numberOfRays, 1011 SimpleRayContainer &rays); 1012 1008 1013 1009 1014 void -
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.cpp
r1579 r1715 124 124 125 125 // if not already loaded, construct view cells from file 126 if (!mLoadViewCells) 127 { 128 ConstructViewCells(); 126 if (!mLoadViewCells) { 127 ConstructViewCells(); 129 128 } 130 129 … … 181 180 } 182 181 183 // HoleSamplingPass(); 184 if (0) { 185 Exporter *exporter = Exporter::GetExporter("ray-density.x3d"); 186 exporter->SetExportRayDensity(true); 187 exporter->ExportKdTree(*mKdTree); 188 delete exporter; 189 } 190 191 192 // $$JB temporary removed 193 // mViewCellsManager->PostProcess(objects, mSampleRays); 194 195 //-- several visualizations and statistics 196 Debug << "view cells after post processing: " << endl; 197 mViewCellsManager->PrintStatistics(Debug); 198 199 //-- render simulation after merge 200 cout << "\nevaluating bsp view cells render time after merge ... "; 201 202 mRenderSimulator->RenderScene(); 203 SimulationStatistics ss; 204 mRenderSimulator->GetStatistics(ss); 205 206 cout << " finished" << endl; 207 cout << ss << endl; 208 Debug << ss << endl; 209 210 // $$JB temporary removed 182 if (0) { 183 Exporter *exporter = Exporter::GetExporter("ray-density.x3d"); 184 exporter->SetExportRayDensity(true); 185 exporter->ExportKdTree(*mKdTree); 186 delete exporter; 187 } 188 189 190 // $$JB temporary removed 191 // mViewCellsManager->PostProcess(objects, mSampleRays); 192 193 //-- several visualizations and statistics 194 Debug << "view cells after post processing: " << endl; 195 mViewCellsManager->PrintStatistics(Debug); 196 197 //-- render simulation after merge 198 cout << "\nevaluating bsp view cells render time after merge ... "; 199 200 mRenderSimulator->RenderScene(); 201 SimulationStatistics ss; 202 mRenderSimulator->GetStatistics(ss); 203 204 cout << " finished" << endl; 205 cout << ss << endl; 206 Debug << ss << endl; 207 208 // $$JB temporary removed 211 209 //mViewCellsManager->Visualize(objects, mSampleRays); 212 213 214 } 215 216 217 } 210 211 return true; 212 } 213 214 215 } -
GTP/trunk/Lib/Vis/Preprocessing/src/Triangle3.cpp
r1586 r1715 98 98 99 99 const Vector3 pt = ray.GetLoc() + t * dir; 100 #if _DEBUG100 #if GTP_DEBUG 101 101 if (!pt.CheckValidity()) 102 102 { -
GTP/trunk/Lib/Vis/Preprocessing/src/Vector3.cpp
r1420 r1715 126 126 ViewV = V; // upwards 127 127 ViewN = -N; // forwards 128 #ifdef _DEBUG128 #ifdef GTP_DEBUG 129 129 const float eps = 1e-3f; 130 130 if (fabs(Magnitude(ViewU) - 1.0) > eps) { … … 137 137 Debug << "ViewU magnitude error= " << Magnitude(ViewN) << "\n"; 138 138 } 139 #endif // _DEBUG139 #endif // GTP_DEBUG 140 140 141 141 return; … … 154 154 const Vector3 &dirIncoming) 155 155 { 156 #ifdef _DEBUG156 #ifdef GTP_DEBUG 157 157 float d = Magnitude(normal); 158 158 if ( (d < 0.99) || … … 184 184 185 185 U = CrossProd(normal, V); 186 #ifdef _DEBUG186 #ifdef GTP_DEBUG 187 187 d = SqrMagnitude(U); 188 188 if ( (d < 0.99) || … … 194 194 } 195 195 196 #define USE_HALTON 0 197 196 198 Vector3 197 199 UniformRandomVector() … … 200 202 // float r2 = RandomValue(0.0f, 1.0f); 201 203 float r1, r2; 202 204 205 #if USE_HALTON 203 206 halton2.GetNext(r1, r2); 204 205 206 float cosTheta = 1.0f - 2*r1; 207 #else 208 r1 = RandomValue(0.0f, 1.0f); 209 r2 = RandomValue(0.0f, 1.0f); 210 #endif 211 212 float cosTheta = 1.0f - 2*r1; 207 213 float sinTheta = sqrt(1 - sqr(cosTheta)); 208 214 float fi = 2.0f*M_PI*r2; … … 222 228 float r1, r2; 223 229 230 #if USE_HALTON 224 231 halton2.GetNext(r1, r2); 232 #else 233 r1 = RandomValue(0.0f, 1.0f); 234 r2 = RandomValue(0.0f, 1.0f); 235 #endif 225 236 226 237 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.cpp
r1707 r1715 355 355 DEL_PTR(back_piece); 356 356 357 #ifdef _DEBUG357 #ifdef GTP_DEBUG 358 358 Debug << "split " << *poly << endl << *front_piece << endl << *back_piece << endl; 359 359 #endif … … 1177 1177 BspInterior *interior = new BspInterior(SelectPlane(leaf, tData)); 1178 1178 1179 #ifdef _DEBUG1179 #ifdef GTP_DEBUG 1180 1180 Debug << interior << endl; 1181 1181 #endif … … 1341 1341 const float ratio = newCost / oldCost; 1342 1342 1343 #ifdef _DEBUG1343 #ifdef GTP_DEBUG 1344 1344 Debug << "====================" << endl; 1345 1345 Debug << "costRatio=" << ratio << " pos=" << position<<" t=" << (position - minBox)/(maxBox - minBox) … … 1577 1577 } 1578 1578 1579 #ifdef _DEBUG1579 #ifdef GTP_DEBUG 1580 1580 Debug << "plane lowest cost: " << lowestCost << endl; 1581 1581 #endif … … 1862 1862 1863 1863 1864 #ifdef _DEBUG1864 #ifdef GTP_DEBUG 1865 1865 Debug << "totalpvs: " << pvs << " ptotal: " << pOverall 1866 1866 << " frontpvs: " << frontPvs << " pFront: " << pFront … … 2018 2018 ++ mStat.minProbabilityNodes; 2019 2019 2020 #ifdef _DEBUG2020 #ifdef GTP_DEBUG 2021 2021 Debug << "BSP stats: " 2022 2022 << "Depth: " << data.mDepth << " (max: " << mTermMaxDepth << "), " -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1713 r1715 26 26 27 27 28 #define ABS_CONTRIBUTION_WEIGHT 1.0f 29 28 30 // warning: Should not count origin object for sampling because it disturbs heuristics 29 #define SAMPLE_ORIGIN_OBJECTS 1// matt temp31 #define SAMPLE_ORIGIN_OBJECTS 0 // matt temp 30 32 31 33 // $$JB HACK … … 666 668 bool success = parser.ParseViewCellsFile(filename, &vm, objects, bconverter); 667 669 670 cout<<"viewcells parsed "<<endl<<flush; 671 668 672 if (success) 669 673 { … … 2028 2032 } 2029 2033 2030 return ray.mRelativePvsContribution; 2034 return ABS_CONTRIBUTION_WEIGHT*ray.mPvsContribution + 2035 (1.0f - ABS_CONTRIBUTION_WEIGHT)*ray.mRelativePvsContribution; 2031 2036 } 2032 2037 … … 2415 2420 float viewSpaceFilterSize = Magnitude(mViewSpaceBox.Size())*relViewSpaceFilterSize; 2416 2421 float spatialFilterSize = Magnitude(kdTree->GetBox().Size())*relSpatialFilterSize; 2417 2422 2418 2423 int i; 2419 2424 for (i=0, it = mViewCells.begin(); it != it_end; ++ it, ++ i) { 2420 2421 kdTree,2422 viewSpaceFilterSize,2423 spatialFilterSize,2424 newPvs[i]2425 );2426 } 2427 2425 ApplyFilter(*it, 2426 kdTree, 2427 viewSpaceFilterSize, 2428 spatialFilterSize, 2429 newPvs[i] 2430 ); 2431 } 2432 2428 2433 // now replace all pvss 2429 2434 for (i = 0, it = mViewCells.begin(); it != it_end; ++ it, ++ i) { 2430 2431 2432 2433 2434 2435 2436 ObjectPvs &pvs = (*it)->GetPvs(); 2437 pvs.Clear(); 2438 pvs = newPvs[i]; 2439 newPvs[i].Clear(); 2435 2440 } 2436 2441 … … 2489 2494 } 2490 2495 2496 2497 void 2498 ViewCellsManager::ApplyFilter2(ViewCell *viewCell, 2499 KdTree *kdTree, 2500 const float filterSize, 2501 ObjectPvs &pvs 2502 ) 2503 { 2504 // first determine the average 2505 2506 2507 2508 } 2509 2491 2510 2492 2511 void ViewCellsManager::ExportColor(Exporter *exporter, … … 5622 5641 } 5623 5642 5624 return ray.mRelativePvsContribution; 5643 5644 5645 return ABS_CONTRIBUTION_WEIGHT*ray.mPvsContribution + 5646 (1.0f - ABS_CONTRIBUTION_WEIGHT)*ray.mRelativePvsContribution; 5625 5647 } 5626 5648 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r1709 r1715 461 461 const float spatialFilterSize); 462 462 463 // new adaptive version of the filter 464 void 465 ApplyFilter2(ViewCell *viewCell, 466 KdTree *kdTree, 467 const float filterSize, 468 ObjectPvs &pvs 469 ); 470 463 471 void ApplySpatialFilter(KdTree *kdTree, 464 472 const float spatialFilterSize, -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp
r1705 r1715 417 417 if (element == "ViewCells") 418 418 { 419 419 Debug << "\nparsing view cells" << endl; 420 420 421 421 mCurrentState = PARSE_VIEWCELLS; … … 1365 1365 return false; 1366 1366 } 1367 1367 1368 cout<<"parsing started"<<endl<<flush; 1369 1368 1370 // 1369 1371 // Create a SAX parser object. Then, according to what we were told on … … 1439 1441 } 1440 1442 } 1441 1443 1444 cout<<"parsed - will delete the parser"<<endl<<flush; 1442 1445 // 1443 1446 // Delete the parser itself. Must be done prior to calling Terminate, below. -
GTP/trunk/Lib/Vis/Preprocessing/src/VrmlExporter.cpp
r1707 r1715 126 126 const Vector3 b = (*ri)->mTerminationObject ? (*ri)->GetTermination() : a + 1000 * Normalize((*ri)->GetDir()); 127 127 128 #if _DEBUG128 #if GTP_DEBUG 129 129 bool isnan = false; 130 130 if (!a.CheckValidity()) -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
r1707 r1715 1197 1197 BspInterior *interior = new BspInterior(splitPlane); 1198 1198 1199 #ifdef _DEBUG1199 #ifdef GTP_DEBUG 1200 1200 Debug << interior << endl; 1201 1201 #endif … … 1845 1845 } 1846 1846 1847 #ifdef _DEBUG1847 #ifdef GTP_DEBUG 1848 1848 Debug << "plane lowest cost: " << lowestCost << endl; 1849 1849 #endif … … 2156 2156 2157 2157 2158 #ifdef _DEBUG2158 #ifdef GTP_DEBUG 2159 2159 Debug << "totalpvs: " << data.mPvs << " ptotal: " << pOverall 2160 2160 << " frontpvs: " << pvsFront << " pFront: " << pFront … … 2305 2305 } 2306 2306 2307 #ifdef _DEBUG2307 #ifdef GTP_DEBUG 2308 2308 Debug << "axis: " << axis << " " << pvsSize << " " << pvsBack << " " << pvsFront << endl; 2309 2309 Debug << "p: " << pFront << " " << pBack << " " << pOverall << endl; … … 2463 2463 ++ mCreatedViewCells; 2464 2464 2465 #ifdef _DEBUG2465 #ifdef GTP_DEBUG 2466 2466 Debug << "BSP stats: " 2467 2467 << "Depth: " << data.mDepth << " (max: " << mTermMaxDepth << "), " -
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp
r1707 r1715 595 595 ); 596 596 597 #if _DEBUG597 #if GTP_DEBUG 598 598 if (localTerminationCriteriaMet) 599 599 { … … 621 621 ); 622 622 623 #if _DEBUG623 #if GTP_DEBUG 624 624 if (terminationCriteriaMet) 625 625 { … … 1306 1306 vector<SortableEntry>::const_iterator ci, ci_end = mLocalSubdivisionCandidates->end(); 1307 1307 1308 #ifdef _DEBUG1308 #ifdef GTPGTP_DEBUG 1309 1309 const float volRatio = tData.mBoundingBox.GetVolume() / (sizeBox * mBoundingBox.GetVolume()); 1310 1310 const int leaves = mVspStats.Leaves(); … … 1346 1346 sum = pvsl * ((*ci).value - minBox) + pvsr * (maxBox - (*ci).value); 1347 1347 1348 #ifdef _DEBUG1348 #ifdef GTPGTP_DEBUG 1349 1349 if (printStats) 1350 1350 { … … 1399 1399 } 1400 1400 1401 #ifdef _DEBUG1401 #ifdef GTPGTP_DEBUG 1402 1402 Debug << "\n§§§§ eval local cost §§§§" << endl 1403 1403 << "back pvs: " << penaltyBack << " front pvs: " << penaltyFront << " total pvs: " << penaltyOld << endl … … 1566 1566 const float renderCostDecrease = (oldRenderCost - newRenderCost) / viewSpaceVol; 1567 1567 1568 #ifdef _DEBUG1568 #ifdef GTPGTP_DEBUG 1569 1569 Debug << "\nvsp render cost decrease" << endl 1570 1570 << "back pvs: " << pvsBack << " front pvs " << pvsFront << " total pvs: " << totalPvs << endl … … 1621 1621 const float oldCost = (float)pvsSize * pOverall + Limits::Small; 1622 1622 1623 #ifdef _DEBUG1623 #ifdef GTPGTP_DEBUG 1624 1624 Debug << "axis: " << axis << " " << pvsSize << " " << pvsBack << " " << pvsFront << endl; 1625 1625 Debug << "p: " << pFront << " " << pBack << " " << pOverall << endl; … … 1875 1875 ++ mCreatedViewCells; 1876 1876 1877 #ifdef _DEBUG1877 #ifdef GTPGTP_DEBUG 1878 1878 Debug << "BSP stats: " 1879 1879 << "Depth: " << data.mDepth << " (max: " << mTermMaxDepth << "), " -
GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.h
r1571 r1715 313 313 }; 314 314 315 /* 316 struct VssRayDistribution { 317 VssRayDistribution() { mContribution = -1.0f; } 318 SimpleRayContainer mRays; 319 vector<VssRayContainer> mVssRays; 320 float mContribution; 321 float mTime; 322 }; 323 324 struct VssRayDistributionMixture { 325 VssRayDistributionMixture() {} 326 327 vector<VssRayDistribution> distributions; 328 }; 329 */ 330 315 331 }; 316 332 -
GTP/trunk/Lib/Vis/Preprocessing/src/common.h
r1634 r1715 485 485 FileExists(char *filename); 486 486 487 #define GTP_DEBUG 0 488 487 489 #define DEBUG_LEVEL 5 488 490 //#define DEBUG_LEVEL 1000 -
GTP/trunk/Lib/Vis/Preprocessing/src/default.env
r1694 r1715 17 17 #filename ../data/vienna/city1500_flat_1.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d 18 18 #filename ../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d;../data/vienna/vienna-plane.x3d 19 filename ../data/vienna/vienna.obj 19 #filename ../data/vienna/vienna.obj 20 21 filename ../data/vienna/vienna-buildings_vienna-roofs_vienna-roads_vienna-plane_cropped.obj 20 22 21 23 # filename ../data/vienna/viewcells-25-sel.x3d … … 56 58 applyVisibilitySpatialFilter false 57 59 visibilityFilterWidth 0.01 58 exportVisibility true60 exportVisibility false 59 61 visibilityFile visibility.xml 60 62 loadMeshes false … … 79 81 RssPreprocessor { 80 82 samplesPerPass 1000 81 initialSamples 100000083 initialSamples 2000000 82 84 vssSamples 50000000 83 85 # vssSamples 1000000 84 vssSamplesPerPass 100000086 vssSamplesPerPass 2000000 85 87 useImportanceSampling true 86 88 … … 116 118 maxCostRatio 1.0 117 119 maxRayContribution 1.0 118 maxRays 4000000120 maxRays 3000000 119 121 maxTotalMemory 200 120 122 maxStaticMemory 100 … … 282 284 # filename ../data/vienna/viewcells_vienna2.xml 283 285 # filename ../data/vienna/vienna_simple-21-04-avs2-viewCells.xml 286 # filename ../data/vienna/vienna-viewcells-20000.xml.gz 284 287 # filename ../data/vienna/vienna-viewcells-5000.xml.gz 285 filename ../data/vienna/vienna-viewcells-1000.xml.zip288 # filename ../data/vienna/vienna-viewcells-1000.xml.zip 286 289 # filename ../data/vienna/vsposp-seq-viewCells.xml.gz 290 291 filename ../data/vienna/vienna_cropped-2-sequential-30000-viewcells.xml.gz 292 # filename ../data/vienna/vienna_cropped-sequential-400000-viewcells.xml.gz 293 287 294 288 295 # filename ../data/vienna/city1500_flat_viewcells-1000.xml -
GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
r1713 r1715 274 274 PreprocessorThread *pt; 275 275 276 276 277 #if USE_QT 278 // create a qt application first (must be created before any opengl widget ...) 279 QApplication *app = new QApplication(argc, NULL); 280 277 281 pt = new QtPreprocessorThread(preprocessor); 278 282 #else … … 300 304 if (!rendererWidget) 301 305 { 302 // create a qt application first (must be created before any opengl widget ...)303 QApplication *app = new QApplication(argc, NULL);304 306 305 307 if (!QGLFormat::hasOpenGL() || !QGLPixelBuffer::hasOpenGLPbuffers()) { -
GTP/trunk/Lib/Vis/Preprocessing/src/preprocessor.pro
r1694 r1715 17 17 NONGTP = ../../../../../../NonGTP 18 18 19 #win32:INCLUDEPATH += c:/STLport-4.6.2/stlport19 #win32:INCLUDEPATH += d:/STLport-4.6.2/stlport 20 20 21 21 CONFIG(qt) { … … 44 44 unix:LIBPATH += ../support/src/xerces-c-src_2_7_0/lib ../support/devil/lib /usr/lib/qt3/lib64 45 45 46 #win32:LIBPATH += c:/STLport-4.6.2/lib46 #win32:LIBPATH += d:/STLport-4.6.2/lib 47 47 48 48
Note: See TracChangeset
for help on using the changeset viewer.