Changeset 1768 for GTP/trunk/Lib/Vis
- Timestamp:
- 11/20/06 09:15:28 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/vsposp_typical.sh
r1727 r1768 78 78 79 79 ############################################################################ 80 OBJ_SPLITS= 70080 OBJ_SPLITS=100 81 81 82 82 METHOD=sequential-$OBJ_SPLITS -
GTP/trunk/Lib/Vis/Preprocessing/src/AxisAlignedBox3.cpp
r1715 r1768 1719 1719 1720 1720 Vector3 vtx; 1721 1722 ////////////// 1721 1723 //-- compute classification of vertices 1724 1722 1725 for (int i = 0; i < 8; ++i) 1723 1726 { … … 1732 1735 } 1733 1736 1737 /////////// 1734 1738 //-- find intersections 1739 1735 1740 if (onFrontSide && onBackSide) 1736 1741 { … … 1756 1761 { 1757 1762 Vector3 centerOfMass(0); 1763 1758 1764 int i; 1759 1765 // compute center of mass … … 1764 1770 1765 1771 vector<VertexData> vertexData; 1766 1767 1772 Vector3 refVec = Normalize(centerOfMass - planePoly->mVertices[0]); 1768 1773 1769 1774 // compute angle to reference point 1770 1775 for (i = 1; i < (int)planePoly->mVertices.size(); ++ i) 1771 1776 { 1772 1777 float angle = 1773 1778 Angle(refVec, centerOfMass - planePoly->mVertices[i], plane.mNormal); 1774 1779 1775 1780 vertexData.push_back(VertexData(planePoly->mVertices[i], angle)); 1776 1781 } 1777 1782 1778 1783 std::stable_sort(vertexData.begin(), vertexData.end()); -
GTP/trunk/Lib/Vis/Preprocessing/src/AxisAlignedBox3.h
r1715 r1768 356 356 /** Splits the box into two separate boxes with respect to the split plane 357 357 */ 358 void Split(const int axis, const float value, AxisAlignedBox3 &left, AxisAlignedBox3 &right) const; 358 void Split(const int axis, 359 const float value, 360 AxisAlignedBox3 &left, 361 AxisAlignedBox3 &right) const; 359 362 360 363 #define __EXTENT_HACK -
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1767 r1768 93 93 mBoundingBox.GetEdge(idx, &a, &b); 94 94 95 const float factor = RandomValue(0.0f, 1.0f); 96 97 point = a * factor + b * (1 - factor); 98 //normal = mBoundingBox.GetNormal(); 95 const float w = RandomValue(0.0f, 1.0f); 96 97 point = a * w + b * (1.0f - w); 98 99 // TODO 100 normal = Vector3(0); 99 101 100 102 return idx; … … 564 566 float priority; 565 567 566 // surface area heuristics is used when there is no view space subdivision available. 567 // In order to have some prioritized traversal, use this formula instead 568 // surface area heuristics is used when there is 569 // no view space subdivision available. 570 // In order to have some prioritized traversal, 571 // we use this formula instead 568 572 if (mHierarchyManager->GetViewSpaceSubdivisionType() == 569 573 HierarchyManager::NO_VIEWSPACE_SUBDIV) -
GTP/trunk/Lib/Vis/Preprocessing/src/IntersectableWrapper.h
r1763 r1768 63 63 64 64 int GetRandomEdgePoint(Vector3 &point, Vector3 &normal); 65 66 65 67 protected: 66 68 -
GTP/trunk/Lib/Vis/Preprocessing/src/Mesh.cpp
r1763 r1768 797 797 int MeshInstance::GetRandomEdgePoint(Vector3 &point, Vector3 &normal) 798 798 { 799 // TODO 800 return mMesh->GetRandomSurfacePoint(point, normal); 799 // get random face 800 const int faceIdx = (int)RandomValue(0.0f, (float)mMesh->mFaces.size() - 0.5f); 801 Face *face = mMesh->mFaces[faceIdx]; 802 803 // get random edge of face (hack: this is not uniform in the edges! 804 const int edgeIdx = (int)RandomValue(0.0f, face->mVertexIndices.size() - 0.5f); 805 806 const int vertexIdxA = face->mVertexIndices[edgeIdx]; 807 const int vertexIdxB = face->mVertexIndices[(edgeIdx + 1) % (int)face->mVertexIndices.size()]; 808 809 const Vector3 a = mMesh->mVertices[vertexIdxA]; 810 const Vector3 b = mMesh->mVertices[vertexIdxB]; 811 812 const float w = RandomValue(0.0f, 1.0f); 813 814 // get random point on edge 815 point = a * w + b * (1.0f - w); 816 817 // hack: set normal of face as normal 818 normal = mMesh->GetFacePlane(faceIdx).mNormal; 819 820 return 1; 801 821 } 802 822 -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r1765 r1768 689 689 //////// 690 690 //-- evaluation of render cost heuristics 691 691 692 float objRenderCost = 0, vcOverhead = 0, moveSpeed = 0; 692 693 -
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp
r1765 r1768 214 214 const float c = Magnitude(direction); 215 215 216 if (c <= Limits::Small) 217 return false; 216 if ((c <= Limits::Small) || (DotProd(direction, normal) < 0)) 217 { 218 return false; 219 } 218 220 219 221 // $$ jb the pdf is yet not correct for all sampling methods! -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1765 r1768 309 309 310 310 int ViewCellsManager::CastPassSamples(const int samplesPerPass, 311 const int sampleType, 312 VssRayContainer &passSamples) const 311 const vector<int> &strategies, 312 VssRayContainer &passSamples 313 ) const 313 314 { 314 315 SimpleRayContainer simpleRays; … … 318 319 int castRays = 0; 319 320 320 vector<int> strategies;321 322 strategies.push_back(SamplingStrategy::OBJECT_BASED_DISTRIBUTION);323 strategies.push_back(SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION);324 strategies.push_back(SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION);325 326 321 const int numRaysPerPass = samplesPerPass / (int)strategies.size(); 327 322 … … 397 392 cout << "view cell construction: casting " << mInitialSamples << " initial samples ... " << endl; 398 393 394 // mix of sampling strategies 395 vector<int> strategies; 396 strategies.push_back(SamplingStrategy::OBJECT_BASED_DISTRIBUTION); 397 strategies.push_back(SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION); 398 strategies.push_back(SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION); 399 399 400 // cast initial samples 400 CastPassSamples(mInitialSamples, mSamplingType,initialSamples);401 CastPassSamples(mInitialSamples, strategies, initialSamples); 401 402 402 403 cout << "finished in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; … … 460 461 startTime = GetTime(); 461 462 const int n = mConstructionSamples; //+initialSamples; 462 // should we use directional samples?463 bool dirSamples = (mSamplingType == SamplingStrategy::DIRECTION_BASED_DISTRIBUTION);464 463 465 464 while (numSamples < n) … … 470 469 VssRayContainer constructionSamples; 471 470 472 const int samplingType = mSamplingType;473 //dirSamples ? Preprocessor::DIRECTION_BASED_DISTRIBUTION : Preprocessor::SPATIAL_BOX_BASED_DISTRIBUTION;474 475 if (0) dirSamples = !dirSamples; // toggle sampling method476 477 471 // cast new samples 478 472 numSamples += CastPassSamples(mSamplesPerPass, 479 s amplingType,473 strategies, 480 474 constructionSamples); 481 475 … … 519 513 cout << "casting " << mPostProcessSamples << " post processing samples ... "; 520 514 521 CastPassSamples(mPostProcessSamples, mSamplingType, postProcessSamples);515 CastPassSamples(mPostProcessSamples, strategies, postProcessSamples); 522 516 523 517 cout << "finished" << endl; … … 566 560 VssRayContainer visSamples; 567 561 int numSamples = CastPassSamples(mVisualizationSamples, 568 mSamplingType,562 strategies, 569 563 visSamples); 570 564 … … 948 942 Debug << "view cell stats prefix: " << statsPrefix << endl; 949 943 950 // should directional sampling be used?951 bool dirSamples =952 (mEvaluationSamplingType == SamplingStrategy::DIRECTION_BASED_DISTRIBUTION);953 954 944 cout << "reseting pvs ... "; 955 945 … … 972 962 } 973 963 964 // mix of sampling strategies 965 vector<int> strategies; 966 strategies.push_back(SamplingStrategy::OBJECT_BASED_DISTRIBUTION); 967 strategies.push_back(SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION); 968 strategies.push_back(SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION); 969 974 970 cout << "finished" << endl; 975 971 cout << "Evaluating view cell partition ... " << endl; … … 988 984 Debug << "casting " << samplesPerPass << " samples ... "; 989 985 990 CastPassSamples(samplesPerPass, s amplingType, evaluationSamples);986 CastPassSamples(samplesPerPass, strategies, evaluationSamples); 991 987 992 988 castSamples += samplesPerPass; … … 1632 1628 ViewCellContainer::const_iterator it, it_end = mViewCells.end(); 1633 1629 1634 // volume and area of the view cells are recomputed and a view cell mesh is created 1630 // volume and area of the view cells are recomputed 1631 // a view cell mesh is created 1635 1632 for (it = mViewCells.begin(); it != it_end; ++ it) 1636 1633 { … … 4134 4131 { //////// 4135 4132 //-- real meshes are contructed at this stage 4133 4136 4134 cout << "finalizing view cells ... "; 4137 4135 FinalizeViewCells(true); … … 4334 4332 Debug << "post processing using " << (int)postProcessRays.size() << " samples" << endl; 4335 4333 4336 // should maybe be done here to allow merge working4337 // with area or volume and to correct the rendering statistics4338 if (0) FinalizeViewCells(false);4339 4340 4334 ////////// 4341 //-- merge the individualview cells4335 //-- merge neighbouring view cells 4342 4336 MergeViewCells(postProcessRays, objects); 4343 4337 … … 4358 4352 //////////// 4359 4353 //-- compression 4360 //#if HAS_TO_BE_REDONE 4354 4361 4355 if (ViewCellsTreeConstructed() && mCompressViewCells) 4362 4356 { … … 4369 4363 Debug << "number of entries after compress: " << pvsEntries << endl; 4370 4364 } 4371 //#endif4372 4365 4373 4366 // collapse sibling leaves that share the same view cell … … 5934 5927 int splitsStepSize; 5935 5928 5936 5937 5929 Environment::GetSingleton()->GetIntValue("ViewCells.Evaluation.samplesPerPass", samplesPerPass); 5938 5930 Environment::GetSingleton()->GetIntValue("ViewCells.Evaluation.samplesForStats", samplesForStats); … … 5946 5938 Debug << "view cell stats prefix: " << statsPrefix << endl; 5947 5939 5948 // should directional sampling be used? 5949 bool dirSamples = 5950 (mEvaluationSamplingType == SamplingStrategy::DIRECTION_BASED_DISTRIBUTION); 5940 // mix of sampling strategies 5941 vector<int> strategies; 5942 strategies.push_back(SamplingStrategy::OBJECT_BASED_DISTRIBUTION); 5943 strategies.push_back(SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION); 5944 strategies.push_back(SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION); 5951 5945 5952 5946 cout << "reseting pvs ... "; … … 5971 5965 Debug << "casting " << samplesPerPass << " samples ... "; 5972 5966 5973 CastPassSamples(samplesPerPass, s amplingType, evaluationSamples);5967 CastPassSamples(samplesPerPass, strategies, evaluationSamples); 5974 5968 5975 5969 castSamples += samplesPerPass; -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r1764 r1768 567 567 */ 568 568 int CastPassSamples(const int samplesPerPass, 569 const int sampleType,569 const vector<int> &strategies, 570 570 VssRayContainer &vssRays) const; 571 571
Note: See TracChangeset
for help on using the changeset viewer.