Changeset 1785 for GTP/trunk/Lib/Vis
- Timestamp:
- 11/23/06 21:38:45 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1784 r1785 118 118 BvhLeaf::BvhLeaf(const AxisAlignedBox3 &bbox): 119 119 BvhNode(bbox), 120 mSubdivisionCandidate(NULL) 121 { 122 mActiveNode = this; 120 mSubdivisionCandidate(NULL), 121 mGlList(0) 122 { 123 mActiveNode = this; 123 124 } 124 125 125 126 126 127 BvhLeaf::BvhLeaf(const AxisAlignedBox3 &bbox, BvhInterior *parent): 127 BvhNode(bbox, parent) 128 BvhNode(bbox, parent), 129 mGlList(0) 130 128 131 { 129 132 mActiveNode = this; … … 134 137 BvhInterior *parent, 135 138 const int numObjects): 136 BvhNode(bbox, parent) 139 BvhNode(bbox, parent), 140 mGlList(0) 141 137 142 { 138 143 mObjects.reserve(numObjects); … … 295 300 Environment::GetSingleton()->GetIntValue("BvHierarchy.minRaysForVisibility", mMinRaysForVisibility); 296 301 Environment::GetSingleton()->GetIntValue("BvHierarchy.maxTests", mMaxTests); 297 Environment::GetSingleton()->GetBoolValue("BvHierarchy.Construction.useInitialSubdivision", mApplyInitialPartition);302 // Environment::GetSingleton()->GetBoolValue("BvHierarchy.Construction.useInitialSubdivision", mApplyInitialPartition); 298 303 299 304 mInitialObjectsSize = 50; -
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h
r1784 r1785 327 327 */ 328 328 BvhLeaf(const AxisAlignedBox3 &bbox); 329 329 BvhLeaf(const AxisAlignedBox3 &bbox, BvhInterior *parent); 330 330 BvhLeaf(const AxisAlignedBox3 &bbox, BvhInterior *parent, const int numObjects); 331 331 … … 363 363 364 364 public: 365 366 /// objects 367 ObjectContainer mObjects; 368 365 // gl list use to store the geometry on the gl server 366 int mGlList; 367 368 /// objects 369 ObjectContainer mObjects; 370 369 371 protected: 370 371 372 373 374 375 372 373 /// pointer to a split plane candidate splitting this leaf 374 SubdivisionCandidate *mSubdivisionCandidate; 375 376 /// the active node which will be accounted for in the pvs 377 BvhNode *mActiveNode; 376 378 }; 377 379 -
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r1784 r1785 1228 1228 "true"); 1229 1229 1230 1230 1231 RegisterOption("VssPreprocessor.enlargeViewSpace", 1231 1232 optBool, … … 1725 1726 "true"); 1726 1727 1728 RegisterOption("Preprocessor.evaluateFilter", 1729 optBool, 1730 "preprocessor_evaluate_filter", 1731 "false"); 1732 1727 1733 RegisterOption("Preprocessor.delayVisibilityComputation", 1728 1734 optBool, … … 1891 1897 optBool, 1892 1898 "rss_use_importance", 1899 "true"); 1900 1901 RegisterOption("RssPreprocessor.useRssTree", 1902 optBool, 1903 "rss_use_rss_tree", 1893 1904 "true"); 1894 1905 -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r1758 r1785 25 25 static bool nvQuerySupport = false; 26 26 27 GLuint frontDepthMap; 28 GLuint backDepthMap; 29 30 const int depthMapSize = 512; 27 31 28 32 static void InitExtensions() … … 80 84 mUseForcedColors = false; 81 85 mRenderBoxes = false; 82 mUseGlLists = true;83 //mUseGlLists = false;86 // mUseGlLists = true; 87 mUseGlLists = false; 84 88 } 85 89 … … 133 137 case Intersectable::BVH_INTERSECTABLE: { 134 138 135 136 139 BvhNode *node = dynamic_cast<BvhNode *>(object); 140 137 141 if (mRenderBoxes) 138 142 RenderBox(node->GetBoundingBox()); … … 143 147 case Intersectable::KD_INTERSECTABLE: { 144 148 KdNode *node = (dynamic_cast<KdIntersectable *>(object))->GetItem(); 145 149 146 150 if (mRenderBoxes) 147 151 RenderBox(mKdTree->GetBox(node)); … … 293 297 glLoadIdentity(); 294 298 299 glFrontFace(GL_CCW); 300 glCullFace(GL_BACK); 295 301 glEnable(GL_CULL_FACE); 296 302 glShadeModel(GL_FLAT); … … 402 408 GlRenderer::RenderScene() 403 409 { 410 Intersectable::NewMail(); 404 411 static int glList = -1; 405 412 if (mUseGlLists) { … … 459 466 GlRenderer(sceneGraph, viewcells, tree) 460 467 { 461 mPixelBuffer = NULL; 462 463 // implement width and height in subclasses 468 Environment::GetSingleton()->GetIntValue("Preprocessor.pvsRenderErrorSamples", mPvsStatFrames); 469 mPvsErrorBuffer.resize(mPvsStatFrames); 470 ClearErrorBuffer(); 471 472 mPixelBuffer = NULL; 473 474 // implement width and height in subclasses 464 475 } 465 476 … … 647 658 if (node->IsLeaf()) { 648 659 BvhLeaf *leaf = (BvhLeaf *) node; 649 for (int i=0; i < leaf->mObjects.size(); i++) 650 RenderIntersectable(leaf->mObjects[i]); 660 661 #if 0 662 if (leaf->mGlList == 0) { 663 leaf->mGlList = glGenLists(1); 664 if (leaf->mGlList != 0) 665 glNewList(leaf->mGlList, GL_COMPILE); 666 667 for (int i=0; i < leaf->mObjects.size(); i++) 668 RenderIntersectable(leaf->mObjects[i]); 669 670 if (leaf->mGlList != 0) 671 glEndList(); 672 } 673 674 if (leaf->mGlList != 0) 675 glCallList(leaf->mGlList); 676 #else 677 for (int i=0; i < leaf->mObjects.size(); i++) 678 RenderIntersectable(leaf->mObjects[i]); 679 #endif 651 680 } else { 652 681 BvhInterior *in = (BvhInterior *)node; … … 675 704 } 676 705 677 } 706 707 708 709 710 711 712 void 713 GlRendererBuffer::EvalRenderCostSample(RenderCostSample &sample, 714 const bool useOcclusionQueries, 715 const int threshold 716 ) 717 { 718 // choose a random view point 719 mViewCellsManager->GetViewPoint(mViewPoint); 720 sample.mPosition = mViewPoint; 721 //cout << "viewpoint: " << mViewPoint << endl; 722 723 // take a render cost sample by rendering a cube 724 Vector3 directions[6]; 725 726 directions[0] = Vector3(1,0,0); 727 directions[1] = Vector3(0,1,0); 728 directions[2] = Vector3(0,0,1); 729 directions[3] = Vector3(-1,0,0); 730 directions[4] = Vector3(0,-1,0); 731 directions[5] = Vector3(0,0,-1); 732 733 sample.mVisibleObjects = 0; 734 735 // reset object counters 736 ObjectContainer::const_iterator it, it_end = mObjects.end(); 737 738 for (it = mObjects.begin(); it != it_end; ++ it) 739 { 740 (*it)->mCounter = 0; 741 } 742 743 ++ mFrame; 744 745 //glCullFace(GL_FRONT); 746 glCullFace(GL_BACK); 747 glDisable(GL_CULL_FACE); 748 749 750 // query all 6 directions for a full point sample 751 for (int i = 0; i < 6; ++ i) 752 { 753 mViewDirection = directions[i]; 754 SetupCamera(); 755 756 glClearColor(1.0f, 1.0f, 1.0f, 1.0f); 757 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 758 //glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glDepthMask(GL_TRUE); 759 glDepthFunc(GL_LESS); 760 761 mUseFalseColors = true; 762 763 // the actual scene rendering fills the depth (for occlusion queries) 764 // and the frame buffer (for item buffer) 765 RenderScene(); 766 767 768 if (0) 769 { 770 char filename[256]; 771 sprintf(filename, "snap/frame-%04d-%d.png", mFrame, i); 772 // QImage im = toImage(); 773 // im.save(filename, "PNG"); 774 } 775 776 // evaluate the sample 777 if (useOcclusionQueries) 778 { 779 EvalQueryWithOcclusionQueries(); 780 } 781 else 782 { 783 EvalQueryWithItemBuffer(); 784 } 785 } 786 787 // now evaluate the statistics over that sample 788 // currently only the number of visible objects is taken into account 789 sample.Reset(); 790 791 for (it = mObjects.begin(); it != it_end; ++ it) 792 { 793 Intersectable *obj = *it; 794 if (obj->mCounter >= threshold) 795 { 796 ++ sample.mVisibleObjects; 797 sample.mVisiblePixels += obj->mCounter; 798 } 799 } 800 801 //cout << "RS=" << sample.mVisibleObjects << " "; 802 } 803 804 805 GlRendererBuffer::~GlRendererBuffer() 806 { 807 #if USE_CG 808 if (sCgFragmentProgram) 809 cgDestroyProgram(sCgFragmentProgram); 810 if (sCgContext) 811 cgDestroyContext(sCgContext); 812 #endif 813 } 814 815 816 void 817 GlRendererBuffer::SampleRenderCost(const int numSamples, 818 vector<RenderCostSample> &samples, 819 const bool useOcclusionQueries, 820 const int threshold 821 ) 822 { 823 MakeCurrent(); 824 825 if (mPixelBuffer == NULL) 826 mPixelBuffer = new unsigned int[GetWidth()*GetHeight()]; 827 828 // using 90 degree projection to capture 360 view with 6 samples 829 SetupProjection(GetHeight(), GetHeight(), 90.0f); 830 831 //samples.resize(numSamples); 832 halton.Reset(); 833 834 // the number of queries queried in batch mode 835 const int numQ = 500; 836 837 //const int numQ = (int)mObjects.size(); 838 if (useOcclusionQueries) 839 { 840 cout << "\ngenerating " << numQ << " queries ... "; 841 OcclusionQuery::GenQueries(mOcclusionQueries, numQ); 842 cout << "finished" << endl; 843 } 844 845 // sampling queries 846 for (int i = 0; i < numSamples; ++ i) 847 { 848 cout << "."; 849 EvalRenderCostSample(samples[i], useOcclusionQueries, threshold); 850 } 851 852 DoneCurrent(); 853 } 854 855 856 857 858 859 void 860 GlRendererBuffer::ClearErrorBuffer() 861 { 862 for (int i=0; i < mPvsStatFrames; i++) { 863 mPvsErrorBuffer[i].mError = 1.0f; 864 } 865 } 866 867 868 void 869 GlRendererBuffer::EvalPvsStat() 870 { 871 mPvsStat.Reset(); 872 halton.Reset(); 873 874 MakeCurrent(); 875 876 SetupProjection(GetWidth(), GetHeight()); 877 878 cout<<"mPvsStatFrames="<<mPvsStatFrames<<endl; 879 880 for (int i=0; i < mPvsStatFrames; i++) { 881 float err; 882 // set frame id for saving the error buffer 883 mFrame = i; 884 RandomViewPoint(); 885 886 // atlanta problematic frames: 325 525 691 1543 887 #if 0 888 if (mFrame != 325 && 889 mFrame != 525 && 890 mFrame != 691 && 891 mFrame != 1543) 892 mPvsErrorBuffer[i] = -1; 893 else { 894 Debug<<"frame ="<<mFrame<<" vp="<<mViewPoint<<" vd="<<mViewDirection<<endl; 895 } 896 #endif 897 898 if (mPvsErrorBuffer[i].mError > 0.0f) { 899 int pvsSize; 900 901 902 float error = GetPixelError(pvsSize); 903 mPvsErrorBuffer[i].mError = error; 904 mPvsErrorBuffer[i].mPvsSize = pvsSize; 905 906 // emit UpdatePvsErrorItem(i, 907 // mPvsErrorBuffer[i]); 908 909 cout<<"("<<i<<","<<mPvsErrorBuffer[i].mError<<")"; 910 // swapBuffers(); 911 } 912 913 err = mPvsErrorBuffer[i].mError; 914 915 if (err >= 0.0f) { 916 if (err > mPvsStat.maxError) 917 mPvsStat.maxError = err; 918 mPvsStat.sumError += err; 919 mPvsStat.sumPvsSize += mPvsErrorBuffer[i].mPvsSize; 920 921 if (err == 0.0f) 922 mPvsStat.errorFreeFrames++; 923 mPvsStat.frames++; 924 } 925 } 926 927 glFinish(); 928 DoneCurrent(); 929 930 cout<<endl<<flush; 931 // mRenderingFinished.wakeAll(); 932 } 933 934 935 936 937 938 939 940 void GlRendererBuffer::SampleBeamContributions(Intersectable *sourceObject, 941 Beam &beam, 942 const int desiredSamples, 943 BeamSampleStatistics &stat) 944 { 945 // TODO: should be moved out of here (not to be done every time) 946 // only back faces are interesting for the depth pass 947 glShadeModel(GL_FLAT); 948 glDisable(GL_LIGHTING); 949 950 // needed to kill the fragments for the front buffer 951 glEnable(GL_ALPHA_TEST); 952 glAlphaFunc(GL_GREATER, 0); 953 954 // assumes that the beam is constructed and contains kd-tree nodes 955 // and viewcells which it intersects 956 957 958 // Get the number of viewpoints to be sampled 959 // Now it is a sqrt but in general a wiser decision could be made. 960 // The less viewpoints the better for rendering performance, since less passes 961 // over the beam is needed. 962 // The viewpoints could actually be generated outside of the bounding box which 963 // would distribute the 'efective viewpoints' of the object surface and thus 964 // with a few viewpoints better sample the viewpoint space.... 965 966 //TODO: comment in 967 //int viewPointSamples = sqrt((float)desiredSamples); 968 int viewPointSamples = max(desiredSamples / (GetWidth() * GetHeight()), 1); 969 970 // the number of direction samples per pass is given by the number of viewpoints 971 int directionalSamples = desiredSamples / viewPointSamples; 972 973 Debug << "directional samples: " << directionalSamples << endl; 974 for (int i = 0; i < viewPointSamples; ++ i) 975 { 976 Vector3 viewPoint = beam.mBox.GetRandomPoint(); 977 978 // perhaps the viewpoint should be shifted back a little bit so that it always lies 979 // inside the source object 980 // 'ideally' the viewpoints would be distributed on the soureObject surface, but this 981 // would require more complicated sampling (perhaps hierarchical rejection sampling of 982 // the object surface is an option here - only the mesh faces which are inside the box 983 // are considered as candidates) 984 985 SampleViewpointContributions(sourceObject, 986 viewPoint, 987 beam, 988 directionalSamples, 989 stat); 990 } 991 992 993 // note: 994 // this routine would be called only if the number of desired samples is sufficiently 995 // large - for other rss tree cells the cpu based sampling is perhaps more efficient 996 // distributing the work between cpu and gpu would also allow us to place more sophisticated 997 // sample distributions (silhouette ones) using the cpu and the jittered once on the GPU 998 // in order that thios scheme is working well the gpu render buffer should run in a separate 999 // thread than the cpu sampler, which would not be such a big problem.... 1000 1001 // disable alpha test again 1002 glDisable(GL_ALPHA_TEST); 1003 } 1004 1005 1006 1007 void GlRendererBuffer::SampleViewpointContributions(Intersectable *sourceObject, 1008 const Vector3 viewPoint, 1009 Beam &beam, 1010 const int samples, 1011 BeamSampleStatistics &stat) 1012 { 1013 // 1. setup the view port to match the desired samples 1014 glViewport(0, 0, samples, samples); 1015 1016 // 2. setup the projection matrix and view matrix to match the viewpoint + beam.mDirBox 1017 SetupProjectionForViewPoint(viewPoint, beam, sourceObject); 1018 1019 1020 // 3. reset z-buffer to 0 and render the source object for the beam 1021 // with glCullFace(Enabled) and glFrontFace(GL_CW) 1022 // save result to the front depth map 1023 // the front depth map holds ray origins 1024 1025 1026 // front depth buffer must be initialised to 0 1027 float clearDepth; 1028 1029 glGetFloatv(GL_DEPTH_CLEAR_VALUE, &clearDepth); 1030 glClearDepth(0.0f); 1031 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 1032 1033 1034 // glFrontFace(GL_CCW); 1035 glEnable(GL_CULL_FACE); 1036 glCullFace(GL_FRONT); 1037 glColorMask(0, 0, 0, 0); 1038 1039 1040 // stencil is increased where the source object is located 1041 glEnable(GL_STENCIL_TEST); 1042 glStencilFunc(GL_ALWAYS, 0x1, 0x1); 1043 glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); 1044 1045 1046 #if 0 1047 static int glSourceObjList = -1; 1048 if (glSourceObjList != -1) 1049 { 1050 glSourceObjList = glGenLists(1); 1051 glNewList(glSourceObjList, GL_COMPILE); 1052 1053 RenderIntersectable(sourceObject); 1054 1055 glEndList(); 1056 } 1057 glCallList(glSourceObjList); 1058 1059 #else 1060 RenderIntersectable(sourceObject); 1061 1062 #endif 1063 1064 // copy contents of the front depth buffer into depth texture 1065 glBindTexture(GL_TEXTURE_2D, frontDepthMap); 1066 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, depthMapSize, depthMapSize); 1067 1068 1069 // reset clear function 1070 glClearDepth(clearDepth); 1071 1072 1073 1074 // 4. set up the termination depth buffer (= standard depth buffer) 1075 // only rays which have non-zero entry in the origin buffer are valid since 1076 // they realy start on the object surface (this is tagged by setting a 1077 // stencil buffer bit at step 3). 1078 1079 glStencilFunc(GL_EQUAL, 0x1, 0x1); 1080 glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); 1081 1082 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 1083 glDepthMask(1); 1084 1085 glEnable(GL_DEPTH_TEST); 1086 1087 glEnable(GL_CULL_FACE); 1088 glCullFace(GL_BACK); 1089 1090 // setup front depth buffer 1091 glEnable(GL_TEXTURE_2D); 1092 1093 #if USE_CG 1094 // bind pixel shader implementing the front depth buffer functionality 1095 cgGLBindProgram(sCgFragmentProgram); 1096 cgGLEnableProfile(sCgFragmentProfile); 1097 #endif 1098 1099 // 5. render all objects inside the beam 1100 // we can use id based false color to read them back for gaining the pvs 1101 1102 glColorMask(1, 1, 1, 1); 1103 1104 1105 // if objects not stored in beam => extract objects 1106 if (beam.mFlags & !Beam::STORE_OBJECTS) 1107 { 1108 vector<KdNode *>::const_iterator it, it_end = beam.mKdNodes.end(); 1109 1110 Intersectable::NewMail(); 1111 for (it = beam.mKdNodes.begin(); it != it_end; ++ it) 1112 { 1113 mKdTree->CollectObjects(*it, beam.mObjects); 1114 } 1115 } 1116 1117 1118 // (objects can be compiled to a gl list now so that subsequent rendering for 1119 // this beam is fast - the same hold for step 3) 1120 // Afterwards we have two depth buffers defining the ray origin and termination 1121 1122 1123 #if 0 1124 static int glObjList = -1; 1125 if (glObjList != -1) 1126 { 1127 glObjList = glGenLists(1); 1128 glNewList(glObjList, GL_COMPILE); 1129 1130 ObjectContainer::const_iterator it, it_end = beam.mObjects.end(); 1131 for (it = beam.mObjects.begin(); it != it_end; ++ it) 1132 { 1133 // render all objects except the source object 1134 if (*it != sourceObject) 1135 RenderIntersectable(*it); 1136 } 1137 1138 glEndList(); 1139 } 1140 1141 glCallList(glObjList); 1142 #else 1143 ObjectContainer::const_iterator it, it_end = beam.mObjects.end(); 1144 for (it = beam.mObjects.begin(); it != it_end; ++ it) 1145 { 1146 // render all objects except the source object 1147 if (*it != sourceObject) 1148 RenderIntersectable(*it); 1149 } 1150 #endif 1151 1152 1153 1154 // 6. Use occlusion queries for all viewcell meshes associated with the beam -> 1155 // a fragment passes if the corresponding stencil fragment is set and its depth is 1156 // between origin and termination buffer 1157 1158 // create new queries if necessary 1159 OcclusionQuery::GenQueries(mOcclusionQueries, (int)beam.mViewCells.size()); 1160 1161 // check whether any backfacing polygon would pass the depth test? 1162 // matt: should check both back /front facing because of dual depth buffer 1163 // and danger of cutting the near plane with front facing polys. 1164 1165 glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); 1166 glDepthMask(GL_FALSE); 1167 glDisable(GL_CULL_FACE); 1168 1169 1170 ViewCellContainer::const_iterator vit, vit_end = beam.mViewCells.end(); 1171 1172 int queryIdx = 0; 1173 1174 for (vit = beam.mViewCells.begin(); vit != vit_end; ++ vit) 1175 { 1176 mOcclusionQueries[queryIdx ++]->BeginQuery(); 1177 1178 RenderIntersectable(*vit); 1179 1180 mOcclusionQueries[queryIdx]->EndQuery(); 1181 1182 ++ queryIdx; 1183 } 1184 1185 1186 1187 // at this point, if possible, go and do some other computation 1188 1189 1190 1191 // 7. The number of visible pixels is the number of sample rays which see the source 1192 // object from the corresponding viewcell -> remember these values for later update 1193 // of the viewcell pvs - or update immediately? 1194 1195 queryIdx = 0; 1196 1197 for (vit = beam.mViewCells.begin(); vit != vit_end; ++ vit) 1198 { 1199 // fetch queries 1200 unsigned int pixelCount = mOcclusionQueries[queryIdx ++]->GetQueryResult(); 1201 1202 if (pixelCount) 1203 Debug << "view cell " << (*vit)->GetId() << " visible pixels: " << pixelCount << endl; 1204 } 1205 1206 1207 // 8. Copmpute rendering statistics 1208 // In general it is not neccessary to remember to extract all the rays cast. I hope it 1209 // would be sufficient to gain only the intergral statistics about the new contributions 1210 // and so the rss tree would actually store no new rays (only the initial ones) 1211 // the subdivision of the tree would only be driven by the statistics (the glrender could 1212 // evaluate the contribution entropy for example) 1213 // However might be an option to extract/store only those the rays which made a contribution 1214 // (new viewcell has been discovered) or relative contribution greater than a threshold ... 1215 1216 ObjectContainer pvsObj; 1217 stat.pvsSize = ComputePvs(beam.mObjects, pvsObj); 1218 1219 // to gain ray source and termination 1220 // copy contents of ray termination buffer into depth texture 1221 // and compare with ray source buffer 1222 #if 0 1223 VssRayContainer rays; 1224 1225 glBindTexture(GL_TEXTURE_2D, backDepthMap); 1226 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, depthMapSize, depthMapSize); 1227 1228 ComputeRays(Intersectable *sourceObj, rays); 1229 1230 #endif 1231 1232 1233 1234 //-- cleanup 1235 1236 1237 // reset gl state 1238 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 1239 glDepthMask(GL_TRUE); 1240 glEnable(GL_CULL_FACE); 1241 glDisable(GL_STENCIL_TEST); 1242 #if USE_CG 1243 cgGLDisableProfile(sCgFragmentProfile); 1244 #endif 1245 glDisable(GL_TEXTURE_2D); 1246 1247 // remove objects from beam 1248 if (beam.mFlags & !Beam::STORE_OBJECTS) 1249 beam.mObjects.clear(); 1250 } 1251 1252 1253 void GlRendererBuffer::SetupProjectionForViewPoint(const Vector3 &viewPoint, 1254 const Beam &beam, 1255 Intersectable *sourceObject) 1256 { 1257 float left, right, bottom, top, znear, zfar; 1258 1259 beam.ComputePerspectiveFrustum(left, right, bottom, top, znear, zfar, 1260 mSceneGraph->GetBox()); 1261 1262 //Debug << left << " " << right << " " << bottom << " " << top << " " << znear << " " << zfar << endl; 1263 glMatrixMode(GL_PROJECTION); 1264 glLoadIdentity(); 1265 glFrustum(left, right, bottom, top, znear, zfar); 1266 //glFrustum(-1, 1, -1, 1, 1, 20000); 1267 1268 const Vector3 center = viewPoint + beam.GetMainDirection() * (zfar - znear) * 0.3f; 1269 const Vector3 up = 1270 Normalize(CrossProd(beam.mPlanes[0].mNormal, beam.mPlanes[4].mNormal)); 1271 1272 #ifdef GTP_DEBUG 1273 Debug << "view point: " << viewPoint << endl; 1274 Debug << "eye: " << center << endl; 1275 Debug << "up: " << up << endl; 1276 #endif 1277 1278 glMatrixMode(GL_MODELVIEW); 1279 glLoadIdentity(); 1280 gluLookAt(viewPoint.x, viewPoint.y, viewPoint.z, 1281 center.x, center.y, center.z, 1282 up.x, up.y, up.z); 1283 } 1284 1285 1286 void GlRendererBuffer::InitGL() 1287 { 1288 MakeCurrent(); 1289 GlRenderer::InitGL(); 1290 1291 #if 1 1292 // initialise dual depth buffer textures 1293 glGenTextures(1, &frontDepthMap); 1294 glBindTexture(GL_TEXTURE_2D, frontDepthMap); 1295 1296 glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, depthMapSize, 1297 depthMapSize, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL); 1298 1299 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 1300 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 1301 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); 1302 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); 1303 1304 glGenTextures(1, &backDepthMap); 1305 glBindTexture(GL_TEXTURE_2D, backDepthMap); 1306 1307 glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, depthMapSize, 1308 depthMapSize, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL); 1309 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 1310 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 1311 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); 1312 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); 1313 1314 1315 #if USE_CG 1316 // cg initialization 1317 cgSetErrorCallback(handleCgError); 1318 sCgContext = cgCreateContext(); 1319 1320 if (cgGLIsProfileSupported(CG_PROFILE_ARBFP1)) 1321 sCgFragmentProfile = CG_PROFILE_ARBFP1; 1322 else 1323 { 1324 // try FP30 1325 if (cgGLIsProfileSupported(CG_PROFILE_FP30)) 1326 sCgFragmentProfile = CG_PROFILE_FP30; 1327 else 1328 { 1329 Debug << "Neither arbfp1 or fp30 fragment profiles supported on this system" << endl; 1330 exit(1); 1331 } 1332 } 1333 1334 sCgFragmentProgram = cgCreateProgramFromFile(sCgContext, 1335 CG_SOURCE, "../src/dual_depth.cg", 1336 sCgFragmentProfile, 1337 NULL, 1338 NULL); 1339 1340 if (!cgIsProgramCompiled(sCgFragmentProgram)) 1341 cgCompileProgram(sCgFragmentProgram); 1342 1343 cgGLLoadProgram(sCgFragmentProgram); 1344 cgGLBindProgram(sCgFragmentProgram); 1345 1346 Debug << "---- PROGRAM BEGIN ----\n" << 1347 cgGetProgramString(sCgFragmentProgram, CG_COMPILED_PROGRAM) << "---- PROGRAM END ----\n"; 1348 1349 #endif 1350 1351 #endif 1352 DoneCurrent(); 1353 } 1354 1355 1356 void GlRendererBuffer::ComputeRays(Intersectable *sourceObj, VssRayContainer &rays) 1357 { 1358 for (int i = 0; i < depthMapSize * depthMapSize; ++ i) 1359 { 1360 //todo glGetTexImage() 1361 } 1362 } 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 } -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h
r1608 r1785 190 190 KdTree *tree); 191 191 192 virtual ~GlRendererBuffer(); 192 193 193 194 /** Evaluates render cost of a point sample. … … 196 197 @param threshold number of pixels / samples from where an object is considered visible. 197 198 */ 198 199 virtual void EvalRenderCostSample(RenderCostSample &sample, 199 200 const bool useOcclusionQueries, 200 201 const int threshold); … … 208 209 @param threshold number of pixels / samples from where an object is considered visible. 209 210 */ 210 211 212 213 const int threshold = 0)214 {} 211 virtual void SampleRenderCost(const int numSamples, 212 vector<RenderCostSample> &samples, 213 const bool useOcclusionQueries, 214 const int threshold = 0); 215 215 216 216 217 /** Implerment in subclasses. 217 218 */ 218 void EvalPvsStat() {}; 219 220 void ClearErrorBuffer(); 221 222 223 virtual int GetWidth() const { return 0; } 224 virtual int GetHeight() const { return 0; } 225 226 227 void RandomViewPoint(); 228 void SampleBeamContributions( 219 virtual void EvalPvsStat(); 220 221 virtual void ClearErrorBuffer(); 222 223 224 virtual int GetWidth() const = 0; 225 virtual int GetHeight() const = 0; 226 227 virtual void MakeCurrent() = 0; 228 virtual void DoneCurrent() = 0; 229 230 231 virtual void RandomViewPoint(); 232 virtual void SampleBeamContributions( 229 233 Intersectable *sourceObject, 230 234 Beam &beam, … … 233 237 ); 234 238 235 v oid239 virtual void 236 240 SampleViewpointContributions( 237 241 Intersectable *sourceObject, … … 242 246 ); 243 247 244 v oid InitGL();248 virtual void InitGL(); 245 249 246 250 /** Computes rays from information gained with hw sampling- 247 251 */ 248 v oid ComputeRays(Intersectable *sourceObj, VssRayContainer &rays);249 250 int ComputePvs() const;251 252 float253 GetPixelError(int &pvsSize) ;254 255 int ComputePvs(ObjectContainer &objects, ObjectContainer &pvs) const;256 252 virtual void ComputeRays(Intersectable *sourceObj, VssRayContainer &rays); 253 254 virtual int ComputePvs() const = 0; 255 256 virtual float 257 GetPixelError(int &pvsSize) = 0; 258 259 virtual int ComputePvs(ObjectContainer &objects, ObjectContainer &pvs) const = 0; 260 257 261 PvsRenderStatistics mPvsStat; 258 262 … … 270 274 271 275 protected: 272 273 274 276 unsigned int *mPixelBuffer; 277 278 static void GenQueries(const int numQueries); 275 279 276 280 virtual void SetupProjectionForViewPoint(const Vector3 &viewPoint, 277 281 const Beam &beam, 278 282 … … 281 285 /** Evaluates query for one direction using item buffer. 282 286 */ 283 287 virtual void EvalQueryWithItemBuffer(); 284 288 285 289 /** Evaluates query for one direction using occlusion queries. 286 290 */ 287 291 virtual void EvalQueryWithOcclusionQueries(); 288 292 289 293 public: -
GTP/trunk/Lib/Vis/Preprocessing/src/Makefile
r1761 r1785 1 1 ############################################################################# 2 2 # Makefile for building: preprocessor 3 # Generated by qmake (2.00a) (Qt 4.1.2) on: Thu Nov 16 14:37:0020063 # Generated by qmake (2.00a) (Qt 4.1.2) on: ?t 23. XI 14:54:07 2006 4 4 # Project: preprocessor.pro 5 5 # Template: app -
GTP/trunk/Lib/Vis/Preprocessing/src/OcclusionQuery.cpp
r1145 r1785 8 8 namespace GtpVisibilityPreprocessor { 9 9 10 bool OcclusionQuery::sUseArbQueries = true;10 bool OcclusionQuery::sUseArbQueries = false; 11 11 12 12 -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r1779 r1785 138 138 // renderer will be constructed when the scene graph and viewcell manager will be known 139 139 renderer = NULL; 140 140 141 141 Environment::GetSingleton()->GetBoolValue("Preprocessor.delayVisibilityComputation", 142 142 mDelayVisibilityComputation); … … 705 705 mViewCellsManager->SetRenderer(mRenderSimulator); 706 706 707 if (mUseGlRenderer || mUseGlDebugger) 708 { 709 // NOTE: render texture should be power of 2 and square 710 // renderer must be initialised 711 // $$matt 712 // renderer = new GlRendererBuffer(1024, 768, mSceneGraph, mViewCellsManager, mKdTree); 713 // renderer->makeCurrent(); 714 715 } 716 707 717 708 mViewCellsManager->SetPreprocessor(this); 718 709 return true; -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h
r1771 r1785 204 204 ofstream mStats; 205 205 206 GlRendererBuffer *renderer; 207 206 208 protected: 207 209 … … 233 235 vector<FaceParentInfo> mFaceParents; 234 236 235 GlRendererBuffer *renderer;236 237 237 238 /// if box around view space should be used -
GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer.cpp
r1757 r1785 35 35 static CGprofile sCgFragmentProfile; 36 36 37 GLuint frontDepthMap;38 GLuint backDepthMap;39 40 const int depthMapSize = 512;41 37 42 38 //static vector<OcclusionQuery *> sQueries; … … 60 56 61 57 void 62 QtGlRendererBuffer::EvalRenderCostSample(RenderCostSample &sample, 63 const bool useOcclusionQueries, 64 const int threshold 65 ) 66 { 67 // choose a random view point 68 mViewCellsManager->GetViewPoint(mViewPoint); 69 sample.mPosition = mViewPoint; 70 //cout << "viewpoint: " << mViewPoint << endl; 71 72 // take a render cost sample by rendering a cube 73 Vector3 directions[6]; 74 75 directions[0] = Vector3(1,0,0); 76 directions[1] = Vector3(0,1,0); 77 directions[2] = Vector3(0,0,1); 78 directions[3] = Vector3(-1,0,0); 79 directions[4] = Vector3(0,-1,0); 80 directions[5] = Vector3(0,0,-1); 81 82 sample.mVisibleObjects = 0; 83 84 // reset object counters 85 ObjectContainer::const_iterator it, it_end = mObjects.end(); 86 87 for (it = mObjects.begin(); it != it_end; ++ it) 88 { 89 (*it)->mCounter = 0; 90 } 91 92 ++ mFrame; 93 94 //glCullFace(GL_FRONT); 95 glCullFace(GL_BACK); 96 glDisable(GL_CULL_FACE); 97 98 99 // query all 6 directions for a full point sample 100 for (int i = 0; i < 6; ++ i) 101 { 102 mViewDirection = directions[i]; 103 SetupCamera(); 104 105 glClearColor(1.0f, 1.0f, 1.0f, 1.0f); 106 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 107 //glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glDepthMask(GL_TRUE); 108 glDepthFunc(GL_LESS); 109 110 mUseFalseColors = true; 111 112 // the actual scene rendering fills the depth (for occlusion queries) 113 // and the frame buffer (for item buffer) 114 RenderScene(); 115 116 117 if (0) 118 { 119 char filename[256]; 120 sprintf(filename, "snap/frame-%04d-%d.png", mFrame, i); 121 QImage im = toImage(); 122 im.save(filename, "PNG"); 123 } 124 125 // evaluate the sample 126 if (useOcclusionQueries) 127 { 128 EvalQueryWithOcclusionQueries(); 129 } 130 else 131 { 132 EvalQueryWithItemBuffer(); 133 } 134 } 135 136 // now evaluate the statistics over that sample 137 // currently only the number of visible objects is taken into account 138 sample.Reset(); 139 140 for (it = mObjects.begin(); it != it_end; ++ it) 141 { 142 Intersectable *obj = *it; 143 if (obj->mCounter >= threshold) 144 { 145 ++ sample.mVisibleObjects; 146 sample.mVisiblePixels += obj->mCounter; 147 } 148 } 149 150 //cout << "RS=" << sample.mVisibleObjects << " "; 151 } 152 153 154 QtGlRendererBuffer::~QtGlRendererBuffer() 155 { 156 #if USE_CG 157 if (sCgFragmentProgram) 158 cgDestroyProgram(sCgFragmentProgram); 159 if (sCgContext) 160 cgDestroyContext(sCgContext); 161 #endif 162 } 163 164 165 void 166 QtGlRendererBuffer::SampleRenderCost(const int numSamples, 167 vector<RenderCostSample> &samples, 168 const bool useOcclusionQueries, 169 const int threshold 170 ) 58 QtGlRendererBuffer::MakeCurrent() 171 59 { 172 60 makeCurrent(); 173 174 if (mPixelBuffer == NULL) 175 mPixelBuffer = new unsigned int[GetWidth()*GetHeight()]; 176 177 // using 90 degree projection to capture 360 view with 6 samples 178 SetupProjection(GetHeight(), GetHeight(), 90.0f); 179 180 //samples.resize(numSamples); 181 halton.Reset(); 182 183 // the number of queries queried in batch mode 184 const int numQ = 500; 185 186 //const int numQ = (int)mObjects.size(); 187 if (useOcclusionQueries) 188 { 189 cout << "\ngenerating " << numQ << " queries ... "; 190 OcclusionQuery::GenQueries(mOcclusionQueries, numQ); 191 cout << "finished" << endl; 192 } 193 194 // sampling queries 195 for (int i = 0; i < numSamples; ++ i) 196 { 197 cout << "."; 198 EvalRenderCostSample(samples[i], useOcclusionQueries, threshold); 199 } 200 61 } 62 63 void 64 QtGlRendererBuffer::DoneCurrent() 65 { 201 66 doneCurrent(); 202 203 } 204 205 67 } 68 206 69 207 70 QtGlRendererBuffer::QtGlRendererBuffer(const int w, … … 210 73 ViewCellsManager *viewcells, 211 74 KdTree *tree): 212 QGLPixelBuffer(QSize(w, h)), GlRendererBuffer(sceneGraph, viewcells, tree) { 213 214 Environment::GetSingleton()->GetIntValue("Preprocessor.pvsRenderErrorSamples", mPvsStatFrames); 215 mPvsErrorBuffer.resize(mPvsStatFrames); 216 ClearErrorBuffer(); 217 218 mPixelBuffer = NULL; 219 220 makeCurrent(); 75 QGLPixelBuffer(QSize(w, h)), 76 //QGLWidget(NULL, w, h), 77 GlRendererBuffer(sceneGraph, viewcells, tree) 78 { 79 MakeCurrent(); 221 80 InitGL(); 222 doneCurrent(); 223 224 } 81 DoneCurrent(); 82 } 83 84 225 85 226 86 float … … 238 98 //static int query = -1; 239 99 //if (query == -1) 240 // glGenOcclusionQueriesNV(1, (unsigned int *)&query);100 // glGenOcclusionQueriesNV(1, (unsigned int *)&query); 241 101 242 102 OcclusionQuery query; … … 247 107 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 248 108 glEnable( GL_CULL_FACE ); 109 glCullFace(GL_BACK); 249 110 250 111 RenderScene(); … … 254 115 glDisable( GL_CULL_FACE ); 255 116 256 257 117 query.BeginQuery(); 258 118 … … 271 131 if (pixelCount > 0) 272 132 return -1.0f; // backfacing polygon found -> not a valid viewspace sample 133 273 134 } else 274 135 glDisable( GL_CULL_FACE ); 275 136 276 137 277 ViewCell *viewcell = NULL; 278 279 PrVs prvs; 280 281 mViewCellsManager->SetMaxFilterSize(0); 282 mViewCellsManager->GetPrVS(mViewPoint, prvs, mViewCellsManager->GetFilterWidth()); 283 viewcell = prvs.mViewCell; 284 285 // ViewCell *viewcell = mViewCellsManager->GetViewCell(mViewPoint); 286 pvsSize = 0; 138 // ViewCell *viewcell = NULL; 139 140 // PrVs prvs; 141 142 // mViewCellsManager->SetMaxFilterSize(0); 143 // mViewCellsManager->GetPrVS(mViewPoint, prvs, mViewCellsManager->GetFilterWidth()); 144 // viewcell = prvs.mViewCell; 145 146 ObjectPvs pvs; 147 ViewCell *viewcell = mViewCellsManager->GetViewCell(mViewPoint); 148 287 149 if (viewcell) { 150 mViewCellsManager->ApplyFilter2(viewcell, 151 false, 152 1.0f, 153 pvs); 154 155 pvsSize = 0; 288 156 SetupCamera(); 289 157 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 290 291 158 glColorMask(GL_FALSE, GL_TRUE, GL_FALSE, GL_FALSE); 292 159 293 // Render PVS 294 ObjectPvsIterator it = viewcell->GetPvs().GetIterator(); 295 296 pvsSize = viewcell->GetPvs().GetSize(); 297 160 161 // // Render PVS 162 ObjectPvsIterator it = pvs.GetIterator(); 163 164 pvsSize = pvs.GetSize(); 165 Intersectable::NewMail(); 298 166 for (; it.HasMoreEntries(); ) { 299 167 ObjectPvsEntry entry = it.Next(); … … 301 169 RenderIntersectable(object); 302 170 } 303 171 304 172 // glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE); 305 173 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 174 175 306 176 mUseFalseColors = true; 307 177 308 178 query.BeginQuery(); 309 179 310 180 SetupCamera(); 311 181 312 182 RenderScene(); 313 183 314 184 query.EndQuery(); 315 185 316 186 317 187 unsigned int pixelCount; 318 188 // reenable other state … … 321 191 322 192 pErrorPixels = ((float)pixelCount)/(GetWidth()*GetHeight()); 323 if (mSnapErrorFrames && pErrorPixels > 0.01) { 324 325 char filename[256]; 326 sprintf(filename, "error-frame-%04d-%0.5f.png", mFrame, pErrorPixels); 327 QImage im = toImage(); 328 string str = mSnapPrefix + filename; 329 QString qstr(str.c_str()); 330 331 im.save(qstr, "PNG"); 332 if (1) { //0 && mFrame == 1543) { 333 int x,y; 334 int lastIndex = -1; 335 for (y=0; y < im.height(); y++) 336 for (x=0; x < im.width(); x++) { 337 QRgb p = im.pixel(x,y); 338 int index = qRed(p) + (qGreen(p)<<8) + (qBlue(p)<<16); 339 if (qGreen(p) != 255 && index!=0) { 340 if (index != lastIndex) { 341 // Debug<<"ei="<<index<<" "; 342 lastIndex = index; 343 } 193 } else 194 pErrorPixels = 0.0f; 195 196 if (mSnapErrorFrames && pErrorPixels > 0.001f) { 197 198 char filename[256]; 199 sprintf(filename, "error-frame-%04d-%0.5f.png", mFrame, pErrorPixels); 200 QImage im = toImage(); 201 string str = mSnapPrefix + filename; 202 QString qstr(str.c_str()); 203 204 im.save(qstr, "PNG"); 205 if (1) { //0 && mFrame == 1543) { 206 int x,y; 207 int lastIndex = -1; 208 for (y=0; y < im.height(); y++) 209 for (x=0; x < im.width(); x++) { 210 QRgb p = im.pixel(x,y); 211 int index = qRed(p) + (qGreen(p)<<8) + (qBlue(p)<<16); 212 if (qGreen(p) != 255 && index!=0) { 213 if (index != lastIndex) { 214 // Debug<<"ei="<<index<<" "; 215 lastIndex = index; 344 216 } 345 217 } 346 } 347 348 349 mUseFalseColors = false; 350 glPushAttrib(GL_CURRENT_BIT); 351 glColor3f(0,1,0); 352 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 353 SetupCamera(); 354 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 355 356 // Render PVS 357 ObjectPvsIterator it = viewcell->GetPvs().GetIterator(); 358 for (; it.HasMoreEntries(); ) { 359 ObjectPvsEntry entry = it.Next(); 360 Intersectable *object = entry.mObject; 361 RenderIntersectable(object); 362 } 363 364 im = toImage(); 365 sprintf(filename, "error-frame-%04d-%0.5f-pvs.png", mFrame, pErrorPixels); 366 str = mSnapPrefix + filename; 367 qstr = str.c_str(); 368 im.save(qstr, "PNG"); 369 glPopAttrib(); 370 } 218 } 219 } 220 221 222 mUseFalseColors = false; 223 glPushAttrib(GL_CURRENT_BIT); 224 glColor3f(0,1,0); 371 225 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 372 } 373 374 if (viewcell && mViewCellsManager->GetMaxFilterSize() > 0) 375 mViewCellsManager->DeleteLocalMergeTree(viewcell); 226 SetupCamera(); 227 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 228 229 // Render PVS 230 Intersectable::NewMail(); 231 232 ObjectPvsIterator it = pvs.GetIterator(); 233 for (; it.HasMoreEntries(); ) { 234 ObjectPvsEntry entry = it.Next(); 235 Intersectable *object = entry.mObject; 236 RenderIntersectable(object); 237 } 238 239 im = toImage(); 240 sprintf(filename, "error-frame-%04d-%0.5f-pvs.png", mFrame, pErrorPixels); 241 str = mSnapPrefix + filename; 242 qstr = str.c_str(); 243 im.save(qstr, "PNG"); 244 glPopAttrib(); 245 } 246 247 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 376 248 377 249 return pErrorPixels; 378 250 } 379 251 380 381 void 382 QtGlRendererBuffer::ClearErrorBuffer() 383 { 384 for (int i=0; i < mPvsStatFrames; i++) { 385 mPvsErrorBuffer[i].mError = 1.0f; 386 } 387 } 388 389 390 void 391 QtGlRendererBuffer::EvalPvsStat() 392 { 393 mPvsStat.Reset(); 394 halton.Reset(); 395 396 makeCurrent(); 397 398 SetupProjection(GetWidth(), GetHeight()); 399 400 for (int i=0; i < mPvsStatFrames; i++) { 401 float err; 402 // set frame id for saving the error buffer 403 mFrame = i; 404 RandomViewPoint(); 405 406 // atlanta problematic frames: 325 525 691 1543 407 #if 0 408 if (mFrame != 325 && 409 mFrame != 525 && 410 mFrame != 691 && 411 mFrame != 1543) 412 mPvsErrorBuffer[i] = -1; 413 else { 414 Debug<<"frame ="<<mFrame<<" vp="<<mViewPoint<<" vd="<<mViewDirection<<endl; 415 } 416 #endif 417 if (mPvsErrorBuffer[i].mError > 0.0f) { 418 int pvsSize; 419 420 421 float error = GetPixelError(pvsSize); 422 mPvsErrorBuffer[i].mError = error; 423 mPvsErrorBuffer[i].mPvsSize = pvsSize; 424 425 emit UpdatePvsErrorItem(i, 426 mPvsErrorBuffer[i]); 427 428 cout<<"("<<i<<","<<mPvsErrorBuffer[i].mError<<")"; 429 // swapBuffers(); 430 } 431 432 err = mPvsErrorBuffer[i].mError; 433 434 if (err >= 0.0f) { 435 if (err > mPvsStat.maxError) 436 mPvsStat.maxError = err; 437 mPvsStat.sumError += err; 438 mPvsStat.sumPvsSize += mPvsErrorBuffer[i].mPvsSize; 439 440 if (err == 0.0f) 441 mPvsStat.errorFreeFrames++; 442 mPvsStat.frames++; 443 } 444 } 445 446 glFinish(); 447 doneCurrent(); 448 449 cout<<endl<<flush; 450 // mRenderingFinished.wakeAll(); 451 } 452 453 454 455 456 457 458 459 void QtGlRendererBuffer::SampleBeamContributions(Intersectable *sourceObject, 460 Beam &beam, 461 const int desiredSamples, 462 BeamSampleStatistics &stat) 463 { 464 // TODO: should be moved out of here (not to be done every time) 465 // only back faces are interesting for the depth pass 466 glShadeModel(GL_FLAT); 467 glDisable(GL_LIGHTING); 468 469 // needed to kill the fragments for the front buffer 470 glEnable(GL_ALPHA_TEST); 471 glAlphaFunc(GL_GREATER, 0); 472 473 // assumes that the beam is constructed and contains kd-tree nodes 474 // and viewcells which it intersects 475 476 477 // Get the number of viewpoints to be sampled 478 // Now it is a sqrt but in general a wiser decision could be made. 479 // The less viewpoints the better for rendering performance, since less passes 480 // over the beam is needed. 481 // The viewpoints could actually be generated outside of the bounding box which 482 // would distribute the 'efective viewpoints' of the object surface and thus 483 // with a few viewpoints better sample the viewpoint space.... 484 485 //TODO: comment in 486 //int viewPointSamples = sqrt((float)desiredSamples); 487 int viewPointSamples = max(desiredSamples / (GetWidth() * GetHeight()), 1); 488 489 // the number of direction samples per pass is given by the number of viewpoints 490 int directionalSamples = desiredSamples / viewPointSamples; 491 492 Debug << "directional samples: " << directionalSamples << endl; 493 for (int i = 0; i < viewPointSamples; ++ i) 494 { 495 Vector3 viewPoint = beam.mBox.GetRandomPoint(); 496 497 // perhaps the viewpoint should be shifted back a little bit so that it always lies 498 // inside the source object 499 // 'ideally' the viewpoints would be distributed on the soureObject surface, but this 500 // would require more complicated sampling (perhaps hierarchical rejection sampling of 501 // the object surface is an option here - only the mesh faces which are inside the box 502 // are considered as candidates) 503 504 SampleViewpointContributions(sourceObject, 505 viewPoint, 506 beam, 507 directionalSamples, 508 stat); 509 } 510 511 512 // note: 513 // this routine would be called only if the number of desired samples is sufficiently 514 // large - for other rss tree cells the cpu based sampling is perhaps more efficient 515 // distributing the work between cpu and gpu would also allow us to place more sophisticated 516 // sample distributions (silhouette ones) using the cpu and the jittered once on the GPU 517 // in order that thios scheme is working well the gpu render buffer should run in a separate 518 // thread than the cpu sampler, which would not be such a big problem.... 519 520 // disable alpha test again 521 glDisable(GL_ALPHA_TEST); 522 } 523 524 525 526 void QtGlRendererBuffer::SampleViewpointContributions(Intersectable *sourceObject, 527 const Vector3 viewPoint, 528 Beam &beam, 529 const int samples, 530 BeamSampleStatistics &stat) 531 { 532 // 1. setup the view port to match the desired samples 533 glViewport(0, 0, samples, samples); 534 535 // 2. setup the projection matrix and view matrix to match the viewpoint + beam.mDirBox 536 SetupProjectionForViewPoint(viewPoint, beam, sourceObject); 537 538 539 // 3. reset z-buffer to 0 and render the source object for the beam 540 // with glCullFace(Enabled) and glFrontFace(GL_CW) 541 // save result to the front depth map 542 // the front depth map holds ray origins 543 544 545 // front depth buffer must be initialised to 0 546 float clearDepth; 547 548 glGetFloatv(GL_DEPTH_CLEAR_VALUE, &clearDepth); 549 glClearDepth(0.0f); 550 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 551 552 553 //glFrontFace(GL_CW); 554 glEnable(GL_CULL_FACE); 555 glCullFace(GL_FRONT); 556 glColorMask(0, 0, 0, 0); 557 558 559 // stencil is increased where the source object is located 560 glEnable(GL_STENCIL_TEST); 561 glStencilFunc(GL_ALWAYS, 0x1, 0x1); 562 glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); 563 564 565 #if 0 566 static int glSourceObjList = -1; 567 if (glSourceObjList != -1) 568 { 569 glSourceObjList = glGenLists(1); 570 glNewList(glSourceObjList, GL_COMPILE); 571 572 RenderIntersectable(sourceObject); 573 574 glEndList(); 575 } 576 glCallList(glSourceObjList); 577 578 #else 579 RenderIntersectable(sourceObject); 580 581 #endif 582 583 // copy contents of the front depth buffer into depth texture 584 glBindTexture(GL_TEXTURE_2D, frontDepthMap); 585 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, depthMapSize, depthMapSize); 586 587 588 // reset clear function 589 glClearDepth(clearDepth); 590 591 592 593 // 4. set up the termination depth buffer (= standard depth buffer) 594 // only rays which have non-zero entry in the origin buffer are valid since 595 // they realy start on the object surface (this is tagged by setting a 596 // stencil buffer bit at step 3). 597 598 glStencilFunc(GL_EQUAL, 0x1, 0x1); 599 glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); 600 601 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 602 glDepthMask(1); 603 604 glEnable(GL_DEPTH_TEST); 605 606 glEnable(GL_CULL_FACE); 607 glCullFace(GL_BACK); 608 609 // setup front depth buffer 610 glEnable(GL_TEXTURE_2D); 611 612 #if USE_CG 613 // bind pixel shader implementing the front depth buffer functionality 614 cgGLBindProgram(sCgFragmentProgram); 615 cgGLEnableProfile(sCgFragmentProfile); 616 #endif 617 618 // 5. render all objects inside the beam 619 // we can use id based false color to read them back for gaining the pvs 620 621 glColorMask(1, 1, 1, 1); 622 623 624 // if objects not stored in beam => extract objects 625 if (beam.mFlags & !Beam::STORE_OBJECTS) 626 { 627 vector<KdNode *>::const_iterator it, it_end = beam.mKdNodes.end(); 628 629 Intersectable::NewMail(); 630 for (it = beam.mKdNodes.begin(); it != it_end; ++ it) 631 { 632 mKdTree->CollectObjects(*it, beam.mObjects); 633 } 634 } 635 636 637 // (objects can be compiled to a gl list now so that subsequent rendering for 638 // this beam is fast - the same hold for step 3) 639 // Afterwards we have two depth buffers defining the ray origin and termination 640 641 642 #if 0 643 static int glObjList = -1; 644 if (glObjList != -1) 645 { 646 glObjList = glGenLists(1); 647 glNewList(glObjList, GL_COMPILE); 648 649 ObjectContainer::const_iterator it, it_end = beam.mObjects.end(); 650 for (it = beam.mObjects.begin(); it != it_end; ++ it) 651 { 652 // render all objects except the source object 653 if (*it != sourceObject) 654 RenderIntersectable(*it); 655 } 656 657 glEndList(); 658 } 659 660 glCallList(glObjList); 661 #else 662 ObjectContainer::const_iterator it, it_end = beam.mObjects.end(); 663 for (it = beam.mObjects.begin(); it != it_end; ++ it) 664 { 665 // render all objects except the source object 666 if (*it != sourceObject) 667 RenderIntersectable(*it); 668 } 669 #endif 670 671 672 673 // 6. Use occlusion queries for all viewcell meshes associated with the beam -> 674 // a fragment passes if the corresponding stencil fragment is set and its depth is 675 // between origin and termination buffer 676 677 // create new queries if necessary 678 OcclusionQuery::GenQueries(mOcclusionQueries, (int)beam.mViewCells.size()); 679 680 // check whether any backfacing polygon would pass the depth test? 681 // matt: should check both back /front facing because of dual depth buffer 682 // and danger of cutting the near plane with front facing polys. 683 684 glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); 685 glDepthMask(GL_FALSE); 686 glDisable(GL_CULL_FACE); 687 688 689 ViewCellContainer::const_iterator vit, vit_end = beam.mViewCells.end(); 690 691 int queryIdx = 0; 692 693 for (vit = beam.mViewCells.begin(); vit != vit_end; ++ vit) 694 { 695 mOcclusionQueries[queryIdx ++]->BeginQuery(); 696 697 RenderIntersectable(*vit); 698 699 mOcclusionQueries[queryIdx]->EndQuery(); 700 701 ++ queryIdx; 702 } 703 704 705 706 // at this point, if possible, go and do some other computation 707 708 709 710 // 7. The number of visible pixels is the number of sample rays which see the source 711 // object from the corresponding viewcell -> remember these values for later update 712 // of the viewcell pvs - or update immediately? 713 714 queryIdx = 0; 715 716 for (vit = beam.mViewCells.begin(); vit != vit_end; ++ vit) 717 { 718 // fetch queries 719 unsigned int pixelCount = mOcclusionQueries[queryIdx ++]->GetQueryResult(); 720 721 if (pixelCount) 722 Debug << "view cell " << (*vit)->GetId() << " visible pixels: " << pixelCount << endl; 723 } 724 725 726 // 8. Copmpute rendering statistics 727 // In general it is not neccessary to remember to extract all the rays cast. I hope it 728 // would be sufficient to gain only the intergral statistics about the new contributions 729 // and so the rss tree would actually store no new rays (only the initial ones) 730 // the subdivision of the tree would only be driven by the statistics (the glrender could 731 // evaluate the contribution entropy for example) 732 // However might be an option to extract/store only those the rays which made a contribution 733 // (new viewcell has been discovered) or relative contribution greater than a threshold ... 734 735 ObjectContainer pvsObj; 736 stat.pvsSize = ComputePvs(beam.mObjects, pvsObj); 737 738 // to gain ray source and termination 739 // copy contents of ray termination buffer into depth texture 740 // and compare with ray source buffer 741 #if 0 742 VssRayContainer rays; 743 744 glBindTexture(GL_TEXTURE_2D, backDepthMap); 745 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, depthMapSize, depthMapSize); 746 747 ComputeRays(Intersectable *sourceObj, rays); 748 749 #endif 750 751 752 753 //-- cleanup 754 755 756 // reset gl state 757 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 758 glDepthMask(GL_TRUE); 759 glEnable(GL_CULL_FACE); 760 glDisable(GL_STENCIL_TEST); 761 #if USE_CG 762 cgGLDisableProfile(sCgFragmentProfile); 763 #endif 764 glDisable(GL_TEXTURE_2D); 765 766 // remove objects from beam 767 if (beam.mFlags & !Beam::STORE_OBJECTS) 768 beam.mObjects.clear(); 769 } 770 771 772 void QtGlRendererBuffer::SetupProjectionForViewPoint(const Vector3 &viewPoint, 773 const Beam &beam, 774 Intersectable *sourceObject) 775 { 776 float left, right, bottom, top, znear, zfar; 777 778 beam.ComputePerspectiveFrustum(left, right, bottom, top, znear, zfar, 779 mSceneGraph->GetBox()); 780 781 //Debug << left << " " << right << " " << bottom << " " << top << " " << znear << " " << zfar << endl; 782 glMatrixMode(GL_PROJECTION); 783 glLoadIdentity(); 784 glFrustum(left, right, bottom, top, znear, zfar); 785 //glFrustum(-1, 1, -1, 1, 1, 20000); 786 787 const Vector3 center = viewPoint + beam.GetMainDirection() * (zfar - znear) * 0.3f; 788 const Vector3 up = 789 Normalize(CrossProd(beam.mPlanes[0].mNormal, beam.mPlanes[4].mNormal)); 790 791 #ifdef GTP_DEBUG 792 Debug << "view point: " << viewPoint << endl; 793 Debug << "eye: " << center << endl; 794 Debug << "up: " << up << endl; 795 #endif 796 797 glMatrixMode(GL_MODELVIEW); 798 glLoadIdentity(); 799 gluLookAt(viewPoint.x, viewPoint.y, viewPoint.z, 800 center.x, center.y, center.z, 801 up.x, up.y, up.z); 802 } 803 804 805 void QtGlRendererBuffer::InitGL() 806 { 807 makeCurrent(); 808 GlRenderer::InitGL(); 809 810 #if 1 811 // initialise dual depth buffer textures 812 glGenTextures(1, &frontDepthMap); 813 glBindTexture(GL_TEXTURE_2D, frontDepthMap); 814 815 glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, depthMapSize, 816 depthMapSize, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL); 817 818 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 819 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 820 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); 821 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); 822 823 glGenTextures(1, &backDepthMap); 824 glBindTexture(GL_TEXTURE_2D, backDepthMap); 825 826 glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, depthMapSize, 827 depthMapSize, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL); 828 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 829 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 830 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); 831 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); 832 833 #if USE_CG 834 // cg initialization 835 cgSetErrorCallback(handleCgError); 836 sCgContext = cgCreateContext(); 837 838 if (cgGLIsProfileSupported(CG_PROFILE_ARBFP1)) 839 sCgFragmentProfile = CG_PROFILE_ARBFP1; 840 else 841 { 842 // try FP30 843 if (cgGLIsProfileSupported(CG_PROFILE_FP30)) 844 sCgFragmentProfile = CG_PROFILE_FP30; 845 else 846 { 847 Debug << "Neither arbfp1 or fp30 fragment profiles supported on this system" << endl; 848 exit(1); 849 } 850 } 851 852 sCgFragmentProgram = cgCreateProgramFromFile(sCgContext, 853 CG_SOURCE, "../src/dual_depth.cg", 854 sCgFragmentProfile, 855 NULL, 856 NULL); 857 858 if (!cgIsProgramCompiled(sCgFragmentProgram)) 859 cgCompileProgram(sCgFragmentProgram); 860 861 cgGLLoadProgram(sCgFragmentProgram); 862 cgGLBindProgram(sCgFragmentProgram); 863 864 Debug << "---- PROGRAM BEGIN ----\n" << 865 cgGetProgramString(sCgFragmentProgram, CG_COMPILED_PROGRAM) << "---- PROGRAM END ----\n"; 866 867 #endif 868 869 #endif 870 doneCurrent(); 871 } 872 873 874 void QtGlRendererBuffer::ComputeRays(Intersectable *sourceObj, VssRayContainer &rays) 875 { 876 for (int i = 0; i < depthMapSize * depthMapSize; ++ i) 877 { 878 //todo glGetTexImage() 879 } 880 } 881 882 883 884 int QtGlRendererBuffer::ComputePvs(ObjectContainer &objects, 885 ObjectContainer &pvs) const 252 int 253 QtGlRendererBuffer::ComputePvs(ObjectContainer &objects, 254 ObjectContainer &pvs) const 886 255 { 887 256 int pvsSize = 0; … … 922 291 return pvsSize; 923 292 } 293 294 /////////////////////////////////////////////////////////////// 295 /////////////////////////////////////////////////////////////// 296 /////////////////////////////////////////////////////////////// 297 /////////////////////////////////////////////////////////////// 298 299 924 300 925 301 … … 1702 1078 if (mViewCellsManager) 1703 1079 mViewCellsManager->SetMaxFilterSize(number); 1080 mPvsCache.Reset(); 1704 1081 updateGL(); 1705 1082 } … … 1709 1086 { 1710 1087 mSpatialFilterSize = 1e-3*number; 1088 mPvsCache.Reset(); 1711 1089 updateGL(); 1712 1090 } -
GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer.h
r1757 r1785 48 48 KdTree *tree); 49 49 50 ~QtGlRendererBuffer(); 51 52 /** Evaluates render cost of a point sample. 53 @param sample the render cost sample to be evaluated 54 @param useOcclusionQueries if occlusion queries should be used or item buffer 55 @param threshold number of pixels / samples from where an object is considered visible. 56 */ 57 void EvalRenderCostSample(RenderCostSample &sample, 58 const bool useOcclusionQueries, 59 const int threshold); 60 61 /** Evaluates render cost of a number of point samples. The point samples 62 are distributed uniformly over the defined view space. 63 64 @param numSamples the number of point samples taken 65 @param samples stores the taken point samples in a container 66 @param useOcclusionQueries if occlusion queries should be used or item buffer 67 @param threshold number of pixels / samples from where an object is considered visible. 68 */ 69 void SampleRenderCost(const int numSamples, 70 vector<RenderCostSample> &samples, 71 const bool useOcclusionQueries, 72 const int threshold = 0); 73 74 75 void 76 EvalPvsStat(); 77 78 void 79 ClearErrorBuffer(); 80 50 ~QtGlRendererBuffer() {} 51 52 virtual void MakeCurrent(); 53 virtual void DoneCurrent(); 81 54 82 55 virtual int GetWidth() const { return width(); } 83 56 virtual int GetHeight() const { return height(); } 84 57 85 86 87 void SampleBeamContributions( 88 Intersectable *sourceObject, 89 Beam &beam, 90 const int samples, 91 BeamSampleStatistics &stat 92 ); 93 94 void 95 SampleViewpointContributions( 96 Intersectable *sourceObject, 97 const Vector3 viewPoint, 98 Beam &beam, 99 const int desiredSamples, 100 BeamSampleStatistics &stat 101 ); 102 103 void InitGL(); 104 105 /** Computes rays from information gained with hw sampling- 106 */ 107 void ComputeRays(Intersectable *sourceObj, VssRayContainer &rays); 108 109 int ComputePvs() const; 110 58 int ComputePvs() const { return 0; } 59 111 60 float 112 61 GetPixelError(int &pvsSize); 113 62 114 63 int ComputePvs(ObjectContainer &objects, ObjectContainer &pvs) const; 115 64 116 117 private: 118 119 void SetupProjectionForViewPoint(const Vector3 &viewPoint, 120 const Beam &beam, 121 Intersectable *sourceObject); 122 123 65 66 67 124 68 public: 125 69 signals: 126 70 void UpdatePvsErrorItem(int i, GlRendererBuffer::PvsErrorEntry &); 127 71 }; 128 72 -
GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.cpp
r1771 r1785 15 15 16 16 17 #define USE_RSS_TREE 118 17 19 18 namespace GtpVisibilityPreprocessor { … … 38 37 Environment::GetSingleton()->GetIntValue("RssPreprocessor.vssSamplesPerPass", mRssSamplesPerPass); 39 38 Environment::GetSingleton()->GetBoolValue("RssPreprocessor.useImportanceSampling", mUseImportanceSampling); 39 40 Environment::GetSingleton()->GetBoolValue("RssPreprocessor.useRssTree", 41 mUseRssTree); 40 42 41 43 Environment::GetSingleton()->GetBoolValue("RssPreprocessor.Export.pvs", mExportPvs); … … 48 50 49 51 Environment::GetSingleton()->GetBoolValue("RssPreprocessor.loadInitialSamples", mLoadInitialSamples); 52 50 53 Environment::GetSingleton()->GetBoolValue("RssPreprocessor.storeInitialSamples", mStoreInitialSamples); 54 51 55 Environment::GetSingleton()->GetBoolValue("RssPreprocessor.updateSubdivision", mUpdateSubdivision); 52 56 … … 353 357 // renderer->mRenderingFinished.wait(&mutex); 354 358 // mutex.unlock(); 355 359 356 360 renderer->EvalPvsStat(); 361 357 362 mStats << 358 363 "#AvgPvsRenderError\n" <<renderer->mPvsStat.GetAvgError()<<endl<< … … 364 369 365 370 void 366 NormalizeRatios(vector<SamplingStrategy *> distributions)371 NormalizeRatios(vector<SamplingStrategy *> &distributions) 367 372 { 368 373 int i; … … 397 402 distributions[i]->mRatio/=sumRatios; 398 403 399 404 405 cout<<"New ratios: "; 406 for (i=0 ; i < distributions.size(); i++) 407 cout<<distributions[i]->mRatio<<" "; 408 cout<<endl; 400 409 } 401 410 402 411 void 403 NormalizeRatios(float ratios[4]) 404 { 405 int i; 406 float sumRatios; 407 sumRatios = ratios[0] + ratios[1] + ratios[2] + ratios[3]; 408 if (sumRatios == 0.0f) { 409 ratios[0] = ratios[1] = ratios[2] = 1.0f; 410 sumRatios = 4.0f; 411 } 412 413 for (i=0 ; i < 4; i++) 414 ratios[i]/=sumRatios; 415 416 #define MIN_RATIO 0.1f 417 418 #if USE_RSS_TREE 419 i = 0; 420 #else 421 i = 1; 412 EvaluateRatios(vector<SamplingStrategy *> &distributions) 413 { 414 // now evaluate the ratios for the next pass 415 #define TIME_WEIGHT 0.5f 416 for (int i=0; i < distributions.size(); i++) { 417 distributions[i]->mRatio = distributions[i]->mContribution/ 418 (TIME_WEIGHT*distributions[i]->mTime + 419 (1 - TIME_WEIGHT)*distributions[i]->mRays); 420 421 #if 1 422 distributions[i]->mRatio = sqr(distributions[i]->mRatio); 422 423 #endif 423 424 for (; i < 4; i++) 425 if (ratios[i] < MIN_RATIO) 426 ratios[i] = MIN_RATIO; 427 428 sumRatios = ratios[0] + ratios[1] + ratios[2] + ratios[3]; 429 for (i=0 ; i < 4; i++) 430 ratios[i]/=sumRatios; 431 432 } 424 } 425 } 426 427 433 428 434 429 bool … … 443 438 Randomize(0); 444 439 440 // use ray buffer to export ray animation 445 441 const bool useRayBuffer = false; 446 442 … … 468 464 int rssSamples = 0; 469 465 470 mDistributions.push_back(new RssBasedDistribution(*this)); 471 mDistributions.push_back(new SpatialBoxBasedDistribution(*this)); 472 mDistributions.push_back(new DirectionBasedDistribution(*this)); 473 mDistributions.push_back(new ReverseObjectBasedDistribution(*this)); 466 if (mUseRssTree) 467 mDistributions.push_back(new RssBasedDistribution(*this)); 468 469 // mDistributions.push_back(new SpatialBoxBasedDistribution(*this)); 470 // mDistributions.push_back(new DirectionBasedDistribution(*this)); 471 mDistributions.push_back(new ObjectDirectionBasedDistribution(*this)); 472 // mDistributions.push_back(new ReverseObjectBasedDistribution(*this)); 473 mDistributions.push_back(new ObjectBasedDistribution(*this)); 474 mDistributions.push_back(new ReverseViewSpaceBorderBasedDistribution(*this)); 474 475 475 476 if (mLoadInitialSamples) { … … 483 484 484 485 if (mUseImportanceSampling) { 485 GenerateRays(mInitialSamples/3, SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION, rays); 486 // GenerateRays(mInitialSamples/3, SamplingStrategy::OBJECT_BASED_DISTRIBUTION, rays); 487 GenerateRays(mInitialSamples/3, SamplingStrategy::DIRECTION_BASED_DISTRIBUTION, rays); 488 GenerateRays(mInitialSamples/3, SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION, rays); 489 // GenerateRays(mInitialSamples/4, OBJECT_DIRECTION_BASED_DISTRIBUTION, rays); 490 486 int count = 0; 487 int i; 488 489 // Generate initial samples 490 for (i=0; i < mDistributions.size(); i++) 491 if (mDistributions[i]->mType != SamplingStrategy::RSS_BASED_DISTRIBUTION) 492 count++; 493 494 for (i=0; i < mDistributions.size(); i++) 495 if (mDistributions[i]->mType != SamplingStrategy::RSS_BASED_DISTRIBUTION) 496 GenerateRays(mInitialSamples/count, 497 mDistributions[i]->mType, rays); 491 498 492 499 } else { … … 584 591 if (mUseImportanceSampling) { 585 592 586 #if USE_RSS_TREE 587 mRssTree->Construct(mObjects, mVssRays);588 #endif 589 590 mRssTree->stat.Print(mStats);591 cout<<"RssTree root PVS size = "<<mRssTree->GetRootPvsSize()<<endl;592 593 if (mExportRssTree) {594 ExportRssTree("rss-tree-100.x3d", mRssTree, Vector3(1,0,0));595 ExportRssTree("rss-tree-001.x3d", mRssTree, Vector3(0,0,1));596 ExportRssTree("rss-tree-101.x3d", mRssTree, Vector3(1,0,1));597 ExportRssTree("rss-tree-101m.x3d", mRssTree, Vector3(-1,0,-1));598 ExportRssTreeLeaves(mRssTree, 10);599 } 600 593 if (mUseRssTree) { 594 mRssTree->Construct(mObjects, mVssRays); 595 596 mRssTree->stat.Print(mStats); 597 cout<<"RssTree root PVS size = "<<mRssTree->GetRootPvsSize()<<endl; 598 599 if (mExportRssTree) { 600 ExportRssTree("rss-tree-100.x3d", mRssTree, Vector3(1,0,0)); 601 ExportRssTree("rss-tree-001.x3d", mRssTree, Vector3(0,0,1)); 602 ExportRssTree("rss-tree-101.x3d", mRssTree, Vector3(1,0,1)); 603 ExportRssTree("rss-tree-101m.x3d", mRssTree, Vector3(-1,0,-1)); 604 ExportRssTreeLeaves(mRssTree, 10); 605 } 606 } 607 601 608 if (mExportPvs) { 602 609 ExportPvs("rss-pvs-initial.x3d", mRssTree); … … 621 628 if (mUseImportanceSampling) { 622 629 623 #if USE_RSS_TREE 624 static float ratios[] = {0.9f,0.05f,0.05f,0.05f}; 625 #else 626 static float ratios[] = {0.0f,0.05f,0.05f,0.05f}; 627 #endif 628 NormalizeRatios(ratios); 629 630 cout<<"New ratios: "<<ratios[0]<<" "<<ratios[1]<<" "<<ratios[2]<<" "<<ratios[3]<<endl; 631 632 //float ratios[] = {1.0f,0.0f,0.0f}; 633 634 int nrays[4]; 635 float contributions[4]; 636 float times[4]; 630 NormalizeRatios(mDistributions); 637 631 638 632 long t1; 639 633 640 t1 = GetTime(); 641 642 GenerateRays(int(mRssSamplesPerPass*ratios[0]), 643 SamplingStrategy::RSS_BASED_DISTRIBUTION, 644 rays); 645 646 rays.NormalizePdf((float)rays.size()); 647 648 CastRays(rays, tmpVssRays, true); 649 castRays += (int)rays.size(); 650 #if ADD_RAYS_IN_PLACE 651 contributions[0] = mViewCellsManager->ComputeSampleContributions(tmpVssRays, true, false); 652 #else 653 contributions[0] = mViewCellsManager->ComputeSampleContributions(tmpVssRays, false, true); 654 #endif 655 times[0] = TimeDiff(t1, GetTime()); 656 nrays[0] = (int)rays.size(); 657 658 mStats<<"#RssRelContrib"<<endl<<contributions[0]/nrays[0]<<endl; 659 660 vssRays.insert(vssRays.end(), tmpVssRays.begin(), tmpVssRays.end() ); 661 rays.clear(); 662 tmpVssRays.clear(); 663 if (ratios[1]!=0.0f) { 634 for (int i=0; i < mDistributions.size(); i++) { 664 635 t1 = GetTime(); 665 GenerateRays(int(mRssSamplesPerPass*ratios[1]), SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION, rays);666 CastRays(rays, tmpVssRays, true);667 castRays += (int)rays.size();668 #if ADD_RAYS_IN_PLACE669 contributions[1] = mViewCellsManager->ComputeSampleContributions(tmpVssRays, true, false);670 #else671 contributions[1] = mViewCellsManager->ComputeSampleContributions(tmpVssRays, false, true);672 #endif673 times[1] = TimeDiff(t1, GetTime());674 nrays[1] = (int)rays.size();675 676 mStats<<"#SpatialRelContrib"<<endl<<contributions[1]/nrays[1]<<endl;677 678 vssRays.insert(vssRays.end(), tmpVssRays.begin(), tmpVssRays.end() );679 680 636 rays.clear(); 681 637 tmpVssRays.clear(); 638 if (mDistributions[i]->mRatio != 0) { 639 GenerateRays(int(mRssSamplesPerPass*mDistributions[i]->mRatio), 640 mDistributions[i]->mType, 641 rays); 642 643 rays.NormalizePdf((float)rays.size()); 644 645 CastRays(rays, tmpVssRays, true); 646 castRays += (int)rays.size(); 647 648 #if ADD_RAYS_IN_PLACE 649 mDistributions[i]->mContribution = 650 mViewCellsManager->ComputeSampleContributions(tmpVssRays, true, false); 651 #else 652 mDistributions[i]->mContribution = 653 mViewCellsManager->ComputeSampleContributions(tmpVssRays, false, true); 654 #endif 655 } 656 657 mDistributions[i]->mTime = TimeDiff(t1, GetTime()); 658 mDistributions[i]->mRays = (int)rays.size(); 659 // mStats<<"#RssRelContrib"<<endl<<contributions[0]/nrays[0]<<endl; 660 vssRays.insert(vssRays.end(), tmpVssRays.begin(), tmpVssRays.end() ); 682 661 } 683 684 685 if (ratios[2]!=0.0f) { 686 t1 = GetTime(); 687 GenerateRays(int(mRssSamplesPerPass*ratios[2]), SamplingStrategy::DIRECTION_BASED_DISTRIBUTION, rays); 688 CastRays(rays, tmpVssRays, true); 689 castRays += (int)rays.size(); 690 #if ADD_RAYS_IN_PLACE 691 contributions[2] = mViewCellsManager->ComputeSampleContributions(tmpVssRays, true, false); 692 #else 693 contributions[2] = mViewCellsManager->ComputeSampleContributions(tmpVssRays, false, true); 694 #endif 695 times[2] = TimeDiff(t1, GetTime()); 696 nrays[2] = (int)rays.size(); 697 698 mStats<<"#DirectionalRelContrib"<<endl<<contributions[2]/nrays[2]<<endl; 699 700 vssRays.insert(vssRays.end(), tmpVssRays.begin(), tmpVssRays.end() ); 701 702 rays.clear(); 703 tmpVssRays.clear(); 704 } 705 706 if (ratios[3]!=0.0f) { 707 t1 = GetTime(); 708 GenerateRays(int(mRssSamplesPerPass*ratios[3]), 709 SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION, rays); 710 CastRays(rays, tmpVssRays, true); 711 castRays += (int)rays.size(); 712 #if ADD_RAYS_IN_PLACE 713 contributions[3] = mViewCellsManager->ComputeSampleContributions(tmpVssRays, true, false); 714 #else 715 contributions[3] = mViewCellsManager->ComputeSampleContributions(tmpVssRays, false, true); 716 #endif 717 times[3] = TimeDiff(t1, GetTime()); 718 nrays[3] = (int)rays.size(); 719 720 mStats<<"#DirectionalRelContrib"<<endl<<contributions[3]/nrays[3]<<endl; 721 722 vssRays.insert(vssRays.end(), tmpVssRays.begin(), tmpVssRays.end() ); 723 724 rays.clear(); 725 tmpVssRays.clear(); 726 } 727 728 729 // now evaluate the ratios for the next pass 730 #define TIME_WEIGHT 0.5f 731 732 #if 1 733 ratios[0] = sqr(contributions[0]/(TIME_WEIGHT*times[0] + (1 - TIME_WEIGHT)*nrays[0])); 734 ratios[1] = sqr(contributions[1]/(TIME_WEIGHT*times[1] + (1 - TIME_WEIGHT)*nrays[1])); 735 ratios[2] = sqr(contributions[2]/(TIME_WEIGHT*times[2] + (1 - TIME_WEIGHT)*nrays[2])); 736 ratios[3] = sqr(contributions[3]/(TIME_WEIGHT*times[3] + (1 - TIME_WEIGHT)*nrays[3])); 737 #else 738 ratios[0] = contributions[0]/(TIME_WEIGHT*times[0] + (1 - TIME_WEIGHT)*nrays[0]); 739 ratios[1] = contributions[1]/(TIME_WEIGHT*times[1] + (1 - TIME_WEIGHT)*nrays[1]); 740 ratios[2] = contributions[2]/(TIME_WEIGHT*times[2] + (1 - TIME_WEIGHT)*nrays[2]); 741 ratios[3] = contributions[3]/(TIME_WEIGHT*times[3] + (1 - TIME_WEIGHT)*nrays[3]); 742 743 #endif 744 745 #if !USE_RSS_TREE 746 ratios[0] = 0; 747 #endif 662 663 EvaluateRatios(mDistributions); 748 664 749 665 // add contributions of all rays at once... … … 803 719 } 804 720 805 if (0 && mPass > 0) { 806 char buf[100]; 721 722 if (renderer && mPass > 0) { 723 char buf[100]; 807 724 if (mUseImportanceSampling) 808 809 sprintf(buf, "snap/i-%02d-", mPass);810 811 renderer->SetSnapPrefix(buf);812 725 { 726 sprintf(buf, "snap/i-%02d-", mPass); 727 728 renderer->SetSnapPrefix(buf); 729 } 813 730 else 814 815 sprintf(buf, "snap/r-%02d-", mPass);816 817 renderer->SetSnapPrefix(buf);818 819 731 { 732 sprintf(buf, "snap/r-%02d-", mPass); 733 734 renderer->SetSnapPrefix(buf); 735 } 736 820 737 renderer->SetSnapErrorFrames(true); 821 738 } 822 739 823 740 ComputeRenderError(); 824 741 … … 845 762 sprintf(filename, "rss-crays-%04d.x3d", rssPass); 846 763 ExportRays(filename, contributingRays, mExportNumRays); 847 848 764 } 849 765 … … 853 769 // do not add those rays which have too low or no contribution.... 854 770 855 #if USE_RSS_TREE856 if (mUse ImportanceSampling) {771 772 if (mUseRssTree && mUseImportanceSampling) { 857 773 Debug<<"Adding rays...\n"<<flush; 858 774 mRssTree->AddRays(vssRays); … … 869 785 } 870 786 } 871 #endif872 787 873 788 if (mExportPvs) { … … 878 793 879 794 880 if (!mUseImportanceSampling )795 if (!mUseImportanceSampling || !mUseRssTree) 881 796 CLEAR_CONTAINER(vssRays); 882 797 // otherwise the rays get deleted by the rss tree update according to RssTree.maxRays .... 883 798 884 799 if (totalSamples >= mRssSamples + mInitialSamples) 885 800 break; … … 889 804 mPass++; 890 805 mRssTree->SetPass(mPass); 891 892 893 806 } 894 807 895 808 if (mUseViewcells) { 896 809 897 if(0) 898 { 899 VssRayContainer selectedRays; 900 int desired = mViewCellsManager->GetVisualizationSamples(); 901 902 mVssRays.SelectRays(desired, selectedRays); 903 904 mViewCellsManager->Visualize(mObjects, selectedRays); 810 if(0) { 811 VssRayContainer selectedRays; 812 int desired = mViewCellsManager->GetVisualizationSamples(); 813 814 mVssRays.SelectRays(desired, selectedRays); 815 816 mViewCellsManager->Visualize(mObjects, selectedRays); 905 817 } 906 818 907 819 // view cells after sampling 908 820 mViewCellsManager->PrintStatistics(Debug); 909 821 910 822 EvalViewCellHistogram(); 911 823 912 824 //-- render simulation after merge 913 825 cout << "\nevaluating bsp view cells render time after sampling ... "; … … 920 832 cout << ss << endl; 921 833 Debug << ss << endl; 922 923 834 } 924 835 -
GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.h
r1771 r1785 27 27 int mRssSamples; 28 28 bool mUseImportanceSampling; 29 bool mUseRssTree; 29 30 30 31 bool mExportPvs; -
GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.cpp
r1757 r1785 2179 2179 int startIndex = (int)rays.size(); 2180 2180 2181 Debug<<"B"<<flush;2181 // Debug<<"B"<<flush; 2182 2182 2183 2183 AxisAlignedBox3 box = GetBBox(leaf); … … 2192 2192 } 2193 2193 2194 Debug<<"R"<<flush;2194 // Debug<<"R"<<flush; 2195 2195 2196 2196 for (int i=0; i < numberOfRays; i++) { … … 2229 2229 origin = box.GetPoint(pVector); 2230 2230 dirVector = dirBox.GetPoint(dVector); 2231 2231 2232 2232 direction = Vector3(sin(dirVector.x), sin(dirVector.y), cos(dirVector.x)); 2233 2234 2233 2235 2234 … … 2253 2252 #if 0 2254 2253 static int counter = 0; 2255 Debug<<counter++<<flush;2254 // Debug<<counter++<<flush; 2256 2255 2257 2256 if (counter > 10374968) { … … 2268 2267 } 2269 2268 2270 Debug<<"D"<<flush;2269 // Debug<<"D"<<flush; 2271 2270 2272 2271 float density = 1.0f; … … 2692 2691 2693 2692 // always generate at leat n ray per leaf 2694 int fixedPerLeaf = 0;2693 int fixedPerLeaf = 1; 2695 2694 // int fixedPerLeaf = 0; 2696 2695 int fixed = fixedPerLeaf*(int)leaves.size(); 2697 int iGenerated = numberOfRays; 2696 2697 // check if the number of fixed is not too big 2698 2699 if (fixed >= numberOfRays/2) { 2700 fixedPerLeaf = 0; 2701 fixed = 0; 2702 } 2703 2704 int iGenerated = numberOfRays - fixed; 2698 2705 float ratioPerLeaf = iGenerated /(avgContrib*numberOfLeaves); 2699 2706 2700 2707 k = 0; 2701 2708 … … 2749 2756 } 2750 2757 2751 float weightAbsContributions = 0.0f;2758 float weightAbsContributions = ABS_CONTRIBUTION_WEIGHT; 2752 2759 // if small very high importance of the last sample 2753 2760 // if 1.0f then weighs = 1 1/2 1/3 1/4 2754 2761 float passSampleWeightDecay = 1.0f; 2755 2762 //float passSampleWeightDecay = 0.0001f; 2756 2757 2763 2758 2764 float -
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp
r1772 r1785 11 11 12 12 SamplingStrategy::SamplingStrategy(const Preprocessor &preprocessor): 13 mPreprocessor(preprocessor)13 mPreprocessor(preprocessor), mRatio(1.0f) 14 14 { 15 15 } -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1784 r1785 26 26 27 27 28 #define ABS_CONTRIBUTION_WEIGHT 1.0f29 28 30 29 // warning: Should not count origin object for sampling … … 33 32 34 33 // $$JB HACK 35 #define USE_KD_PVS 034 #define USE_KD_PVS 1 36 35 #define KD_PVS_AREA (1e-5f) 37 36 … … 1826 1825 1827 1826 stat.avgPvs += pvsCost; 1828 1829 const bool evaluateFilter = true; 1827 1828 bool evaluateFilter; 1829 Environment::GetSingleton()->GetBoolValue("Preprocessor.evaluateFilter", evaluateFilter); 1830 1830 1831 1831 1832 if (evaluateFilter) { 1832 1833 ObjectPvs filteredPvs = viewcell->GetPvs(); 1833 PvsFilterStatistics fstat = ApplyFilter2(viewcell, false, 1.0f, filteredPvs); 1834 PvsFilterStatistics fstat = ApplyFilter2(viewcell, false, 1835 1.0f, filteredPvs); 1834 1836 1835 1837 float filteredCost = filteredPvs.EvalPvsCost(); … … 2032 2034 ViewCell::NewMail(); 2033 2035 2036 // if (ray.mPdf!=1.0f) 2037 // cout<<ray.mPdf<<" "; 2038 2039 2034 2040 // traverse the view space subdivision 2035 2041 CastLineSegment(origin, termination, viewcells); … … 5852 5858 //Ray hray(ray); 5853 5859 5860 // if (ray.mPdf!=1.0f) 5861 // cout<<ray.mPdf<<" "; 5862 5854 5863 float tmin = 0, tmax = 1.0; 5855 5864 5865 5856 5866 if (!GetViewSpaceBox().GetRaySegment(hray, tmin, tmax) || (tmin > tmax)) 5857 5867 return 0; … … 5867 5877 if (storeViewCells) 5868 5878 { 5869 5870 5871 5879 // copy viewcells memory efficiently 5880 ray.mViewCells.reserve(viewcells.size()); 5881 ray.mViewCells = viewcells; 5872 5882 } 5873 5883 … … 5877 5887 Intersectable *originObj = GetIntersectable(ray, false); 5878 5888 5879 for (; it != viewcells.end(); ++ it) 5880 { 5881 ViewCell *viewcell = *it; 5882 5883 if (viewcell->GetValid()) 5889 for (; it != viewcells.end(); ++ it) { 5890 ViewCell *viewcell = *it; 5891 5892 if (viewcell->GetValid()) 5884 5893 { // if ray not outside of view space 5885 5886 5887 5894 float contribution; 5895 5896 if (terminationObj) 5888 5897 { 5889 5890 5891 terminationObj, ray.mPdf, contribution))5898 // todo: maybe not correct for kd node pvs 5899 if (viewcell->GetPvs().GetSampleContribution( 5900 terminationObj, ray.mPdf, contribution)) 5892 5901 { 5893 5902 ++ ray.mPvsContribution; 5894 5903 } 5895 5896 5904 5905 ray.mRelativePvsContribution += contribution; 5897 5906 } 5898 5907 5899 5900 5901 5902 5903 5908 //////////////// 5909 //-- for directional sampling it is important to count 5910 //-- only contributions made in one direction! 5911 //-- the other contributions of this sample will be counted for the opposite ray! 5912 5904 5913 #if SAMPLE_ORIGIN_OBJECTS 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 if (originObj && 5916 viewcell->GetPvs().GetSampleContribution(originObj, 5917 ray.mPdf, 5918 contribution)) 5919 { 5920 ++ ray.mPvsContribution; 5921 ray.mRelativePvsContribution += contribution; 5922 } 5914 5923 #endif 5915 5924 } 5916 5925 } 5917 5926 5918 5927 if (!addRays) 5919 5928 { -
GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.h
r1771 r1785 14 14 class KdNode; 15 15 16 #define ABS_CONTRIBUTION_WEIGHT 0.8f 16 17 17 18 class VssRay { -
GTP/trunk/Lib/Vis/Preprocessing/src/default.env
r1771 r1785 7 7 8 8 #filename ../data/Arena/arena-low-lods.obj 9 #filename ../data/Arena/arena-high-lods.obj9 filename ../data/Arena/arena-high-lods.obj 10 10 # filename ../data/City4M/City4M.obj 11 11 # filename ../data/CityModel/CityModel.obj … … 55 55 quitOnFinish true 56 56 computeVisibility true 57 58 evaluateFilter false 59 57 60 applyVisibilityFilter false 58 61 applyVisibilitySpatialFilter false … … 89 92 initialSamples 3000000 90 93 vssSamples 50000000 91 # vssSamples 100000092 94 vssSamplesPerPass 5000000 93 95 useImportanceSampling true … … 107 109 loadInitialSamples false 108 110 storeInitialSamples false 111 112 useRssTree false 109 113 } 110 114 … … 158 162 minCost 1 159 163 maxDepth 30 160 maxCostRatio 0.9 5164 maxCostRatio 0.98 161 165 ct_div_ci 0.5 162 maxNodes 200000166 maxNodes 500000 163 167 #500000 164 168 } … … 271 275 # filename ../data/soda/soda5-viewcells.xml 272 276 # filename ../scripts/viewcells_atlanta.xml 273 # filename ../data/soda/soda-viewcells -5000.xml277 # filename ../data/soda/soda-viewcells.xml.gz 274 278 # filename ../data/test1/test-viewcells.xml 275 279 -
GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
r1766 r1785 313 313 } 314 314 315 qApp->exec(); 315 int frames; 316 Environment::GetSingleton()->GetIntValue("Preprocessor.pvsRenderErrorSamples", frames); 317 if (frames) { 318 // NOTE: render texture should be power of 2 and square 319 // renderer must be initialised 320 // $$matt 321 preprocessor->renderer = 322 new QtGlRendererBuffer(512, 512, 323 preprocessor->mSceneGraph, 324 preprocessor->mViewCellsManager, 325 preprocessor->mKdTree); 326 // preprocessor->Getrenderer->makeCurrent(); 327 } 328 qApp->exec(); 316 329 #endif 317 330 } 318 331 319 332 if (!guiSupported) { 320 333 preprocessor->mUseGlRenderer = false; -
GTP/trunk/Lib/Vis/Preprocessing/src/run_test2
r1771 r1785 2 2 3 3 #COMMAND="./release/preprocessor.exe -preprocessor_quit_on_finish+" 4 COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish+ -preprocessor_use_gl_renderer- "4 COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish+ -preprocessor_use_gl_renderer- -preprocessor_evaluate_filter+" 5 5 6 6 #SCENE="../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d" … … 29 29 VIEWCELLS=../data/vienna/vienna_cropped-gradient-viewcells.xml.gz 30 30 31 PREFIX=../work/plots/osp-rss-1e5 31 PREFIX=../work/plots/osp-rss-1e5-n 32 32 33 33 #SCENE=../data/atlanta/atlanta2.x3d … … 35 35 36 36 37 $COMMAND -preprocessor=sampling -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \38 -view_cells_filter_max_size=1 -preprocessor_stats=$PREFIX-r-reference.log \39 -preprocessor_histogram_file=$PREFIX-r-reference.hlog37 # $COMMAND -preprocessor=sampling -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 38 # -view_cells_filter_max_size=1 -preprocessor_stats=$PREFIX-r-reference.log \ 39 # -preprocessor_histogram_file=$PREFIX-r-reference.hlog 40 40 41 41 … … 47 47 48 48 49 ####### 50 ####### 51 $COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 52 -rss_use_importance- -rss_object_based_sampling- -rss_directional_sampling+ \ 53 -view_cells_filter_max_size=1 -preprocessor_stats=$PREFIX-r-directional-based-b3.log \ 54 -preprocessor_histogram_file=$PREFIX-r-directional-based-b3.hlog 49 # ####### 50 # ####### 51 # $COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 52 # -rss_use_importance- -rss_object_based_sampling- -rss_directional_sampling+ \ 53 # -view_cells_filter_max_size=1 -preprocessor_stats=$PREFIX-r-directional-based-b3.log \ 54 # -preprocessor_histogram_file=$PREFIX-r-directional-based-b3.hlog 55 56 # $COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 57 # -rss_use_importance- -rss_object_based_sampling- -rss_directional_sampling- \ 58 # -view_cells_filter_max_size=1 -preprocessor_stats=$PREFIX-r-spatial-based-bb3.log \ 59 # -preprocessor_histogram_file=$PREFIX-r-spatial-based-bb3.hlog 60 55 61 56 62 $COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 57 -rss_use_importance- -rss_object_based_sampling- -rss_directional_sampling-\58 -view_cells_filter_max_size=1 -preprocessor_stats=$PREFIX-r-spatial-based-bb3.log \59 -preprocessor_histogram_file=$PREFIX-r-spatial-based-bb3.hlog63 -rss_use_importance+ -rss_use_rss_tree- -view_cells_filter_max_size=1 \ 64 -preprocessor_stats=$PREFIX-i-mixed-b1.log \ 65 -preprocessor_histogram_file=$PREFIX-i-mixed-b1.hlog 60 66 61 62
Note: See TracChangeset
for help on using the changeset viewer.