Changeset 1676 for GTP/trunk/Lib/Vis
- Timestamp:
- 10/24/06 17:42:03 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis
- Files:
-
- 1 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBoundingBoxConverter.h
r1623 r1676 135 135 continue; 136 136 } 137 mo->137 138 138 const AxisAlignedBox bbox = EnlargeBox(mo->getWorldBoundingBox()); 139 139 … … 225 225 226 226 // get intersecting scene nodes (= candidates) 227 AxisAlignedBox mybox = EnlargeBox(box);227 //AxisAlignedBox mybox = EnlargeBox(box); 228 228 //mSceneMgr->findNodesIn(mybox, sceneNodeList, NULL); 229 229 mSceneMgr->findNodesIn(box, sceneNodeList, NULL); … … 253 253 const AxisAlignedBox bbox = mo->getWorldBoundingBox(); 254 254 255 const bool overlaps = Overlap(nodeBox, 256 OgreTypeConverter::ConvertFromOgre(bbox) 257 ); 258 //,0.00001); 255 const bool overlaps = 256 Overlap(nodeBox, OgreTypeConverter::ConvertFromOgre(bbox)); 257 259 258 260 259 if (overlaps) -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp
r1640 r1676 1201 1201 bool OcclusionCullingSceneManager::LoadViewCells(const String &filename) 1202 1202 { 1203 if (mViewCellsLoaded) return true; 1203 if (mViewCellsLoaded) 1204 return true; 1205 1204 1206 // converter between view cell ids and Ogre entites 1205 GtpVisibilityPreprocessor::IndexedBoundingBoxContainer iboxes;1206 1207 OctreeBoundingBoxConverter bconverter(this); 1207 1208 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/Plugin_VisibilitySceneManager.vcproj
r1320 r1676 312 312 Name="VCLinkerTool" 313 313 IgnoreImportLibrary="TRUE" 314 AdditionalDependencies="OgreMain.lib CEGUIBase.lib OgreGUIRenderer.lib Plugin_OctreeSceneManager.lib GtpVisibility.lib zdll.lib zziplib.lib Preprocessor.lib xerces-c_2.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib cg.lib cgGL.libglew32.lib glew32s.lib"314 AdditionalDependencies="OgreMain.lib CEGUIBase.lib OgreGUIRenderer.lib Plugin_OctreeSceneManager.lib GtpVisibility.lib zdll.lib zziplib.lib Preprocessor.lib xerces-c_2.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib glew32.lib glew32s.lib" 315 315 OutputFile="$(OutDir)/Plugin_VisibilitySceneManager.dll" 316 316 Version="0.99" -
GTP/trunk/Lib/Vis/Preprocessing/scripts/vsposp_typical.sh
r1673 r1676 60 60 61 61 ################################################################################## 62 63 METHOD=gradient-mem 62 MEMCONST=0.8 63 METHOD=gradient-mem-$MEMCONST 64 64 echo "$SCENE $METHOD" 65 65 … … 71 71 -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 72 72 -hierarchy_construction_type=2 \ 73 -hierarchy_construction_consider_memory2=true \ 74 -bvh_construction_render_cost_decrease_weight=0.99 \ 75 -vsp_construction_render_cost_decrease_weight=0.99 \ 76 -hierarchy_construction_multilevel=false \ 77 -hierarchy_term_memory_const=0.9 \ 78 -hierarchy_construction_recompute_split_on_repair=true 79 80 sh movefiles.sh $LOG_PREFIX-$METHOD 73 -hierarchy_construction_consider_memory=true \ 74 -bvh_construction_render_cost_decrease_weight=0.99 \ 75 -vsp_construction_render_cost_decrease_weight=0.99 \ 76 -hierarchy_construction_multilevel=false \ 77 -hierarchy_term_memory_const=$MEMCONST \ 78 -hierarchy_construction_recompute_split_on_repair=true 79 80 sh movefiles.sh $LOG_PREFIX-$METHOD 81 82 83 ################################################################################## 84 MEMCONST=0.5 85 METHOD=gradient-mem-$MEMCONST 86 echo "$SCENE $METHOD" 87 88 $PROGRAM $ENVIRONMENT \ 89 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 90 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 91 -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 92 -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 93 -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 94 -hierarchy_construction_type=2 \ 95 -hierarchy_construction_consider_memory=true \ 96 -bvh_construction_render_cost_decrease_weight=0.99 \ 97 -vsp_construction_render_cost_decrease_weight=0.99 \ 98 -hierarchy_construction_multilevel=false \ 99 -hierarchy_term_memory_const=$MEMCONST \ 100 -hierarchy_construction_recompute_split_on_repair=true 101 102 sh movefiles.sh $LOG_PREFIX-$METHOD 103 104 ################################################################################## 105 MEMCONST=0.2 106 METHOD=gradient-mem-$MEMCONST 107 echo "$SCENE $METHOD" 108 109 $PROGRAM $ENVIRONMENT \ 110 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 111 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 112 -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 113 -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 114 -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 115 -hierarchy_construction_type=2 \ 116 -hierarchy_construction_consider_memory=true \ 117 -bvh_construction_render_cost_decrease_weight=0.99 \ 118 -vsp_construction_render_cost_decrease_weight=0.99 \ 119 -hierarchy_construction_multilevel=false \ 120 -hierarchy_term_memory_const=$MEMCONST \ 121 -hierarchy_construction_recompute_split_on_repair=true 122 123 sh movefiles.sh $LOG_PREFIX-$METHOD 124 81 125 82 126 -
GTP/trunk/Lib/Vis/Preprocessing/src/BoundingBoxConverter.h
r1545 r1676 21 21 { 22 22 public: 23 //BoundingBoxConverter();24 23 /** Takes a vector of indexed bounding boxes and uses it to identify objects with a similar bounding box 25 and to assign the index.24 and assigns them their index (id). 26 25 The objects are returned in the object container. 27 26 -
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1673 r1676 251 251 Environment::GetSingleton()->GetBoolValue("BvHierarchy.useCostHeuristics", mUseCostHeuristics); 252 252 Environment::GetSingleton()->GetBoolValue("BvHierarchy.useSah", mUseSah); 253 254 253 254 char subdivisionStatsLog[100]; 255 255 Environment::GetSingleton()->GetStringValue("BvHierarchy.subdivisionStats", subdivisionStatsLog); 256 256 mSubdivisionStats.open(subdivisionStatsLog); … … 260 260 261 261 Environment::GetSingleton()->GetBoolValue("BvHierarchy.Construction.useGlobalSorting", mUseGlobalSorting); 262 Environment::GetSingleton()->GetIntValue("BvHierarchy.minRaysForVisibility", mMinRaysForVisibility); 263 262 264 263 265 mUseBboxAreaForSah = true; … … 283 285 Debug << "render cost decrease weight: " << mRenderCostDecreaseWeight << endl; 284 286 Debug << "use global sort: " << mUseGlobalSorting << endl; 287 Debug << "minimal rays for visibility: " << mMinRaysForVisibility << endl; 288 285 289 Debug << endl; 286 290 } … … 487 491 if (computeSplitPlane) 488 492 { 493 const bool sufficientSamples = splitCandidate.mParentData.mNumRays < mMinRaysForVisibility; 494 495 const bool useVisibiliyBasedHeuristics = 496 !mUseSah && 497 !(mHierarchyManager->GetViewSpaceSubdivisionType() == HierarchyManager::KD_BASED_VIEWSPACE_SUBDIV) && 498 sufficientSamples; 499 489 500 // compute best object partition 490 501 const float ratio = SelectObjectPartition(splitCandidate.mParentData, 491 502 splitCandidate.mFrontObjects, 492 splitCandidate.mBackObjects); 503 splitCandidate.mBackObjects, 504 useVisibiliyBasedHeuristics); 493 505 494 506 // cost ratio violated? … … 497 509 const int previousMisses = splitCandidate.mParentData.mMaxCostMisses; 498 510 499 splitCandidate.SetMaxCostMisses(maxCostRatioViolated ? 500 previousMisses + 1 : previousMisses); 511 splitCandidate.SetMaxCostMisses(maxCostRatioViolated ? previousMisses + 1 : previousMisses); 501 512 502 513 } … … 1218 1229 float BvHierarchy::SelectObjectPartition(const BvhTraversalData &tData, 1219 1230 ObjectContainer &frontObjects, 1220 ObjectContainer &backObjects) 1231 ObjectContainer &backObjects, 1232 bool useVisibilityBasedHeuristics) 1221 1233 { 1222 1234 ObjectContainer nFrontObjects[3]; … … 1245 1257 //-- split objects using heuristics 1246 1258 1247 if (!mUseSah && 1248 (mHierarchyManager->GetViewSpaceSubdivisionType() == 1249 HierarchyManager::KD_BASED_VIEWSPACE_SUBDIV)) 1259 if (useVisibilityBasedHeuristics) 1250 1260 { 1251 1261 /////////// -
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h
r1673 r1676 444 444 if (hm->ConsiderMemory()) 445 445 { 446 const float rc = hm->GetHierarchyStats().mTotalCost - mRenderCostDecrease;447 const float mc = hm->GetHierarchyStats().mMemory +448 (float)mPvsEntriesIncr * ObjectPvs::GetEntrySizeByte();449 450 return - (rc * mc) / float(1024 * 1024);446 const float rc = mRenderCostDecrease / hm->GetHierarchyStats().mTotalCost; 447 //const float mc = mMemoryIncr / / hm->GetHierarchyStats().mMemory; 448 const float mc = (float)mPvsEntriesIncr / (float)hm->GetHierarchyStats().mPvsEntries; 449 //cout << "x"; 450 return hm->GetMemoryConst() * rc + (1.0f - hm->GetMemoryConst()) * mc; 451 451 } 452 452 else … … 672 672 float SelectObjectPartition(const BvhTraversalData &tData, 673 673 ObjectContainer &frontObjects, 674 ObjectContainer &backObjects); 674 ObjectContainer &backObjects, 675 bool useVisibilityBasedHeuristics); 675 676 676 677 /** Writes the node to disk … … 733 734 float PrepareHeuristics(const BvhTraversalData &tData, const int axis); 734 735 735 /** Reevaluates the priority of this split candidate736 @returns priority737 */738 //float EvalPriority(const BvhSubdivisionCandidate &splitCandidate) const;739 736 740 737 //////////////////////////////////////////////// … … 924 921 925 922 SortableEntryContainer *mSortedObjects[3]; 923 924 int mMinRaysForVisibility; 926 925 }; 927 926 -
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r1673 r1676 2466 2466 "true"); 2467 2467 2468 2468 RegisterOption("BvHierarchy.minRaysForVisibility", 2469 optInt, 2470 "bvh_min_rays_for_vis=", 2471 "0"); 2472 2469 2473 2470 2474 /*******************************************************************/ -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r1673 r1676 256 256 257 257 // calculate cost in MB 258 const float memoryCost = mHierarchyStats.mMemory / (1024.0f * 1024.0f)258 const float memoryCost = mHierarchyStats.mMemory / float(1024 * 1024) 259 259 + objectSpaceMem + viewSpaceMem; 260 260 … … 383 383 // number of initial splits 384 384 const int minSteps = mMinStepsOfSameType; 385 const int maxSteps = mMinStepsOfSameType + 500; 385 386 float renderCostDecr = Limits::Infinity; 386 387 387 SubdivisionCandidate *osc = 388 PrepareObjectSpaceSubdivision(sampleRays, objects); 388 SubdivisionCandidate *osc = PrepareObjectSpaceSubdivision(sampleRays, objects); 389 389 390 390 objectSpaceQueue.Push(osc); … … 399 399 // for first round, use sah splits. Once view space partition 400 400 // has started, use render cost heuristics instead 401 const int ospSteps = RunConstruction(objectSpaceQueue, dirtyVspList, NULL, minSteps); 401 const int ospSteps = 402 RunConstruction(objectSpaceQueue, dirtyVspList, NULL, minSteps, maxSteps); 402 403 403 404 cout << "\n" << ospSteps << " object space partition steps taken" << endl; … … 440 441 // for first round, use sah splits. Once view space partition 441 442 // has started, use render cost heuristics instead 442 const int ospSteps = 443 RunConstruction(objectSpaceQueue, dirtyVspList, viewSpaceQueue.Top(), minSteps); 443 const int ospSteps = RunConstruction(objectSpaceQueue, 444 dirtyVspList, 445 viewSpaceQueue.Top(), 446 minSteps, 447 maxSteps); 444 448 445 449 cout << "\n" << ospSteps << " object space partition steps taken" << endl; … … 461 465 // process view space candidates 462 466 const int vspSteps = 463 RunConstruction(viewSpaceQueue, dirtyOspList, objectSpaceQueue.Top(), minSteps );467 RunConstruction(viewSpaceQueue, dirtyOspList, objectSpaceQueue.Top(), minSteps, maxSteps); 464 468 465 469 cout << "\n" << vspSteps << " view space partition steps taken" << endl; … … 700 704 701 705 // memory size in byte 702 mHierarchyStats.mMemory += (float)ObjectPvs::GetEntrySizeByte() ;706 mHierarchyStats.mMemory += (float)ObjectPvs::GetEntrySizeByte() * pvsEntriesIncr; 703 707 mHierarchyStats.mRenderCostDecrease = sc->GetRenderCostDecrease(); 704 708 … … 841 845 842 846 cout << "\nstarting object space subdivision after " 843 << mVspTree->mVspStats.nodes << " (" 844 << mMinStepsOfSameType << ") " << endl; 847 << mVspTree->mVspStats.nodes << " (" << mMinStepsOfSameType << ") " << endl; 845 848 846 849 SubdivisionCandidate *ospSc = PrepareObjectSpaceSubdivision(sampleRays, objects); … … 895 898 SubdivisionCandidateContainer &dirtyCandidates, 896 899 SubdivisionCandidate *oldCandidate, 897 const int minSteps) 898 { 900 const int minSteps, 901 const int maxSteps) 902 { 903 if (minSteps >= maxSteps) 904 cout << "error!! " << minSteps << " equal or larger maxSteps" << endl; 905 899 906 int steps = 0; 900 907 SubdivisionCandidate::NewMail(); … … 908 915 909 916 // minimum slope reached 910 if ((sc->GetPriority() < threshold) && !(steps < minSteps)) 911 { 912 cout << "**************** breaking on " << sc->GetPriority() << " smaller than " << threshold << endl; 917 if ((steps > maxSteps) || 918 ((sc->GetPriority() < threshold) && !(steps < minSteps))) 919 { 920 cout << "\n**************** breaking on " << sc->GetPriority() << " smaller than " << threshold << endl; 913 921 break; 914 922 } -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
r1673 r1676 233 233 234 234 inline bool ConsiderMemory() const { return mConsiderMemory; } 235 inline float GetMemoryConst() const { return mMemoryConst; } 236 235 237 236 238 protected: … … 273 275 //const float minRenderCostDecr, 274 276 SubdivisionCandidate *oldCandidate, 275 const int minSteps); 277 const int minSteps, 278 const int maxSteps); 276 279 277 280 /** Default subdivision method. -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1667 r1676 602 602 ViewCellsManager *ViewCellsManager::LoadViewCells(const string &filename, 603 603 ObjectContainer *objects, 604 constbool finalizeViewCells,604 bool finalizeViewCells, 605 605 BoundingBoxConverter *bconverter) 606 606 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r1666 r1676 447 447 static ViewCellsManager *LoadViewCells(const string &filename, 448 448 ObjectContainer *objects, 449 const bool finalizeViewCells,449 bool finalizeViewCells = false, 450 450 BoundingBoxConverter *bconverter = NULL); 451 451 -
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.h
r1673 r1676 491 491 if (hm->ConsiderMemory()) 492 492 { 493 const float rc = hm->GetHierarchyStats().mTotalCost - mRenderCostDecrease; 494 const float mc = hm->GetHierarchyStats().mMemory + 495 (float)mPvsEntriesIncr * ObjectPvs::GetEntrySizeByte(); 496 497 return - (rc * mc) / float(1024 * 1024); 493 const float rc = mRenderCostDecrease / hm->GetHierarchyStats().mTotalCost; 494 const float mc = (float)mPvsEntriesIncr / (float)hm->GetHierarchyStats().mPvsEntries; 495 //cout << "y"; 496 return hm->GetMemoryConst() * rc + (1.0f - hm->GetMemoryConst()) * mc; 498 497 } 499 498 else
Note: See TracChangeset
for help on using the changeset viewer.