Changeset 400 for trunk/VUT/GtpVisibilityPreprocessor
- Timestamp:
- 11/10/05 02:28:42 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env
r399 r400 56 56 57 57 Sampling { 58 totalSamples 10000058 totalSamples 300000 59 59 samplesPerPass 3 60 60 } … … 88 88 # input fromViewCells 89 89 # input fromSceneGeometry 90 samples 5000090 samples 100000 91 91 sideTolerance 0.005 92 92 } … … 126 126 #splitPlaneStrategy 130 127 127 128 splitPlaneStrategy 8128 splitPlaneStrategy 1024 129 129 130 130 maxPolyCandidates 50 … … 133 133 Termination { 134 134 # autopartition 135 maxRays 200136 maxPolygons 20137 maxDepth 30138 minPvs -1139 minArea -0.001135 maxRays 100 136 maxPolygons 10 137 maxDepth 50 138 minPvs 20 139 minArea 0.001 140 140 141 141 # axis aligned splits … … 158 158 exportSplits true 159 159 # how much samples should be used in visualization 160 samples 1000 00160 samples 1000 161 161 } 162 162 } -
trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp
r399 r400 726 726 // throw away samples because BSP leaves not stored in order 727 727 // Need ordered rays for post processing => collect new rays 728 //CLEAR_CONTAINER(mSampleRays);728 CLEAR_CONTAINER(mSampleRays); 729 729 } 730 730 } … … 885 885 ViewCellPvsMap::iterator it = vc->GetPvs().mEntries.begin(); 886 886 887 //exporter->SetWireframe();888 exporter->SetFilled();887 exporter->SetWireframe(); 888 //exporter->SetFilled(); 889 889 890 890 Material m;//= RandomMaterial(); … … 907 907 908 908 // export rays piercing this view cell 909 exporter->ExportRays(vcRays[i], 1000 0, RgbColor(0, 1, 0));909 exporter->ExportRays(vcRays[i], 1000, RgbColor(0, 1, 0)); 910 910 911 911 m.mDiffuseColor = RgbColor(1, 0, 0); … … 982 982 Exporter *exporter = Exporter::GetExporter(s); 983 983 984 exporter->Set Filled();//Wireframe();984 exporter->SetWireframe(); 985 985 986 986 Material m;//= RandomMaterial(); -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r399 r400 17 17 int BspTree::sTermMinPvs = 20; 18 18 int BspTree::sTermMaxDepth = 20; 19 float BspTree::sTermMinArea = 0.001 ;19 float BspTree::sTermMinArea = 0.001f; 20 20 int BspTree::sMaxPolyCandidates = 10; 21 21 int BspTree::sMaxRayCandidates = 10; … … 747 747 DEL_PTR(tData.mPolygons); 748 748 DEL_PTR(tData.mRays); 749 DEL_PTR(tData.m Cell);749 DEL_PTR(tData.mGeometry); 750 750 751 751 return leaf; … … 762 762 763 763 BspTraversalData tFrontData(NULL, new PolygonContainer(), tData.mDepth + 1, mRootCell, 764 new BoundedRayContainer(), 0, NULL, 0);764 new BoundedRayContainer(), 0, 0, new BspNodeGeometry()); 765 765 BspTraversalData tBackData(NULL, new PolygonContainer(), tData.mDepth + 1, mRootCell, 766 new BoundedRayContainer(), 0, NULL, 0);766 new BoundedRayContainer(), 0, 0, new BspNodeGeometry()); 767 767 768 768 // create new interior node and two leaf nodes … … 801 801 DEL_PTR(tData.mPolygons); 802 802 DEL_PTR(tData.mRays); 803 DEL_PTR(tData.m Cell);803 DEL_PTR(tData.mGeometry); 804 804 805 805 return interior; … … 844 844 // select subdivision plane 845 845 BspInterior *interior = 846 new BspInterior(SelectPlane(leaf, tData , frontData, backData));846 new BspInterior(SelectPlane(leaf, tData)); 847 847 848 848 #ifdef _DEBUG … … 858 858 *backData.mPolygons, 859 859 coincident); 860 861 // split geometry 862 tData.mGeometry->SplitGeometry(*frontData.mGeometry, *backData.mGeometry, 863 *this, interior->mPlane); 864 865 // compute area 866 frontData.mArea = frontData.mGeometry->GetArea(); 867 backData.mArea = backData.mGeometry->GetArea(); 868 869 // compute pvs 870 frontData.mPvs = ComputePvsSize(*frontData.mRays); 871 backData.mPvs = ComputePvsSize(*backData.mRays); 872 873 860 874 861 875 BspInterior *parent = leaf->GetParent(); … … 1022 1036 1023 1037 Plane3 BspTree::SelectPlane(BspLeaf *leaf, 1024 BspTraversalData &data, 1025 BspTraversalData &frontData, 1026 BspTraversalData &backData) 1038 BspTraversalData &data) 1027 1039 { 1028 1040 if (data.mPolygons->empty() && data.mRays->empty()) … … 1068 1080 1069 1081 // use heuristics to find appropriate plane 1070 return SelectPlaneHeuristics(leaf, data , frontData, backData);1082 return SelectPlaneHeuristics(leaf, data); 1071 1083 } 1072 1084 1073 1085 Plane3 BspTree::SelectPlaneHeuristics(BspLeaf *leaf, 1074 BspTraversalData &data, 1075 BspTraversalData &frontData, 1076 BspTraversalData &backData) 1086 BspTraversalData &data) 1077 1087 { 1078 1088 float lowestCost = MAX_FLOAT; … … 1091 1101 // evaluate current candidate 1092 1102 const float candidateCost = 1093 SplitPlaneCost(poly->GetSupportingPlane(), data , frontData, backData);1103 SplitPlaneCost(poly->GetSupportingPlane(), data); 1094 1104 1095 1105 if (candidateCost < lowestCost) … … 1146 1156 } 1147 1157 1148 const float candidateCost = 1149 SplitPlaneCost(plane, data, frontData, backData); 1158 const float candidateCost = SplitPlaneCost(plane, data); 1150 1159 1151 1160 if (candidateCost < lowestCost) … … 1315 1324 const int pvs, 1316 1325 const float area, 1317 const BspNodeGeometry &cell, 1318 BspTraversalData &frontData, 1319 BspTraversalData &backData) const 1326 const BspNodeGeometry &cell) const 1320 1327 { 1321 1328 float val = 0; … … 1328 1335 int frontAndBackId = 0; 1329 1336 1330 frontData.mPvs = 0; 1331 backData.mPvs = 0; 1332 frontData.mArea = 0; 1333 backData.mArea = 0; 1337 int frontPvs = 0; 1338 int backPvs = 0; 1334 1339 1335 1340 // probability that view point lies in child … … 1348 1353 { 1349 1354 // construct child geometry with regard to the candidate split plane 1350 frontData.mCell = new BspNodeGeometry();1351 backData.mCell = new BspNodeGeometry();1352 1353 cell.SplitGeometry( *frontData.mCell, *backData.mCell, *this, candidatePlane);1354 1355 pFront = front Data.mArea = frontData.mCell->GetArea();1356 pBack = back Data.mArea = backData.mCell->GetArea();1355 BspNodeGeometry frontCell; 1356 BspNodeGeometry backCell; 1357 1358 cell.SplitGeometry(frontCell, backCell, *this, candidatePlane); 1359 1360 pFront = frontCell.GetArea(); 1361 pBack = backCell.GetArea(); 1357 1362 1358 1363 pOverall = area; … … 1392 1397 // assure that we only count a object 1393 1398 // once for the front and once for the back side of the plane 1394 IncPvs(*ray->intersections[0].mObject, front Data.mPvs, backData.mPvs,1399 IncPvs(*ray->intersections[0].mObject, frontPvs, backPvs, 1395 1400 cf, frontId, backId, frontAndBackId); 1396 1401 } … … 1399 1404 if (ray->sourceObject.mObject) 1400 1405 { 1401 IncPvs(*ray->sourceObject.mObject, front Data.mPvs, backData.mPvs,1406 IncPvs(*ray->sourceObject.mObject, frontPvs, backPvs, 1402 1407 cf, frontId, backId, frontAndBackId); 1403 1408 } … … 1419 1424 if ((sSplitPlaneStrategy & BALANCED_RAYS) && !rays.empty()) 1420 1425 val += sBalancedRaysFactor * fabs(sumBalancedRays) / (float)rays.size(); 1421 pOverall = 1; pFront = 1; pBack = 1; 1426 1422 1427 if ((sSplitPlaneStrategy & PVS) && area && pvs) 1423 val += sPvsFactor * (front Data.mPvs * pFront + (backData.mPvs * pBack)) /1428 val += sPvsFactor * (frontPvs * pFront + (backPvs * pBack)) / 1424 1429 (pOverall * (float)pvs * 2); 1425 1430 1426 Debug << "totalpvs: " << pvs << " ptotal: " << pOverall1427 << " frontpvs: " << front Data.mPvs << " pFront: " << pFront1428 << " backpvs: " << back Data.mPvs << " pBack: " << pBack1431 /* Debug << "totalpvs: " << pvs << " ptotal: " << pOverall 1432 << " frontpvs: " << frontPvs << " pFront: " << pFront 1433 << " backpvs: " << backPvs << " pBack: " << pBack 1429 1434 << " val " << val << endl; 1430 1435 */ 1431 1436 return val; 1432 1437 } … … 1485 1490 1486 1491 float BspTree::SplitPlaneCost(const Plane3 &candidatePlane, 1487 BspTraversalData &data, 1488 BspTraversalData &frontData, 1489 BspTraversalData &backData) const 1492 BspTraversalData &data) const 1490 1493 { 1491 1494 float val = 0; … … 1516 1519 { 1517 1520 val += SplitPlaneCost(candidatePlane, *data.mRays, data.mPvs, 1518 data.mArea, *data.m Cell, frontData, backData);1521 data.mArea, *data.mGeometry); 1519 1522 } 1520 1523 … … 2403 2406 } 2404 2407 2405 Debug << "returning new geometry " << mPolys.size() << " f: " << front.mPolys.size() << " b: " << back.mPolys.size() << endl;2406 Debug << "old area " << GetArea() << " f: " << front.GetArea() << " b: " << back.GetArea() << endl;2408 //Debug << "returning new geometry " << mPolys.size() << " f: " << front.mPolys.size() << " b: " << back.mPolys.size() << endl; 2409 //Debug << "old area " << GetArea() << " f: " << front.GetArea() << " b: " << back.GetArea() << endl; 2407 2410 } 2408 2411 -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h
r399 r400 345 345 /// area of current node 346 346 float mArea; 347 BspNodeGeometry *m Cell;347 BspNodeGeometry *mGeometry; 348 348 349 349 /// pvs size … … 358 358 mPvs(0), 359 359 mArea(0.0), 360 m Cell(NULL)360 mGeometry(NULL) 361 361 {} 362 362 … … 376 376 mPvs(pvs), 377 377 mArea(area), 378 m Cell(cell)378 mGeometry(cell) 379 379 {} 380 380 }; … … 541 541 */ 542 542 Plane3 SelectPlane(BspLeaf *leaf, 543 BspTraversalData &data, 544 BspTraversalData &frontData, 545 BspTraversalData &backData); 543 BspTraversalData &data); 546 544 547 545 /** Evaluates the contribution of the candidate split plane. … … 554 552 */ 555 553 float SplitPlaneCost(const Plane3 &candidatePlane, 556 BspTraversalData &data, 557 BspTraversalData &frontData, 558 BspTraversalData &backData) const; 554 BspTraversalData &data) const; 559 555 560 556 /** Strategies where the effect of the split plane is tested … … 574 570 const int pvs, 575 571 const float area, 576 const BspNodeGeometry &cell, 577 BspTraversalData &frontData, 578 BspTraversalData &backData) const; 572 const BspNodeGeometry &cell) const; 579 573 580 574 /** Filters next view cell down the tree and inserts it into the appropriate leaves … … 624 618 */ 625 619 Plane3 SelectPlaneHeuristics(BspLeaf *leaf, 626 BspTraversalData &data, 627 BspTraversalData &frontData, 628 BspTraversalData &backData); 620 BspTraversalData &data); 629 621 630 622 /** Extracts the meshes of the objects and adds them to polygons.
Note: See TracChangeset
for help on using the changeset viewer.