Changeset 1692 for GTP/trunk/Lib/Vis
- Timestamp:
- 10/27/06 21:31:39 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/vsposp_typical.env
r1654 r1692 173 173 174 174 Evaluation { 175 samplesPerPass 10000 0176 samples 100000175 samplesPerPass 10000 176 samples 50000 177 177 statsPrefix ../scripts/viewCells 178 178 } … … 233 233 Construction { 234 234 235 samples 20000 0235 samples 20000 236 236 237 237 # type 0 = sequential computation, 1 = interleaved, 2 = gradient -
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1687 r1692 59 59 mMailbox(0), 60 60 mMemoryIncr(0), 61 mRenderCostDecr(0), 61 62 mPvsEntriesIncr(0), 62 63 mTimeStamp(0) … … 70 71 mMailbox(0), 71 72 mMemoryIncr(0), 73 mRenderCostDecr(0), 72 74 mPvsEntriesIncr(0), 73 75 mTimeStamp(0) … … 1104 1106 { 1105 1107 //-- insert object queries 1106 ObjectContainer *objects = 1107 mUseGlobalSorting ?tData.mSortedObjects[axis] : &tData.mNode->mObjects;1108 ObjectContainer *objects = mUseGlobalSorting ? 1109 tData.mSortedObjects[axis] : &tData.mNode->mObjects; 1108 1110 1109 1111 CreateLocalSubdivisionCandidates(*objects, &mSubdivisionCandidates, !mUseGlobalSorting, axis); … … 1284 1286 } 1285 1287 else 1286 { cout << "e rays: " << tData.mNumRays << " ";1288 { //cout << "e rays: " << tData.mNumRays << " "; 1287 1289 ////////////////// 1288 1290 //-- view cells not constructed yet => use surface area heuristic … … 2127 2129 BvhInterior *oldInterior = dynamic_cast<BvhInterior *>(oldNode); 2128 2130 2131 sc->mFrontObjects.clear(); 2132 sc->mBackObjects.clear(); 2133 2129 2134 oldInterior->GetFront()->CollectObjects(sc->mFrontObjects); 2130 2135 oldInterior->GetBack()->CollectObjects(sc->mBackObjects); … … 2136 2141 currentNode = SubdivideNode(*sc, tFrontData, tBackData); 2137 2142 2138 oldNode->mRenderCostDecr += sc->GetRenderCostDecrease(); 2139 oldNode->mPvsEntriesIncr += sc->GetPvsEntriesIncr(); 2140 cout << "here5" << endl; 2143 //oldNode->mRenderCostDecr += sc->GetRenderCostDecrease(); 2144 //oldNode->mPvsEntriesIncr += sc->GetPvsEntriesIncr(); 2145 2146 oldNode->mRenderCostDecr = sc->GetRenderCostDecrease(); 2147 oldNode->mPvsEntriesIncr = sc->GetPvsEntriesIncr(); 2148 2141 2149 /////////////////////////// 2142 2150 //-- push the new split candidates on the queue -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r1687 r1692 1630 1630 1631 1631 1632 void HierarchyManager::EvaluateSubdivision(const VssRayContainer &sampleRays, const ObjectContainer &objects, 1632 void HierarchyManager::EvaluateSubdivision(const VssRayContainer &sampleRays, 1633 const ObjectContainer &objects, 1633 1634 const string &filename) 1634 1635 { … … 1681 1682 ViewCellContainer viewCells; 1682 1683 mVspTree->CollectViewCells(viewCells, false); 1683 CLEAR_CONTAINER(viewCells); 1684 1684 1685 1685 // helper trees can be destroyed 1686 1686 DEL_PTR(mVspTree); 1687 1687 DEL_PTR(mBvHierarchy); 1688 1689 CLEAR_CONTAINER(viewCells); 1688 1690 1689 1691 // reset hierarchies … … 1726 1728 { 1727 1729 SubdivisionCandidate *nextCandidate = NextSubdivisionCandidate(tQueue); 1728 1729 cout << "next candidate: " << nextCandidate->GetPriority() << endl; 1730 bool isLeaf; 1731 int timeStamp; 1732 float rcDecr; 1733 int entriesIncr; 1730 1734 1731 1735 if (nextCandidate->Type() == SubdivisionCandidate::VIEW_SPACE) 1732 1736 { 1733 cout << "here8" << endl;1734 mVspTree->SubdivideAndCopy(tQueue, nextCandidate); 1735 1737 timeStamp = (int)-nextCandidate->GetPriority(); 1738 1739 VspNode *newNode = mVspTree->SubdivideAndCopy(tQueue, nextCandidate); 1736 1740 VspNode *oldNode = (VspNode *)nextCandidate->mEvaluationHack; 1737 1741 1738 totalRenderCost -= oldNode->mRenderCostDecr; 1739 entriesInPvs += oldNode->mPvsEntriesIncr; 1742 isLeaf = newNode->IsLeaf(); 1743 rcDecr = oldNode->mRenderCostDecr; 1744 entriesIncr = oldNode->mPvsEntriesIncr; 1740 1745 } 1741 1746 else 1742 { cout << "here9" << endl;1743 mBvHierarchy->SubdivideAndCopy(tQueue, nextCandidate);1747 { 1748 timeStamp = (int)-nextCandidate->GetPriority(); 1744 1749 1750 BvhNode *newNode = mBvHierarchy->SubdivideAndCopy(tQueue, nextCandidate); 1745 1751 BvhNode *oldNode = (BvhNode *)nextCandidate->mEvaluationHack; 1746 1752 1747 totalRenderCost -= oldNode->mRenderCostDecr; 1748 entriesInPvs += oldNode->mPvsEntriesIncr; 1753 isLeaf = newNode->IsLeaf(); 1754 rcDecr = oldNode->mRenderCostDecr; 1755 entriesIncr = oldNode->mPvsEntriesIncr; 1749 1756 } 1750 1751 ++ steps; 1752 cout << "rc: " << nextCandidate->GetRenderCostDecrease() << endl; 1753 cout << "pvs: " << nextCandidate->GetPvsEntriesIncr() << endl; 1754 1755 const float memoryCost = (float)entriesInPvs * (float)ObjectPvs::GetEntrySize(); 1756 UpdateStats(stats, steps, totalRenderCost, entriesInPvs, memoryCost, false); 1757 1758 if (!isLeaf) 1759 { 1760 totalRenderCost -= rcDecr; 1761 entriesInPvs += entriesIncr; 1762 // if (rcDecr <= 0) 1763 if (nextCandidate->Type() == SubdivisionCandidate::VIEW_SPACE) 1764 cout << "v";//cout << "vsp t: " << timeStamp << " rc: " << rcDecr << " pvs: " << entriesIncr << endl; 1765 else 1766 cout << "o";//"osp t: " << timeStamp << " rc: " << rcDecr << " pvs: " << entriesIncr << endl; 1767 1768 ++ steps; 1769 1770 if ((steps % 500) == 499) 1771 cout << steps << " steps taken" << endl; 1772 const float memoryCost = (float)entriesInPvs * (float)ObjectPvs::GetEntrySize(); 1773 UpdateStats(stats, steps, totalRenderCost, entriesInPvs, memoryCost, false); 1774 } 1775 1776 DEL_PTR(nextCandidate); 1757 1777 } 1758 1778 -
GTP/trunk/Lib/Vis/Preprocessing/src/IntersectableWrapper.cpp
r1587 r1692 65 65 const float sum = a + b + c; 66 66 67 // scale so we get va lue between zero and one67 // scale so we get vaccumated value of 1 68 68 if (sum) 69 69 { … … 73 73 } 74 74 75 //cout << "a " << a << "b: " << b << "c: " << c<< endl;75 //cout << "a: " << a << " b: " << b << " c: " << c << " sum: " << sum << endl; 76 76 point = mItem.mVertices[0] * a + mItem.mVertices[1] * b + mItem.mVertices[2] * c; 77 77 normal = mItem.GetNormal(); -
GTP/trunk/Lib/Vis/Preprocessing/src/RayInfo.h
r1149 r1692 94 94 95 95 friend void GetRayInfoSets(const RayInfoContainer &sourceRays, 96 const int maxSize,97 RayInfoContainer &usedRays,98 RayInfoContainer *savedRays = NULL);96 const int maxSize, 97 RayInfoContainer &usedRays, 98 RayInfoContainer *savedRays = NULL); 99 99 }; 100 100 -
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp
r1588 r1692 35 35 Vector3 point; 36 36 Vector3 normal; 37 37 //cout << "y"; 38 38 const int i = (int)RandomValue(0, (float)mPreprocessor.mObjects.size() - 0.5f); 39 39 … … 66 66 67 67 Vector3 normal; 68 68 //cout << "x"; 69 69 object->GetRandomSurfacePoint(origin, normal); 70 70 direction = UniformRandomVector(normal); … … 137 137 mPreprocessor.mViewCellsManager->GetViewPoint(origin); 138 138 direction = mPreprocessor.mKdTree->GetBox().GetRandomPoint() - origin; 139 139 //cout << "z"; 140 140 const float c = Magnitude(direction); 141 141 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1686 r1692 38 38 // HACK 39 39 const static bool SAMPLE_AFTER_SUBDIVISION = true; 40 const static bool CLAMP_TO_BOX = true;40 const static bool CLAMP_TO_BOX = false; 41 41 42 42 template <typename T> class myless … … 5617 5617 } 5618 5618 5619 #if 1 5619 5620 #if 0 5620 5621 #if TEST_EVALUATION 5621 5622 void VspOspViewCellsManager::EvalViewCellPartition() … … 5744 5745 cout << "Evaluating view cell partition ... " << endl; 5745 5746 5747 VssRayContainer evaluationSamples; 5748 5746 5749 while (castSamples < numSamples) 5747 5750 { … … 5749 5752 //-- we have to use uniform sampling strategy for construction rays 5750 5753 5751 VssRayContainer evaluationSamples;5754 //VssRayContainer evaluationSamples; 5752 5755 const int samplingType = mEvaluationSamplingType; 5753 5756 … … 5791 5794 Debug << "statistis compted in " << timeDiff * 1e-3 << " secs" << endl; 5792 5795 5793 disposeRays(evaluationSamples, NULL); 5794 } 5796 //disposeRays(evaluationSamples, NULL); 5797 } 5798 5799 disposeRays(evaluationSamples, NULL); 5800 5795 5801 } 5796 5802 #endif -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r1686 r1692 1102 1102 1103 1103 //#if TEST_EVALUATION 1104 virtual void EvalViewCellPartition();1104 //virtual void EvalViewCellPartition(); 1105 1105 //#endif 1106 1106 -
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp
r1687 r1692 192 192 mTreeValid(true), 193 193 mMemoryIncr(0), 194 mRenderCostDecr(0), 194 195 mPvsEntriesIncr(0), 195 196 mTimeStamp(0) … … 750 751 if (newNode->IsLeaf()) // subdivision terminated 751 752 { 753 VspLeaf *leaf = dynamic_cast<VspLeaf *>(newNode); 754 755 #if 0 756 ///////////// 757 //-- store pvs optained from rays 758 752 759 // view cell is created during subdivision 753 VspLeaf *leaf = dynamic_cast<VspLeaf *>(newNode);754 760 ViewCell *viewCell = leaf->GetViewCell(); 755 761 756 762 int conSamp = 0; 757 763 float sampCon = 0.0f; 758 759 #if 0760 /////////////761 //-- store pvs optained from rays762 764 763 765 AddSamplesToPvs(leaf, *tData.mRays, sampCon, conSamp); … … 1517 1519 1518 1520 float t; 1521 1522 // classify ray 1523 const int cf = rayInf.ComputeRayIntersection(candidatePlane.mAxis, 1524 candidatePlane.mPosition, 1525 t); 1526 1519 1527 VssRay *ray = rayInf.mRay; 1520 1521 // classify ray1522 const int cf =1523 rayInf.ComputeRayIntersection(candidatePlane.mAxis,1524 candidatePlane.mPosition, t);1525 1528 1526 1529 // evaluate contribution of ray endpoint to front 1527 1530 // and back pvs with respect to the classification 1528 UpdateContributionsToPvs(*ray, true, cf, pvsFront, pvsBack, totalPvs); 1531 UpdateContributionsToPvs(*ray, true, cf, pvsFront, pvsBack, totalPvs); 1529 1532 #if COUNT_ORIGIN_OBJECTS 1530 1533 UpdateContributionsToPvs(*ray, false, cf, pvsFront, pvsBack, totalPvs); 1531 1534 #endif 1532 1535 } 1533 1536 1534 1537 AxisAlignedBox3 frontBox; 1535 1538 AxisAlignedBox3 backBox; … … 3303 3306 // create new interior node and two leaf node 3304 3307 const AxisAlignedPlane splitPlane = oldInterior->GetPlane(); 3305 3308 3309 sc->mSplitPlane = splitPlane; 3310 3306 3311 // evaluate the changes in render cost and pvs entries 3307 3312 EvalSubdivisionCandidate(*sc, false); … … 3309 3314 newNode = SubdivideNode(splitPlane, tData, tFrontData, tBackData); 3310 3315 3311 oldNode->mRenderCostDecr += sc->GetRenderCostDecrease(); 3312 oldNode->mPvsEntriesIncr += sc->GetPvsEntriesIncr(); 3313 cout << "here4" << endl; 3314 3316 //oldNode->mRenderCostDecr += sc->GetRenderCostDecrease(); 3317 //oldNode->mPvsEntriesIncr += sc->GetPvsEntriesIncr(); 3318 3319 oldNode->mRenderCostDecr = sc->GetRenderCostDecrease(); 3320 oldNode->mPvsEntriesIncr = sc->GetPvsEntriesIncr(); 3321 3315 3322 ///////////// 3316 3323 //-- evaluate new split candidates for global greedy cost heuristics … … 3338 3345 if (newNode->IsLeaf()) // subdivision terminated 3339 3346 { 3340 // view cell is created during subdivision 3341 VspLeaf *leaf = dynamic_cast<VspLeaf *>(newNode); 3342 ViewCell *viewCell = leaf->GetViewCell(); 3343 3344 int conSamp = 0; 3345 float sampCon = 0.0f; 3346 3347 #if 0 3348 ///////////// 3349 //-- store pvs optained from rays 3350 3351 AddSamplesToPvs(leaf, *tData.mRays, sampCon, conSamp); 3352 3353 // update scalar pvs size value 3354 ObjectPvs &pvs = viewCell->GetPvs(); 3355 mViewCellsManager->UpdateScalarPvsSize(viewCell, pvs.CountObjectsInPvs(), pvs.GetSize()); 3356 3357 mVspStats.contributingSamples += conSamp; 3358 mVspStats.sampleContributions += (int)sampCon; 3359 #endif 3360 if (mStoreRays) 3361 { 3362 ////////// 3363 //-- store rays piercing this view cell 3364 RayInfoContainer::const_iterator it, it_end = tData.mRays->end(); 3365 for (it = tData.mRays->begin(); it != it_end; ++ it) 3366 { 3367 (*it).mRay->Ref(); 3368 leaf->mVssRays.push_back((*it).mRay); 3369 //leaf->mVssRays.push_back(new VssRay(*(*it).mRay)); 3370 } 3371 } 3372 3373 // finally evaluate statistics for this leaf 3374 EvaluateLeafStats(tData); 3375 // detach subdivision candidate: this leaf is no candidate for 3376 // splitting anymore 3347 // detach subdivision candidate: this leaf is no candidate for splitting anymore 3377 3348 tData.mNode->SetSubdivisionCandidate(NULL); 3378 3349 // detach node so it won't get deleted
Note: See TracChangeset
for help on using the changeset viewer.