- Timestamp:
- 05/19/08 02:43:25 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/gvs.env
r2682 r2687 36 36 37 37 # internal: 0 intel: 1 2: havran 3: havran dyn 38 rayCastMethod 238 rayCastMethod 1 39 39 40 40 exportVisibility false -
GTP/trunk/Lib/Vis/Preprocessing/scripts/run_demo_vienna
r2686 r2687 8 8 9 9 10 #SCENE=../data/vienna/vienna_cropped.obj11 SCENE=../data/vienna/city_full.obj10 SCENE=../data/vienna/vienna_cropped.obj 11 #SCENE=../data/vienna/city_full.obj 12 12 13 13 VIEWCELLS=../data/vienna/vienna_cropped-gradient-viewcells.xml.gz -
GTP/trunk/Lib/Vis/Preprocessing/scripts/run_gvs_vps.sh
r2682 r2687 11 11 echo "starting $TARGET version" 12 12 13 SCENE=../data/vienna/vienna_cropped.obj14 #SCENE=../data/vienna/city_full.obj13 #SCENE=../data/vienna/vienna_cropped.obj 14 SCENE=../data/vienna/city_full.obj 15 15 16 16 VIEWCELLS=../data/vienna/vienna_cropped-gradient-viewcells.xml.gz 17 VIEWPOINTS=../data/vienna/testwalk.vp 17 18 18 LOG_PREFIX=../src/SG08/rebut 19 #LOG_PREFIX=../src/SG08/vienna_cropped_100c 20 LOG_PREFIX=../src/SG08/city_full_100 21 19 22 ENVIRONMENT=gvs.env 20 23 … … 27 30 -scene_filename=$SCENE \ 28 31 -preprocessor=gvs \ 32 -preprocessor_use_vbos- \ 29 33 -gvs_epsilon=0.0001 \ 30 -gvs_total_samples=100000 \31 -gvs_samples_per_pass=100000 \34 -gvs_total_samples=1000000 \ 35 -gvs_samples_per_pass=1000000 \ 32 36 -gvs_initial_samples=16 \ 33 -gvs_max_viewcells= 1\34 -gvs_min_contribution= 50 \37 -gvs_max_viewcells=20 \ 38 -gvs_min_contribution=100 \ 35 39 -gvs_per_viewcell=true \ 36 40 -gvs_stats=$LOG_PREFIX-gvsStats.log \ … … 41 45 -preprocessor_visibility_file=$LOG_PREFIX-i-gvs-b1-n4l.xml \ 42 46 -preprocessor_stats=$LOG_PREFIX-i-gvs-b1-n4l.log \ 47 -view_cells_random_viewpoint_list=$VIEWPOINTS \ 43 48 -preprocessor_histogram_file=$LOG_PREFIX-i-gvs-b1-n4f.hlog 44 49 -
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r2686 r2687 1923 1923 "false"); 1924 1924 1925 RegisterOption("Preprocessor.useVbos", 1926 optBool, 1927 "preprocessor_use_vbos", 1928 "true"); 1929 1925 1930 RegisterOption("Preprocessor.quitOnFinish", 1926 1931 optBool, -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r2686 r2687 83 83 mData(NULL), 84 84 mIndices(NULL), 85 //mUseVbos(true),86 mUseVbos(false),87 85 mComputeGVS(false), 88 86 mCurrentFrame(100) … … 121 119 mViewPoint = Vector3(1038.7f, 192.4f, -471.0f); 122 120 mViewDirection = Vector3(-0.8f, 0.0f, -0.6f); 121 122 mViewPoint = Vector3(440.295, 196.959, -781.302); 123 mViewDirection = Vector3(-0.0566328, 0, -0.998395); 123 124 } 124 125 … … 136 137 //mUseGlLists = true; 137 138 mUseGlLists = false; 139 140 bool mUseVbos; 141 Environment::GetSingleton()->GetBoolValue("Preprocessor.useVbos", mUseVbos); 138 142 139 143 if (mViewCellsManager->GetViewCellPointsList()->size()) … … 1590 1594 for (sit = viewPoints.begin(); sit != sit_end; ++ sit, ++ i) 1591 1595 { 1592 if ((i % 100) == 99)1593 cout << "processed " << i << " view points " << endl;1594 1595 //cout << "\n\nvp: " << (*sit) << endl;1596 1596 SimpleRay sray = *sit; 1597 1597 1598 int pvsSize = -1; 1598 1599 … … 1623 1624 // drop the first frame (for some reason, the first frame yields wrong pixel error) 1624 1625 1625 if ( //(mFrame > 0) &&1626 (err >= -1e-6f) && (err < (1.0f - 1e-6f)) && (pvsSize != 0))1627 {1628 if ( err > mPvsStat.maxError)1626 if (pvsSize != 0) 1627 { 1628 // hack: test if error is suspiciously large 1629 if ((err >= -1e-6f) && (err < (1.0f - 1e-6f))) 1629 1630 { 1630 mPvsStat.maxError = err; 1631 cout << "new max error: " << mPvsStat.maxError * GetWidth() * GetHeight() << endl; 1631 if (err > mPvsStat.maxError) 1632 { 1633 mPvsStat.maxError = err; 1634 cout << "new max error: " << mPvsStat.maxError * GetWidth() * GetHeight() << endl; 1635 } 1636 1637 mPvsStat.sumError += err; 1638 mPvsStat.sumPvsSize += mPvsErrorBuffer[i].mPvsSize; 1639 1640 if (err == 0.0f) 1641 ++ mPvsStat.errorFreeFrames; 1642 1643 // $$ JB 1644 // moved it back here not to count frames with negative err (backfacing triangle) 1645 ++ mPvsStat.frames; 1646 1647 if ((mPvsStat.frames % 100) == 0) 1648 cout << "processed " << mPvsStat.frames << " valid view points " << endl; 1632 1649 } 1633 1634 mPvsStat.sumError += err; 1635 mPvsStat.sumPvsSize += mPvsErrorBuffer[i].mPvsSize; 1636 1637 if (err == 0.0f) 1638 ++ mPvsStat.errorFreeFrames; 1639 1640 // $$ JB 1641 // moved it back here not to count frames with negative err (backfacing triangle) 1642 ++ mPvsStat.frames; 1643 } 1644 else 1645 { 1646 cerr << "warning: negative error " << err << " at pvs size " << pvsSize << endl; 1647 } 1648 1650 else 1651 { 1652 cerr << "warning: strange error (" << err << "), pvs size " << pvsSize << endl; 1653 } 1654 } 1649 1655 } 1650 1656 … … 1703 1709 1704 1710 1711 // backfacing polygon found -> not a valid viewspace sample 1705 1712 if (pixelCount > 0) 1706 { 1707 return false; // backfacing polygon found -> not a valid viewspace sample 1708 } 1713 return false; 1714 1709 1715 return true; 1710 1716 } -
GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp
r2686 r2687 174 174 void GvsPreprocessor::CountObject(Intersectable *triObj) 175 175 { 176 if ((triObj->mCounter != (NOT_ACCOUNTED_OBJECT + 1)) && (triObj->mCounter != (ACCOUNTED_OBJECT + 1))) 176 if ((triObj->mCounter != (NOT_ACCOUNTED_OBJECT + 1)) && 177 (triObj->mCounter != (ACCOUNTED_OBJECT + 1))) 177 178 { 178 179 ++ triObj->mCounter; … … 486 487 //CLEAR_CONTAINER(invalidSamples); 487 488 488 //cout << " cast rays: " << castRays << endl;489 //cout << "here3 cast rays: " << castRays << endl; 489 490 return castRays; 490 491 } … … 658 659 int GvsPreprocessor::ProcessQueue() 659 660 { 661 ++ mGvsStats.mGvsPass; 662 660 663 int castSamples = 0; 661 ++ mGvsStats.mGvsPass;662 664 663 665 while (!mRayQueue.empty())//&& (mGvsStats.mTotalSamples + castSamples < mTotalSamples) ) 664 { 666 {//cout<<"r"; 665 667 //cout << "queue size: " << mRayQueue.size() << endl; 666 668 // handle next ray … … 671 673 672 674 castSamples += newSamples; 673 // delete ray;675 // note: don't have to delete because handled by ray pool 674 676 } 675 677 … … 814 816 815 817 if (!mOnlyRandomSampling) 816 newSamples += ProcessQueue(); 817 818 { 819 int samplesPerRun = ProcessQueue(); 820 newSamples += samplesPerRun; 821 //if (samplesPerRun > 0) cout << "spr: " << samplesPerRun << " "; 822 } 823 818 824 passSamples += newSamples; 819 825 mGvsStats.mPerViewCellSamples += newSamples; … … 847 853 848 854 849 void GvsPreprocessor::CompileViewCellsList() 850 { 855 void GvsPreprocessor::CompileViewCellsFromPointList() 856 { 857 ViewCell::NewMail(); 858 851 859 // Receive list of view cells from view cells manager 852 860 ViewCellPointsList *vcPoints = mViewCellsManager->GetViewCellPointsList(); 853 854 if (!vcPoints->empty())855 { 856 cout << "processing view cell list" << endl;857 858 vector<ViewCellPoints *>::const_iterator vit, vit_end = vcPoints->end();859 860 for (vit = vcPoints->begin(); vit != vit_end; ++ vit)861 862 vector<ViewCellPoints *>::const_iterator vit, vit_end = vcPoints->end(); 863 864 for (vit = vcPoints->begin(); vit != vit_end; ++ vit) 865 { 866 ViewCellPoints *vp = *vit; 867 868 if (vp->first) // view cell specified 861 869 { 862 mViewCells.push_back((*vit)->first); 863 864 if (mViewCells.size() >= mMaxViewCells) 865 break; 870 ViewCell *viewCell = vp->first; 871 872 if (!viewCell->Mailed()) 873 { 874 viewCell->Mail(); 875 mViewCells.push_back(viewCell); 876 877 if (mViewCells.size() >= mMaxViewCells) 878 break; 879 } 866 880 } 881 else // no view cell specified => compute view cells using view point 882 { 883 SimpleRayContainer::const_iterator rit, rit_end = vp->second.end(); 884 885 for (rit = vp->second.begin(); rit != rit_end; ++ rit) 886 { 887 SimpleRay ray = *rit; 888 889 ViewCell *viewCell = mViewCellsManager->GetViewCell(ray.mOrigin); 890 891 if (viewCell && !viewCell->Mailed()) 892 { 893 viewCell->Mail(); 894 mViewCells.push_back(viewCell); 895 896 if (mViewCells.size() >= mMaxViewCells) 897 break; 898 } 899 } 900 } 901 } 902 } 903 904 905 void GvsPreprocessor::CompileViewCellsList() 906 { 907 if (!mViewCellsManager->GetViewCellPointsList()->empty()) 908 { 909 cout << "processing view point list" << endl; 910 CompileViewCellsFromPointList(); 867 911 } 868 912 else 869 913 { 914 ViewCell::NewMail(); 915 870 916 while ((int)mViewCells.size() < mMaxViewCells) 871 917 { 872 if (0)873 {874 mViewCells.push_back(mViewCellsManager->GetViewCell((int)mViewCells.size()));875 continue;876 }877 878 // HACK879 918 const int tries = 10000; 880 919 int i = 0; … … 906 945 } 907 946 908 947 #if 0 909 948 void GvsPreprocessor::IntersectWithViewCell() 910 949 { … … 955 994 } 956 995 } 957 } 958 996 cout << "added " << mTrianglePvs.size() << " triangles (" << mCurrentViewCell->GetPvs().GetSize() << " objects) by intersection" << endl; 997 998 } 999 1000 #else 1001 1002 void GvsPreprocessor::IntersectWithViewCell() 1003 { 1004 //Intersectable::NewMail(); 1005 mCurrentViewCell->GetMesh()->ComputeBoundingBox(); 1006 AxisAlignedBox3 box = mCurrentViewCell->GetMesh()->mBox; 1007 1008 // compute pvs kd nodes that intersect view cell 1009 ObjectContainer kdobjects; 1010 mKdTree->CollectKdObjects(box, kdobjects); 1011 1012 ObjectContainer pvsKdObjects; 1013 1014 ObjectContainer::const_iterator oit, oit_end = kdobjects.end(); 1015 1016 for (oit = kdobjects.begin(); oit != oit_end; ++ oit) 1017 { 1018 KdIntersectable *kdInt = static_cast<KdIntersectable *>(*oit); 1019 1020 myobjects.clear(); 1021 mKdTree->CollectObjects(kdInt->GetItem(), myobjects); 1022 1023 // account for kd object pvs 1024 bool addkdobj = false; 1025 1026 ObjectContainer::const_iterator oit, oit_end = myobjects.end(); 1027 1028 for (oit = myobjects.begin(); oit != oit_end; ++ oit) 1029 { 1030 TriangleIntersectable *triObj = static_cast<TriangleIntersectable *>(*oit); 1031 1032 // the triangle itself intersects => add object 1033 if (box.Intersects(triObj->GetItem())) 1034 { 1035 if ((triObj->mCounter < ACCOUNTED_OBJECT)) 1036 { 1037 triObj->mCounter += ACCOUNTED_OBJECT; 1038 1039 mTrianglePvs.push_back(triObj); 1040 mGenericStats = (int)mTrianglePvs.size(); 1041 1042 addkdobj = true; 1043 } 1044 } 1045 } 1046 1047 // add node to object pvs 1048 if (addkdobj) 1049 pvsKdObjects.push_back(kdInt); 1050 } 1051 1052 // new mail because objects were mailed for kd tree search 1053 KdNode::NewMail(); 1054 1055 // now actually ADD new objects to object pvs 1056 oit_end = pvsKdObjects.end(); 1057 1058 for (oit = pvsKdObjects.begin(); oit != oit_end; ++ oit) 1059 { 1060 KdIntersectable *kdInt = static_cast<KdIntersectable *>(*oit); 1061 1062 kdInt->Mail(); 1063 1064 mCurrentViewCell->GetPvs().AddSampleDirty(kdInt, 1.0f); 1065 if (SHOW_QT_VISUALIZATION) UpdateStatsForVisualization(kdInt); 1066 } 1067 1068 cout << "added " << mTrianglePvs.size() << " triangles (" << (int)pvsKdObjects.size() << " objects) by intersection" << endl; 1069 } 1070 #endif 959 1071 960 1072 void GvsPreprocessor::PerViewCellComputation() … … 1147 1259 } 1148 1260 1149 cout << "cast " << 2 * mGvsStats.mTotalSamples / (1e3f * TimeDiff(startTime, GetTime())) << "Mrays/s" << endl;1261 cout << "cast " << mGvsStats.mTotalSamples / (1e3f * TimeDiff(startTime, GetTime())) << "M single rays/s" << endl; 1150 1262 1151 1263 if (GVS_DEBUG) … … 1216 1328 app << "#Id\n" << mViewCellId << endl; 1217 1329 app << "#Time\n" << mTimePerViewCell << endl;; 1218 app << "#Tria nglePvs\n" << mTrianglePvs << endl;1330 app << "#TriaePvs\n" << mTrianglePvs << endl; 1219 1331 app << "#ObjectPvs\n" << mPerViewCellPvs << endl; 1220 app << "# PvsCost\n" << (int)mPvsCost << endl;1332 app << "#UpdatedPvs\n" << (int)mPvsCost << endl; 1221 1333 1222 1334 app << "#PerViewCellSamples\n" << mPerViewCellSamples << endl; -
GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.h
r2677 r2687 13 13 class TriangleIntersectable; 14 14 class KdIntersectable; 15 15 16 16 17 /** View space partition statistics. … … 243 244 void CountObject(Intersectable *triObj); 244 245 246 void CompileViewCellsFromPointList(); 247 245 248 246 249 ////////////////////// -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2685 r2687 1192 1192 else 1193 1193 { 1194 cout << "setting ray pool size to samples per pass" << endl; 1195 reserveRays = mSamplesPerPass * 2; 1194 const int n = 4; 1195 cout << "hack: setting ray pool size to multiple " << n << " of samples per pass" << endl; 1196 reserveRays = mSamplesPerPass * n; 1196 1197 } 1197 1198 … … 1256 1257 #if SHOW_RAYCAST_TIMING 1257 1258 if (castDoubleRays) 1258 cout << 2 * rays.size() / (1e3f * TimeDiff(t1, t2)) << "M rays/s" << endl;1259 cout << 2 * rays.size() / (1e3f * TimeDiff(t1, t2)) << "M double rays/s" << endl; 1259 1260 else 1260 cout << rays.size() / (1e3f * TimeDiff(t1, t2)) << "M rays/s" << endl;1261 cout << rays.size() / (1e3f * TimeDiff(t1, t2)) << "M single rays/s" << endl; 1261 1262 #endif 1262 1263 1263 1264 } 1264 //cout << "numDummy: " << numTransformed << endl; 1265 //cerr<<"Determining PVS objects"<<endl; 1265 1266 1266 DeterminePvsObjects(vssRays); 1267 // cerr<<"done."<<endl;1268 1269 1267 } 1270 1268 -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2686 r2687 104 104 GlRendererBuffer(sceneGraph, viewcells, tree) 105 105 { 106 mUseVbos = true;107 //mUseVbos = false;108 109 106 //makeCurrent(); 110 107 MakeLive(); … … 267 264 pErrorPixels = (float)pixelCount / (GetWidth() * GetHeight()); 268 265 269 const int pixelThres = 100000;266 const int pixelThres = 0; 270 267 271 268 // some error happened … … 285 282 char filename[256]; 286 283 //sprintf(filename, "error-frame-%04d-%0.5f.png", mFrame, pErrorPixels); 287 sprintf(filename, "error-frame-%04d-%0 8d.png", mFrame, pixelCount);284 sprintf(filename, "error-frame-%04d-%04d-%08d.png", mFrame, viewcell->GetId(), pixelCount); 288 285 QImage im = toImage(); 289 286 string str = mSnapPrefix + filename; … … 292 289 im.save(qstr, "PNG"); 293 290 294 291 #if 0 295 292 /////////// 296 293 //-- output computed pvs 297 294 298 mUseFalseColors = false; 299 295 //mUseFalseColors = true; 300 296 glPushAttrib(GL_CURRENT_BIT); 301 297 glColor3f(0, 1, 0); … … 312 308 RenderPvs(pvs); 313 309 314 mUseForcedColors = false; 315 310 //mUseForcedColors = false; 316 311 im = toImage(); 317 312 sprintf(filename, "error-frame-%04d-%04d-%08d-pvs.png", mFrame, viewcell->GetId(), pixelCount); … … 321 316 322 317 glPopAttrib(); 318 #endif 323 319 } 324 320 } … … 575 571 if (viewcell) 576 572 { 577 #if 1578 573 // copy the pvs so that it can be filtered ... 579 574 if (PvsChanged(viewcell)) … … 607 602 mCurrentPvsCost = mPvsCache.mPvs.EvalPvsCost(); 608 603 } 609 #else610 611 // update the indices for rendering612 PreparePvs(viewcell->GetPvs());613 emit PvsUpdated();614 615 #endif616 604 617 605 // Render PVS … … 643 631 else 644 632 { 645 //OcclusionQuery *query = mOcclusionQueries[0];646 //query->BeginQuery();647 648 633 RenderScene(); 649 650 //query->EndQuery();651 //int pixels = query->GetQueryResult();652 //cout << " pixels: " << pixels;653 634 } 654 635
Note: See TracChangeset
for help on using the changeset viewer.