Changeset 445
- Timestamp:
- 12/02/05 20:38:01 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env
r444 r445 102 102 #type kdTree 103 103 #type vspTree 104 type bspTree 104 #type bspTree 105 type vspBspTree 106 105 107 #type sceneDependent 106 108 … … 112 114 minPvs 10 113 115 maxPvs 150 116 # how much samples are used for post processing 114 117 samples 10 115 118 } 116 119 120 Visualization { 121 # how much samples are be used for visualization 122 samples 90000 123 } 117 124 118 125 # filename ../data/atlanta/atlanta_viewcells_large.x3d … … 176 183 leastRaySplits 1.0 177 184 balancedRays 1.0 178 pvs Factor1.0185 pvs 1.0 179 186 leastSplits 1.0 180 187 balancedPolys 1.0 … … 213 220 # x3d visualization of the split planes 214 221 exportSplits true 215 # how much samples should be used in visualization216 samples 90000217 222 } 218 223 } … … 270 275 ct_div_ci 0.0 271 276 } 277 278 VspBspTree { 279 Construction { 280 samples 200000 281 sideTolerance 0.005 282 } 283 284 285 # random polygon = 1 286 # axis aligned = 2 287 # least ray splits = 256 288 # balanced rays = 512 289 # pvs = 1024 290 291 splitPlaneStrategy 1024 292 293 # maximal candidates for split planes 294 maxPolyCandidates 50 295 maxRayCandidates 50 296 297 # maximal tested rays for split cost heuristics 298 maxTests 10000 299 300 # factors for evaluating split plane costs 301 Factor { 302 leastRaySplits 1.0 303 balancedRays 1.0 304 pvs 1.0 305 } 306 307 Termination { 308 # parameters used for autopartition 309 minRays 200 310 minPolygons -1 311 maxDepth 50 312 minPvs 100 313 minArea 0.01 314 maxRayContribution 0.005 315 #maxAccRayLength 100 316 317 # used for pvs criterium 318 ct_div_ci 0.0 319 320 # axis aligned splits 321 AxisAligned { 322 minPolys 5000 323 minRays 500 324 minObjects 10 325 maxCostRatio 0.9 326 ct_div_ci 0.5 327 } 328 } 329 330 AxisAligned { 331 splitBorder 0.01 332 } 333 334 335 Visualization { 336 # x3d visualization of the split planes 337 exportSplits true 338 } 339 } -
trunk/VUT/GtpVisibilityPreprocessor/src/Environment.cpp
r441 r445 1175 1175 "true"); 1176 1176 1177 1178 /************************************************************************************/ 1179 /* View cells related options */ 1180 /************************************************************************************/ 1181 1182 1177 1183 RegisterOption("ViewCells.type", 1178 1184 optString, … … 1180 1186 "bspTree"); 1181 1187 1188 RegisterOption("ViewCells.PostProcessing.samples", 1189 optInt, 1190 "-bsp_postprocessing_samples=", 1191 "200000"); 1192 1193 RegisterOption("ViewCells.Visualization.samples", 1194 optInt, 1195 "-view_cells_visualization_samples=", 1196 "20000"); 1197 1182 1198 RegisterOption("ViewCells.loadFromFile", 1183 1199 optBool, … … 1215 1231 "5.0"); 1216 1232 1233 /************************************************************************************/ 1234 /* Render simulation related options */ 1235 /************************************************************************************/ 1236 1237 1217 1238 RegisterOption("Simulation.objRenderCost", 1218 1239 optFloat, … … 1229 1250 "-simulation_moveSpeed", 1230 1251 "1.0"); 1252 1253 1254 1255 1256 /************************************************************************************/ 1257 /* Bsp tree related options */ 1258 /************************************************************************************/ 1259 1231 1260 1232 1261 RegisterOption("BspTree.Construction.input", … … 1240 1269 "100000"); 1241 1270 1242 RegisterOption("ViewCells.PostProcessing.samples",1243 optInt,1244 "-bsp_postprocessing_samples=",1245 "200000");1246 1247 1271 RegisterOption("BspTree.Construction.sideTolerance", 1248 1272 optFloat, … … 1340 1364 "5000"); 1341 1365 1342 RegisterOption("BspTree.Visualization.samples",1343 optInt,1344 "-bsp_visualization_samples=",1345 "20000");1346 1347 1366 RegisterOption("BspTree.Visualization.exportSplits", 1348 1367 optBool, … … 1353 1372 RegisterOption("BspTree.Factor.largestPolyArea", optFloat, "-bsp_factor_largest_poly=", "1.0"); 1354 1373 RegisterOption("BspTree.Factor.blockedRays", optFloat, "-bsp_factor_blocked=", "1.0"); 1355 RegisterOption("BspTree.Factor.leastRaySplits", optFloat, "-bsp_factor_least_ray_splits=", "1.0");1356 RegisterOption("BspTree.Factor.balancedRays", optFloat, "-bsp_factor_balanced_rays=", "1.0");1357 RegisterOption("BspTree.Factor.pvsFactor", optFloat, "-bsp_factor_pvs=", "1.0");1358 1374 RegisterOption("BspTree.Factor.leastSplits", optFloat, "-bsp_factor_least_splits=", "1.0"); 1359 1375 RegisterOption("BspTree.Factor.balancedPolys", optFloat, "-bsp_factor_balanced_polys=", "1.0"); 1360 1376 RegisterOption("BspTree.Factor.balancedViewCells", optFloat, "-bsp_factor_balanced_view_cells=", "1.0"); 1377 RegisterOption("BspTree.Factor.leastRaySplits", optFloat, "-bsp_factor_least_ray_splits=", "1.0"); 1378 RegisterOption("BspTree.Factor.balancedRays", optFloat, "-bsp_factor_balanced_rays=", "1.0"); 1379 RegisterOption("BspTree.Factor.pvs", optFloat, "-bsp_factor_pvs=", "1.0"); 1380 1381 /************************************************************************************/ 1382 /* Preprocessor related options */ 1383 /************************************************************************************/ 1361 1384 1362 1385 RegisterOption("Preprocessor.type", … … 1366 1389 1367 1390 1391 /**************************************************************************************/ 1392 /* View space partition KD tree related options */ 1393 /**************************************************************************************/ 1394 1368 1395 RegisterOption("VspKdTree.Construction.samples", 1369 1396 optInt, … … 1449 1476 "4"); 1450 1477 1478 /************************************************************************************/ 1479 /* VSS Preprocessor cells related options */ 1480 /************************************************************************************/ 1481 1451 1482 RegisterOption("VssTree.maxDepth", optInt, "kd_depth=", "12"); 1452 1483 RegisterOption("VssTree.minPvs", optInt, "kd_minpvs=", "1"); … … 1462 1493 1463 1494 RegisterOption("VssTree.useRss", optBool, "rss=", "false"); 1464 1465 1466 1467 1495 RegisterOption("VssTree.numberOfEndPointDomains", optInt, "endpoints=", "10000"); 1468 1496 … … 1486 1514 1487 1515 1516 1517 /************************************************************************************/ 1518 /* View space partition BSP tree related options */ 1519 /************************************************************************************/ 1520 1521 1522 RegisterOption("VspBspTree.Termination.minPolygons", 1523 optInt, 1524 "-vsp_bsp_term_min_polygons=", 1525 "5"); 1526 1527 RegisterOption("VspBspTree.Termination.minPvs", 1528 optInt, 1529 "-vsp_bsp_term_min_pvs=", 1530 "20"); 1531 1532 RegisterOption("VspBspTree.Termination.minArea", 1533 optFloat, 1534 "-vsp_bsp_term_min_area=", 1535 "0.001"); 1536 1537 RegisterOption("VspBspTree.Termination.maxRayContribution", 1538 optFloat, 1539 "-vsp_bsp_term_ray_contribution=", 1540 "0.005"); 1541 1542 RegisterOption("VspBspTree.Termination.minAccRayLenght", 1543 optFloat, 1544 "-vsp_bsp_term_min_acc_ray_length=", 1545 "50"); 1546 1547 RegisterOption("VspBspTree.Termination.minRays", 1548 optInt, 1549 "-vsp_bsp_term_min_rays=", 1550 "-1"); 1551 1552 RegisterOption("VspBspTree.Termination.ct_div_ci", 1553 optFloat, 1554 "-vsp_bsp_term_ct_div_ci=", 1555 "0.0"); 1556 1557 RegisterOption("VspBspTree.Termination.maxDepth", 1558 optInt, 1559 "-vsp_bsp_term_max_depth=", 1560 "100"); 1561 1562 RegisterOption("VspBspTree.Termination.AxisAligned.maxCostRatio", 1563 optFloat, 1564 "-vsp_bsp_term_axis_aligned_max_cost_ratio=", 1565 "1.5"); 1566 1567 1568 RegisterOption("VspBspTree.Termination.AxisAligned.ct_div_ci", 1569 optFloat, 1570 "-vsp_bsp_term_axis_aligned_ct_div_ci=", 1571 "0.5"); 1572 1573 RegisterOption("VspBspTree.AxisAligned.splitBorder", 1574 optFloat, 1575 "-vsp_bsp__axis_aligned_split_border=", 1576 "0.1"); 1577 1578 RegisterOption("VspBspTree.Termination.AxisAligned.minPolys", 1579 optInt, 1580 "-vsp_bsp_term_axis_aligned_max_polygons=", 1581 "50"); 1582 1583 RegisterOption("VspBspTree.Termination.AxisAligned.minObjects", 1584 optInt, 1585 "-vsp_bsp_term_min_objects=", 1586 "3"); 1587 1588 RegisterOption("VspBspTree.Termination.AxisAligned.minRays", 1589 optInt, 1590 "-vsp_bsp_term_axis_aligned_min_rays=", 1591 "-1"); 1592 1593 RegisterOption("VspBspTree.splitPlaneStrategy", 1594 optString, 1595 "-vsp_bsp_split_method=", 1596 "leastSplits"); 1597 1598 RegisterOption("VspBspTree.maxPolyCandidates", 1599 optInt, 1600 "-vsp_bsp_max_poly_candidates=", 1601 "20"); 1602 1603 RegisterOption("VspBspTree.maxRayCandidates", 1604 optInt, 1605 "-vsp_bsp_max_plane_candidates=", 1606 "20"); 1607 1608 RegisterOption("VspBspTree.maxTests", 1609 optInt, 1610 "-vsp_bsp_max_tests=", 1611 "5000"); 1612 1613 RegisterOption("VspBspTree.Visualization.exportSplits", 1614 optBool, 1615 "-vsp_bsp_visualization.exportSplits", 1616 "false"); 1617 1618 RegisterOption("VspBspTree.Factor.leastRaySplits", optFloat, "-vsp_bsp_factor_least_ray_splits=", "1.0"); 1619 RegisterOption("VspBspTree.Factor.balancedRays", optFloat, "-vsp_bsp_factor_balanced_rays=", "1.0"); 1620 RegisterOption("VspBspTree.Factor.pvs", optFloat, "-vsp_bsp_factor_pvs=", "1.0"); 1621 1622 ////////////////////////////////////////////////////////////////////////////////// 1488 1623 } 1489 1624 -
trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp
r444 r445 7 7 #include "Environment.h" 8 8 #include "ViewCellsManager.h" 9 #include "ViewCellBsp.h" 10 #include "VspBspTree.h" 11 #include "VspKdTree.h" 9 12 10 13 Preprocessor::Preprocessor(): … … 12 15 mBspTree(NULL), 13 16 mVspKdTree(NULL), 17 mVspBspTree(NULL), 14 18 mViewCellsManager(NULL) 15 19 { … … 22 26 DEL_PTR(mKdTree); 23 27 DEL_PTR(mVspKdTree); 28 DEL_PTR(mVspBspTree); 24 29 DEL_PTR(mViewCellsManager); 25 30 } … … 167 172 environment->GetStringValue("ViewCells.type", viewCellsStr); 168 173 174 int constructionSamples = 0; 175 169 176 if (strcmp(viewCellsStr, "kdTree") == 0) 170 177 { … … 173 180 if (strcmp(viewCellsStr, "bspTree") == 0) 174 181 { 175 int bspConstructionSamples = 0;176 177 182 mBspTree = new BspTree(); 178 183 179 environment->GetIntValue("BspTree.Construction.samples", bspConstructionSamples); 180 mViewCellsManager = new BspViewCellsManager(mBspTree, bspConstructionSamples); 181 } 182 else if (strcmp(viewCellsStr, "vspTree") == 0) 183 { 184 int vspKdConstructionSamples = 0; 185 186 environment->GetIntValue("VspKdTree.Construction.samples", vspKdConstructionSamples); 187 mViewCellsManager = new VspKdViewCellsManager(mVspKdTree, vspKdConstructionSamples); 184 environment->GetIntValue("BspTree.Construction.samples", constructionSamples); 185 mViewCellsManager = new BspViewCellsManager(mBspTree, constructionSamples); 186 } 187 if (strcmp(viewCellsStr, "vspBspTree") == 0) 188 { 189 mVspBspTree = new VspBspTree(); 190 191 environment->GetIntValue("VspBspTree.Construction.samples", constructionSamples); 192 mViewCellsManager = new VspBspViewCellsManager(mVspBspTree, constructionSamples); 193 } 194 else if (strcmp(viewCellsStr, "vspKdTree") == 0) 195 { 196 mVspKdTree = new VspKdTree(); 197 198 environment->GetIntValue("VspKdTree.Construction.samples", constructionSamples); 199 mViewCellsManager = new VspKdViewCellsManager(mVspKdTree, constructionSamples); 188 200 } 189 201 else if (strcmp(viewCellsStr, "sceneDependent") == 0) 190 202 { 191 203 //TODO 192 int bspConstructionSamples = 0;193 194 environment->GetIntValue("BspTree.Construction.samples", bspConstructionSamples);195 mViewCellsManager = new BspViewCellsManager(mBspTree, bspConstructionSamples);204 mBspTree = new BspTree(); 205 206 environment->GetIntValue("BspTree.Construction.samples", constructionSamples); 207 mViewCellsManager = new BspViewCellsManager(mBspTree, constructionSamples); 196 208 } 197 209 else … … 205 217 206 218 environment->GetIntValue("ViewCells.PostProcessing.samples", postProcessSamples); 207 environment->GetIntValue(" BspTree.Visualization.samples", visSamples);219 environment->GetIntValue("ViewCells.Visualization.samples", visSamples); 208 220 209 221 mViewCellsManager->SetPostProcessSamples(postProcessSamples); -
trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.h
r440 r445 7 7 #include "Mesh.h" 8 8 #include "KdTree.h" 9 #include "ViewCellBsp.h"10 #include "ViewCell.h"11 #include "VspKdTree.h"12 9 13 10 class RenderSimulator; … … 15 12 class Exporter; 16 13 class ViewCellsManager; 17 14 class BspTree; 15 class VspKdTree; 16 class VspBspTree; 18 17 19 18 /** Namespace for the external visibility preprocessor … … 84 83 KdTree *mKdTree; 85 84 85 /// View space partition bsp tree 86 VspBspTree *mVspBspTree; 86 87 /// list of all loaded occluders 87 88 ObjectContainer mOccluders; -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r444 r445 286 286 environment->GetFloatValue("BspTree.Factor.leastRaySplits", mLeastRaySplitsFactor); 287 287 environment->GetFloatValue("BspTree.Factor.balancedRays", mBalancedRaysFactor); 288 environment->GetFloatValue("BspTree.Factor.pvs Factor", mPvsFactor);288 environment->GetFloatValue("BspTree.Factor.pvs", mPvsFactor); 289 289 environment->GetFloatValue("BspTree.Factor.leastSplits" , mLeastSplitsFactor); 290 290 environment->GetFloatValue("BspTree.Factor.balancedPolys", mBalancedPolysFactor); -
trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp
r444 r445 236 236 //-- factors for bsp tree split plane heuristics 237 237 environment->GetFloatValue("VspBspTree.Factor.balancedRays", mBalancedRaysFactor); 238 environment->GetFloatValue("VspBspTree.Factor.pvsFactor", mPvsFactor); 239 environment->GetFloatValue("VspBspTree.Factor.leastSplits" , mLeastSplitsFactor); 238 environment->GetFloatValue("VspBspTree.Factor.pvs", mPvsFactor); 240 239 environment->GetFloatValue("VspBspTree.Termination.ct_div_ci", mCtDivCi); 241 240 … … 255 254 environment->GetFloatValue("VspBspTree.Construction.sideTolerance", Vector3::sDistTolerance); 256 255 Vector3::sDistToleranceSqrt = Vector3::sDistTolerance * Vector3::sDistTolerance; 257 258 // post processing stuff259 environment->GetIntValue("ViewCells.PostProcessing.minPvsDif", mMinPvsDif);260 environment->GetIntValue("ViewCells.PostProcessing.minPvs", mMinPvs);261 environment->GetIntValue("ViewCells.PostProcessing.maxPvs", mMaxPvs);262 256 263 257 Debug << "BSP max depth: " << mTermMaxDepth << endl; … … 273 267 if (mSplitPlaneStrategy & AXIS_ALIGNED) 274 268 Debug << "axis aligned "; 275 if (mSplitPlaneStrategy & LEAST_SPLITS)276 Debug << "least splits ";277 if (mSplitPlaneStrategy & VERTICAL_AXIS)278 Debug << "vertical axis ";279 if (mSplitPlaneStrategy & BLOCKED_RAYS)280 Debug << "blocked rays ";281 269 if (mSplitPlaneStrategy & LEAST_RAY_SPLITS) 282 270 Debug << "least ray splits "; … … 1451 1439 } 1452 1440 1453 bool VspBspTree::MergeViewCells(VspBspLeaf *front, VspBspLeaf *back) const1454 {1455 BspViewCell *viewCell =1456 NULL;//TODO dynamic_cast<BspViewCell *>(ViewCell::Merge(*front->mViewCell, *back->mViewCell));1457 1458 if (!viewCell)1459 return false;1460 1461 // change view cells of all leaves associated with the previous view cells1462 BspViewCell *fVc = front->mViewCell;1463 BspViewCell *bVc = back->mViewCell;1464 1465 //TODO1466 /*1467 vector<VspBspLeaf *> fLeaves = fVc->mVspBspLeaves;1468 vector<VspBspLeaf *> bLeaves = bVc->mVspBspLeaves;1469 1470 vector<VspBspLeaf *>::const_iterator it;1471 1472 for (it = fLeaves.begin(); it != fLeaves.end(); ++ it)1473 {1474 (*it)->SetViewCell(viewCell);1475 viewCell->mVspBspLeaves.push_back(*it);1476 }1477 for (it = bLeaves.begin(); it != bLeaves.end(); ++ it)1478 {1479 (*it)->SetViewCell(viewCell);1480 viewCell->mVspBspLeaves.push_back(*it);1481 }1482 1483 DEL_PTR(fVc);1484 DEL_PTR(bVc);1485 */1486 return true;1487 }1488 1489 bool VspBspTree::ShouldMerge(VspBspLeaf *front, VspBspLeaf *back) const1490 {1491 ViewCell *fvc = front->mViewCell;1492 ViewCell *bvc = back->mViewCell;1493 1494 if ((fvc == mRootCell) || (bvc == mRootCell) || (fvc == bvc))1495 return false;1496 1497 int fdiff = fvc->GetPvs().Diff(bvc->GetPvs());1498 1499 if (fvc->GetPvs().GetSize() + fdiff < mMaxPvs)1500 {1501 if ((fvc->GetPvs().GetSize() < mMinPvs) ||1502 (bvc->GetPvs().GetSize() < mMinPvs) ||1503 ((fdiff < mMinPvsDif) && (bvc->GetPvs().Diff(fvc->GetPvs()) < mMinPvsDif)))1504 {1505 return true;1506 }1507 }1508 1509 return false;1510 }1511 1512 1513 1441 VspBspTreeStatistics &VspBspTree::GetStat() 1514 1442 { -
trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.h
r443 r445 329 329 }; 330 330 331 /** Implementation of the view cell BSP tree. 331 /** 332 This is a view space partitioning specialised BSPtree. 333 There are no polygon splits, but we split the sample rays. 334 The candidates for the next split plane are evaluated only 335 by checking the sampled visibility information. 336 The polygons are employed merely as candidates for the next split planes. 332 337 */ 333 338 class VspBspTree … … 409 414 @param sampleRays the set of sample rays the construction is based on 410 415 @param viewCells if not NULL, new view cells are 411 created in the leafs and stored in the con atainer416 created in the leafs and stored in the container 412 417 */ 413 418 void Construct(const VssRayContainer &sampleRays); … … 475 480 */ 476 481 VspBspLeaf *GetRandomLeaf(const bool onlyUnmailed = false); 477 478 /** Returns true if merge criteria are reached.479 */480 bool ShouldMerge(VspBspLeaf *front, VspBspLeaf *back) const;481 482 /** Merges view cells based on some criteria483 E.g., empty view cells can pe purged, view cells which have484 a very similar PVS can be merged to one larger view cell.485 486 @returns true if merge was successful.487 */488 bool MergeViewCells(VspBspLeaf *front, VspBspLeaf *back) const;489 482 490 483 /** Traverses tree and counts all view cells as well as their PVS size. … … 704 697 RANDOM_POLYGON = 1, 705 698 AXIS_ALIGNED = 2, 706 LEAST_SPLITS = 4,707 BALANCED_POLYS = 8,708 BALANCED_VIEW_CELLS = 16,709 LARGEST_POLY_AREA = 32,710 VERTICAL_AXIS = 64,711 BLOCKED_RAYS = 128,712 699 LEAST_RAY_SPLITS = 256, 713 700 BALANCED_RAYS = 512, … … 746 733 /// number of candidates for split planes evaluated using the rays 747 734 int mMaxRayCandidates; 748 735 /// balancing factor for PVS criterium 749 736 float mCtDivCi; 750 737 751 // /axis aligned split criteria738 //-- axis aligned split criteria 752 739 float mAaCtDivCi; 753 740 float mSplitBorder; 754 741 float mMaxCostRatio; 755 742 756 // factors guiding the split plane heuristics 757 float mBlockedRaysFactor; 743 //-- factors guiding the split plane heuristics 758 744 float mLeastRaySplitsFactor; 759 745 float mBalancedRaysFactor; 760 746 float mPvsFactor; 761 float mLeastSplitsFactor;762 763 //-- thresholds used for view cells merge764 int mMinPvsDif;765 int mMinPvs;766 int mMaxPvs;767 747 768 748 /// if area or accumulated ray lenght should be used for PVS heuristics
Note: See TracChangeset
for help on using the changeset viewer.