Changeset 1703 for GTP/trunk/Lib/Vis
- Timestamp:
- 10/31/06 10:57:14 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/vsposp_typical.sh
r1687 r1703 20 20 #SCENE=vienna 21 21 22 LOG_PREFIX=../scripts/tests/i3d/$SCENE 22 LOG_PREFIX=../scripts/tests/i3d/$SCENE-heur 23 23 24 24 ENVIRONMENT=$SCENE.env … … 61 61 echo "$SCENE $METHOD" 62 62 63 $PROGRAM $ENVIRONMENT \63 # $PROGRAM $ENVIRONMENT \ 64 64 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 65 65 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ … … 78 78 79 79 ############################################################################ 80 NODES=100080 OBJ_SPLITS=3000 81 81 82 METHOD=sequential-$ NODES82 METHOD=sequential-$OBJ_SPLITS 83 83 echo "$SCENE $METHOD" 84 84 85 #$PROGRAM $ENVIRONMENT \85 $PROGRAM $ENVIRONMENT \ 86 86 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 87 87 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ … … 90 90 -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 91 91 -hierarchy_construction_type=0 \ 92 -bvh_term_max_leaves=$ NODES92 -bvh_term_max_leaves=$OBJ_SPLITS 93 93 94 94 sh movefiles.sh $LOG_PREFIX-$METHOD 95 95 96 96 ############################################################################ 97 OBJ_SPLITS=2000 97 98 98 NODES=10000 99 100 METHOD=sequential-$NODES 99 METHOD=sequential-$OBJ_SPLITS 101 100 echo "$SCENE $METHOD" 102 101 103 #$PROGRAM $ENVIRONMENT \102 $PROGRAM $ENVIRONMENT \ 104 103 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 105 104 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ … … 108 107 -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 109 108 -hierarchy_construction_type=0 \ 110 -bvh_term_max_leaves=$ NODES109 -bvh_term_max_leaves=$OBJ_SPLITS 111 110 112 111 sh movefiles.sh $LOG_PREFIX-$METHOD 113 112 113 ############################################################################ 114 OBJ_SPLITS=1000 114 115 115 ######################################################################## 116 METHOD=sequential-$OBJ_SPLITS 117 echo "$SCENE $METHOD" 116 118 117 METHOD=gradient_simplesplit 118 echo "$SCENE $METHOD" 119 120 #$PROGRAM $ENVIRONMENT \ 121 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 122 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 119 $PROGRAM $ENVIRONMENT \ 120 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 121 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 123 122 -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 124 123 -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 125 -bvh_use_sah=true \126 -vsp_use_cost_heuristics=true \127 124 -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 128 -hierarchy_construction_type= 2\129 - hierarchy_construction_recompute_split_on_repair=true125 -hierarchy_construction_type=0 \ 126 -bvh_term_max_leaves=$OBJ_SPLITS 130 127 131 128 sh movefiles.sh $LOG_PREFIX-$METHOD 132 133 -
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1698 r1703 801 801 } 802 802 803 const float oldRenderCost = EvalRenderCost(tData.mNode->mObjects); 804 const float newRenderCost = EvalRenderCost(objectsFront) + EvalRenderCost(objectsBack); 805 806 const float ratio = newRenderCost / oldRenderCost; 807 return ratio; 803 float heur = 0; 804 805 if (tData.mNode->GetBoundingBox().Size().DrivingAxis() == axis) 806 { 807 heur = -1; 808 } 809 810 return heur; 808 811 } 809 812 #endif … … 1111 1114 #ifdef _DEBUG 1112 1115 Debug << "\n§§§§ bvh eval const decrease §§§§" << endl 1113 << "back pvs: " << (int)objectsBack.size() << " front pvs: " << (int)objectsFront.size() << " total pvs: " << nTotalObjects << endl 1114 << "back p: " << volBack / viewSpaceVol << " front p " << volFront / viewSpaceVol << " p: " << totalVol / viewSpaceVol << endl 1115 << "old rc: " << oldRenderCost / viewSpaceVol << " new rc: " << newRenderCost / viewSpaceVol << endl 1116 << "render cost decrease: " << oldRenderCost / viewSpaceVol - newRenderCost / viewSpaceVol << endl; 1116 << "back pvs: " << (int)objectsBack.size() << " front pvs: " 1117 << (int)objectsFront.size() << " total pvs: " << nTotalObjects << endl 1118 << "back p: " << volBack / viewSpaceVol << " front p " 1119 << volFront / viewSpaceVol << " p: " << totalVol / viewSpaceVol << endl 1120 << "old rc: " << oldRenderCost / viewSpaceVol << " new rc: " 1121 << newRenderCost / viewSpaceVol << endl 1122 << "render cost decrease: " 1123 << oldRenderCost / viewSpaceVol - newRenderCost / viewSpaceVol << endl; 1117 1124 #endif 1118 1125 … … 1302 1309 //-- heuristics using objects weighted by view cells volume 1303 1310 nCostRatio[axis] = 1304 EvalLocalCostHeuristics(tData, axis, nFrontObjects[axis], nBackObjects[axis]); 1311 EvalLocalCostHeuristics(tData, 1312 axis, 1313 nFrontObjects[axis], 1314 nBackObjects[axis]); 1305 1315 } 1306 1316 else … … 1308 1318 ////////////////// 1309 1319 //-- view cells not constructed yet => use surface area heuristic 1310 nCostRatio[axis] = 1311 EvalSah(tData, axis, nFrontObjects[axis], nBackObjects[axis]); 1320 nCostRatio[axis] = EvalSah(tData, 1321 axis, 1322 nFrontObjects[axis], 1323 nBackObjects[axis]); 1312 1324 } 1313 1325 } … … 1319 1331 } 1320 1332 1321 if ( bestAxis == -1)1333 if ((bestAxis == -1) || (nCostRatio[axis] < nCostRatio[bestAxis])) 1322 1334 { 1323 1335 bestAxis = axis; 1324 1336 } 1325 else if (nCostRatio[axis] < nCostRatio[bestAxis])1326 {1327 bestAxis = axis;1328 }1329 1337 } 1330 1338 } … … 1336 1344 backObjects = nBackObjects[bestAxis]; 1337 1345 1338 // Debug<< "val: " << nCostRatio[bestAxis] << " axis: " << bestAxis << endl;1346 //cout << "val: " << nCostRatio[bestAxis] << " axis: " << bestAxis << endl; 1339 1347 return nCostRatio[bestAxis]; 1340 1348 } … … 1419 1427 1420 1428 1421 float BvHierarchy::EvalAbsCost(const ObjectContainer &objects) const1429 float BvHierarchy::EvalAbsCost(const ObjectContainer &objects)// const 1422 1430 { 1423 1431 #if USE_BETTER_RENDERCOST_EST … … 1426 1434 for (oit = objects.begin(); oit != oit_end; ++ oit) 1427 1435 { 1428 objRenderCost += mViewCellsManager->GetRendercost(*oit);1436 objRenderCost += ViewCellsManager::GetRendercost(*oit); 1429 1437 } 1430 1438 #else -
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h
r1698 r1703 609 609 ///////////////////////////////// 610 610 611 float EvalAbsCost(const ObjectContainer &objects) const;611 static float EvalAbsCost(const ObjectContainer &objects); 612 612 613 613 protected: -
GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.cpp
r1586 r1703 76 76 77 77 78 /** Returns the the number of differentobjects in the leaves of the node.79 We eliminate already accounted kdnodes and objects using mailboxing.78 /** Returns the the number of new (unmailed) objects in the leaves of the node. 79 We eliminate already accounted bvh nodes and objects using mailboxing. 80 80 */ 81 81 static int EvalBvhNodeContribution(BvhIntersectable *bvhobj) … … 115 115 116 116 // add #objects exclusivly in this node 117 pvs += (int)leaf->mObjects.size();117 pvs += BvHierarchy::EvalAbsCost(leaf->mObjects); 118 118 } 119 119 else // traverse tree -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1701 r1703 33 33 #define KD_PVS_AREA (5*1e-4f) 34 34 35 36 35 37 namespace GtpVisibilityPreprocessor { 36 38 … … 38 40 // HACK 39 41 const static bool SAMPLE_AFTER_SUBDIVISION = true; 40 const static bool CLAMP_TO_BOX = true; 42 const static bool CLAMP_TO_BOX = false; 43 44 int ViewCellsManager::sRenderCostEvaluationType = 0; 45 41 46 42 47 template <typename T> class myless … … 101 106 Environment::GetSingleton()->GetIntValue("ViewCells.Filter.maxSize", mMaxFilterSize); 102 107 Environment::GetSingleton()->GetFloatValue("ViewCells.Filter.width", mFilterWidth); 103 Environment::GetSingleton()->GetIntValue("ViewCells.renderCostEvaluationType", mRenderCostEvaluationType);108 Environment::GetSingleton()->GetIntValue("ViewCells.renderCostEvaluationType", sRenderCostEvaluationType); 104 109 105 110 Environment::GetSingleton()->GetBoolValue("ViewCells.exportBboxesForPvs", mExportBboxesForPvs); … … 179 184 if (strcmp(buf, "perobject") == 0) 180 185 { 181 mRenderCostEvaluationType = ViewCellsManager::PER_OBJECT;182 } 183 else if (strcmp(buf, " directional") == 0)184 { 185 mRenderCostEvaluationType = ViewCellsManager::PER_TRIANGLE;186 sRenderCostEvaluationType = ViewCellsManager::PER_OBJECT; 187 } 188 else if (strcmp(buf, "pertriangle") == 0) 189 { 190 sRenderCostEvaluationType = ViewCellsManager::PER_TRIANGLE; 186 191 } 187 192 else … … 224 229 Debug << "evaluate view cells: " << mEvaluateViewCells << endl; 225 230 Debug << "sampling type: " << mSamplingType << endl; 226 Debug << "render cost evaluation type: " << mRenderCostEvaluationType << endl;231 Debug << "render cost evaluation type: " << sRenderCostEvaluationType << endl; 227 232 Debug << "evaluation sampling type: " << mEvaluationSamplingType << endl; 228 233 Debug << "show visualization: " << mShowVisualization << endl; … … 1091 1096 1092 1097 1093 float ViewCellsManager::EvalRenderCost(Intersectable *obj) const1094 { 1095 switch ( mRenderCostEvaluationType)1098 float ViewCellsManager::EvalRenderCost(Intersectable *obj) //const 1099 { 1100 switch (sRenderCostEvaluationType) 1096 1101 { 1097 1102 case PER_OBJECT: 1098 //cout << "perobject" << endl;1099 1103 return 1.0f; 1100 1104 1101 1105 case PER_TRIANGLE: 1102 { //cout << "pertriangle" << endl;1106 { 1103 1107 return (float)obj->NumberOfFaces(); 1104 1108 } … … 5187 5191 AxisAlignedBox3 bbox = mViewSpaceBox; 5188 5192 bbox.Scale(Vector3(0.5, 1, 0.5)); 5193 5189 5194 if (CLAMP_TO_BOX) 5190 5195 { … … 5204 5209 } 5205 5210 5206 mHierarchyManager->ExportObjectSpaceHierarchy(exporter, objects, CLAMP_TO_BOX ? &bbox : NULL, false); 5211 mHierarchyManager->ExportObjectSpaceHierarchy(exporter, 5212 objects, CLAMP_TO_BOX ? &bbox : NULL, false); 5207 5213 ExportViewCellsForViz(exporter, CLAMP_TO_BOX ? &bbox : NULL, GetClipPlane()); 5208 5214 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r1692 r1703 409 409 /** Evaluates the render cost of a view cell. 410 410 */ 411 float EvalRenderCost(Intersectable *obj) const;411 static float EvalRenderCost(Intersectable *obj); 412 412 413 413 /** Sets pvs size of view cell as a scalar. Used when storing pvs only in the leaves … … 711 711 bool mViewCellsFinished; 712 712 bool mEvaluateViewCells; 713 int mRenderCostEvaluationType;714 713 715 714 /// if pvs should be exported with view cells 716 715 bool mExportPvs; 717 716 717 static int sRenderCostEvaluationType; 718 719 /// if view cells geometry should be used from other sources 718 720 bool mUsePredefinedViewCells; 719 721 }; -
GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
r1701 r1703 106 106 { 107 107 string currentFile = *sit; 108 //cout << "here6 " << currentFile << endl;109 108 string strippedFilename; 110 109
Note: See TracChangeset
for help on using the changeset viewer.