Changeset 425 for trunk/VUT/GtpVisibilityPreprocessor
- Timestamp:
- 11/21/05 18:51:12 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env
r423 r425 137 137 maxRayCandidates 100 138 138 139 # factors for evaluating split plane costs 140 Factor { 141 verticalSplits 1.0 142 largestPolyArea 1.0 143 blockedRays 1.0 144 leastRaySplits 1.0 145 balancedRays 1.0 146 pvsFactor 1.0 147 leastSplits 1.0 148 balancedPolys 1.0 149 balancedViewCells 1.0 150 } 151 139 152 Termination { 140 153 # parameters used for autopartition … … 146 159 maxRayContribution 0.005 147 160 #maxAccRayLength 100 148 161 # used for pvs criterium 162 ct_div_ci 0.0 163 149 164 # axis aligned splits 150 165 AxisAligned { … … 203 218 204 219 Construction { 205 samples 100000206 } 207 208 Termination { 209 maxDepth 40210 minPvs 5220 samples 200000 221 } 222 223 Termination { 224 maxDepth 20 225 minPvs 200 211 226 minRays 100 212 227 minSize 0.001 … … 215 230 } 216 231 217 maxTotalMemory 400218 maxStaticMemory 200232 maxTotalMemory 600 233 maxStaticMemory 600 219 234 220 235 splitType regular -
trunk/VUT/GtpVisibilityPreprocessor/src/Exporter.h
r418 r425 49 49 50 50 virtual bool 51 ExportVspKdTree(const VspKdTree &tree ) = 0;51 ExportVspKdTree(const VspKdTree &tree, const int maxPvs = 0) = 0; 52 52 53 53 virtual bool -
trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp
r423 r425 677 677 Exporter *exporter = Exporter::GetExporter("vspkdtree.x3d"); 678 678 exporter->SetWireframe(); 679 exporter->ExportVspKdTree(*mVspKdTree );679 exporter->ExportVspKdTree(*mVspKdTree, 300); 680 680 delete exporter; 681 681 } -
trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.cpp
r424 r425 172 172 173 173 174 /********************************************************* /175 /* class VspKdTreeLeaf implementation*/176 /********************************************************* /174 /**************************************************************/ 175 /* class VspKdTreeLeaf implementation */ 176 /**************************************************************/ 177 177 VspKdTreeLeaf::VspKdTreeLeaf(VspKdTreeInterior *p, const int nRays): 178 178 VspKdTreeNode(p), mRays(), mPvsSize(0), mValidPvs(false) … … 488 488 if (lastMem / 10 != ((int)mem) / 10) 489 489 { 490 cout<< mem << " MB" << endl;490 Debug << mem << " MB" << endl; 491 491 } 492 492 lastMem = (int)mem; … … 569 569 } 570 570 571 if ( costRatio > mTermMaxCostRatio)572 { 573 cout<< "Too big cost ratio " << costRatio << endl;571 if (0 && costRatio > mTermMaxCostRatio) 572 { 573 Debug << "Too big cost ratio " << costRatio << endl; 574 574 return -1; 575 575 } … … 588 588 589 589 590 591 float 592 VspKdTree::EvalCostRatio(VspKdTreeLeaf *leaf, 593 const int axis, 594 const float position, 595 int &raysBack, 596 int &raysFront, 597 int &pvsBack, 598 int &pvsFront) 590 float VspKdTree::EvalCostRatio(VspKdTreeLeaf *leaf, 591 const int axis, 592 const float position, 593 int &raysBack, 594 int &raysFront, 595 int &pvsBack, 596 int &pvsFront) 599 597 { 600 598 raysBack = 0; … … 632 630 } 633 631 634 AxisAlignedBox3 box = GetBBox(leaf); 635 636 float minBox = box.Min(axis); 637 float maxBox = box.Max(axis); 638 float sizeBox = maxBox - minBox; 632 float ratio = 0; 633 634 if (1) 635 { 636 const float sum = pvsBack + pvsFront; 637 const float oldCost = (float)pvsSize * 2; 638 639 return sum / oldCost; 640 } 641 else { 642 AxisAlignedBox3 box = GetBBox(leaf); 643 644 float minBox = box.Min(axis); 645 float maxBox = box.Max(axis); 646 float sizeBox = maxBox - minBox; 639 647 640 // float sum = raysBack*(position - minBox) + raysFront*(maxBox - position); 641 float sum = pvsBack * (position - minBox) + pvsFront * (maxBox - position); 642 643 newCost = mCtDivCi + sum / sizeBox; 644 645 // cout<<axis<<" "<<pvsSize<<" "<<pvsBack<<" "<<pvsFront<<endl; 646 // float oldCost = leaf->mRays.size(); 647 float oldCost = (float)pvsSize; 648 649 float ratio = newCost / oldCost; 650 // cout<<"ratio="<<ratio<<endl; 648 // float sum = raysBack*(position - minBox) + raysFront*(maxBox - position); 649 float sum = pvsBack * (position - minBox) + pvsFront * (maxBox - position); 650 651 newCost = mCtDivCi + sum / sizeBox; 652 653 //Debug << axis << " " << pvsSize << " " << pvsBack << " " << pvsFront << endl; 654 // float oldCost = leaf->mRays.size(); 655 float oldCost = (float)pvsSize; 656 657 float ratio = newCost / oldCost; 658 659 } 660 651 661 return ratio; 652 662 } … … 927 937 928 938 // select subdivision axis 929 int axis = SelectPlane(leaf, box, position, raysBack, raysFront, pvsBack, pvsFront);939 const int axis = SelectPlane(leaf, box, position, raysBack, raysFront, pvsBack, pvsFront); 930 940 931 941 Debug << "rays back=" << raysBack << " rays front=" << raysFront << " pvs back=" << pvsBack << " pvs front=" << pvsFront << endl; … … 1684 1694 return mStat.rays * (sizeof(VssRay))/(1024.0f * 1024.0f); 1685 1695 } 1696 1697 int VspKdTree::ComputePvsSize(VspKdTreeNode *node, const RayInfoContainer &globalRays) const 1698 { 1699 int pvsSize = 0; 1700 1701 const AxisAlignedBox3 box = GetBBox(node); 1702 1703 RayInfoContainer::const_iterator it, it_end = globalRays.end(); 1704 1705 for (it = globalRays.begin(); it != globalRays.end(); ++ it) 1706 ;//pvsSize += box.GetMinMaxT((*it).mRay, NULL, NULL); 1707 1708 return pvsSize; 1709 } -
trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.h
r423 r425 503 503 SimpleRayContainer &rays); 504 504 505 /** Collapses this subtree and releases the memory. 506 @returns number of collapsed rays. 507 */ 505 508 int CollapseSubtree(VspKdTreeNode *sroot, const int time); 506 509 … … 509 512 bool TerminationCriteriaMet(const VspKdTreeLeaf *leaf, 510 513 const AxisAlignedBox3 &box) const; 514 515 /** Computes PVS size of this node given a global ray set. 516 @returns PVS size of the intersection of this node bounding box with the rays. 517 */ 518 int ComputePvsSize(VspKdTreeNode *node, const RayInfoContainer &globalRays) const; 511 519 512 520 protected: -
trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.cpp
r422 r425 583 583 } 584 584 585 bool X3dExporter::ExportVspKdTree(const VspKdTree &tree )586 { 587 / *if (mExportRayDensity) {588 return ExportKdTreeRayDensity(tree); }*/585 bool X3dExporter::ExportVspKdTree(const VspKdTree &tree, const int maxPvs) 586 { 587 //if (mExportRayDensity) { 588 //return ExportKdTreeRayDensity(tree); } 589 589 590 590 stack<VspKdTreeNode *> tStack; … … 592 592 tStack.push(tree.GetRoot()); 593 593 594 Mesh *mesh = new Mesh; 595 594 //Mesh *mesh = new Mesh; 595 596 if (maxPvs > 0) 597 mUseForcedMaterial = true; 598 596 599 while (!tStack.empty()) 597 600 { … … 601 604 AxisAlignedBox3 box = tree.GetBBox(node); 602 605 606 Mesh *mesh = new Mesh; 607 603 608 // add 6 vertices of the box 604 609 int index = (int)mesh->mVertices.size(); 605 610 606 611 for (int i=0; i < 8; ++ i) 607 612 { … … 619 624 mesh->AddFace(new Face(index + 2, index + 3, index + 7, index + 6) ); 620 625 626 if (maxPvs > 0) 627 { 628 mForcedMaterial.mDiffuseColor.b = 1.0f; 629 const float importance = maxPvs; 630 //float importance = (float)(*it)->GetPvs().GetSize() / (float)maxPvs; 631 632 mForcedMaterial.mDiffuseColor.r = importance; 633 mForcedMaterial.mDiffuseColor.g = 1.0f - mForcedMaterial.mDiffuseColor.r; 634 } 635 636 ExportMesh(mesh); 637 DEL_PTR(mesh); 638 621 639 if (!node->IsLeaf()) 622 640 { … … 627 645 } 628 646 629 ExportMesh(mesh);630 DEL_PTR(mesh);647 //ExportMesh(mesh); 648 //DEL_PTR(mesh); 631 649 632 650 return true; -
trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.h
r418 r425 40 40 41 41 bool 42 ExportVspKdTree(const VspKdTree &tree );42 ExportVspKdTree(const VspKdTree &tree, const int maxPvs); 43 43 44 44 bool ExportBspTree(const BspTree &tree);
Note: See TracChangeset
for help on using the changeset viewer.