- Timestamp:
- 11/13/05 22:38:46 (19 years ago)
- Location:
- trunk/VUT
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/KdTree.h
r372 r407 178 178 /** \sa KdNode::IsLeaf() */ 179 179 virtual bool IsLeaf() const { return true; } 180 181 182 180 183 181 184 182 /** pointers to occluders contained in this node */ -
trunk/VUT/GtpVisibilityPreprocessor/src/RenderSimulator.cpp
r406 r407 27 27 Real renderTime = 0; 28 28 29 // render time for 1 object of PVS30 const float objRt = mObjRenderCost;31 // const overhead for crossing a view cell border32 const float vcOverhead = mVcOverhead;33 34 29 // total area of view cells 35 30 float totalArea = 0;//= mKdTree->GetBox().SurfaceArea(); … … 40 35 41 36 ViewCellContainer::const_iterator it, it_end = viewCells.end(); 42 37 38 // surface area substitute for probability 39 PolygonContainer cell; 40 43 41 for (it = viewCells.begin(); it != it_end; ++ it) 44 42 { 45 // surface area substitute for probability46 PolygonContainer cell;47 float area = 0;48 49 43 mBspTree->ConstructGeometry(dynamic_cast<BspViewCell *>(*it), cell); 50 51 area = Polygon3::GetArea(cell);44 CLEAR_CONTAINER(cell); 45 float area = Polygon3::GetArea(cell); 52 46 53 renderTime += area * RenderPvs(*(*it), objRt) + vcOverhead;47 renderTime += area * (RenderPvs(*(*it), mObjRenderCost) + mVcOverhead); 54 48 totalArea += area; 55 CLEAR_CONTAINER(cell);56 49 } 57 50 … … 64 57 } 65 58 66 Real BspTreeRenderSimulator::RenderPvs(ViewCell &viewCell, float objRenderTime) const 59 Real BspTreeRenderSimulator::RenderPvs(ViewCell &viewCell, 60 float objRenderTime) const 67 61 { 68 62 return viewCell.GetPvs().GetSize() * objRenderTime; 69 63 } 70 64 71 /***************************************************** 72 * class KdLeafRenderSimulator implementation *73 ***************************************************** /65 /******************************************************** 66 * class KdLeafRenderSimulator implementation * 67 *******************************************************/ 74 68 75 69 KdTreeRenderSimulator::KdTreeRenderSimulator(float objRenderCost, … … 82 76 Real KdTreeRenderSimulator::SimulateRendering() 83 77 { 78 //mKdTree->CollectLeavesPvs(); 79 80 // total render time 84 81 Real renderTime = 0; 82 // overhead for loading a view cell 83 float loadOverhead = 0; 85 84 86 // total area of view cells87 float totalArea = 0;//= mKdTree->GetBox().SurfaceArea();85 // probability that view point lies in a view cell 86 float pInVcTotal = 0;//mKdTree->GetBox().GetVolume(); 88 87 89 return renderTime; 88 // total probability that a view cell border is crossed 89 float pCrossVcTotal = 0; 90 91 vector<KdLeaf *> leaves; 92 mKdTree->CollectLeaves(leaves); 93 94 AxisAlignedBox3 box; 95 96 vector<KdLeaf *>::const_iterator it, it_end = leaves.end(); 97 98 for (it = leaves.begin(); it != it_end; ++ it) 99 { 100 box = mKdTree->GetBox(*it); 101 102 // volume substitute for view point probability 103 float pInVc = 0; 104 105 if (0) 106 pInVc = box.GetVolume(); 107 else 108 pInVc = box.SurfaceArea(); 109 110 // probability that a view cell border is crossed 111 const float pCrossVc = box.SurfaceArea(); 112 113 renderTime += pInVc * RenderPvs(*it, mObjRenderCost); 114 loadOverhead += pCrossVc * mVcOverhead; 115 116 pInVcTotal += pInVc; 117 pCrossVcTotal += pCrossVc; 118 } 119 120 renderTime /= pInVcTotal; 121 loadOverhead /= pCrossVcTotal; 122 123 return renderTime + loadOverhead; 90 124 } 125 126 Real KdTreeRenderSimulator::RenderPvs(KdLeaf *leaf, 127 float objRenderTime) const 128 { 129 return leaf->mKdPvs.GetSize() * objRenderTime; 130 } -
trunk/VUT/GtpVisibilityPreprocessor/src/RenderSimulator.h
r406 r407 7 7 class KdTree; 8 8 class ViewCell; 9 9 class KdLeaf; 10 10 11 11 /** Simulated rendering using a simple render heuristics. Used to evaluate the … … 47 47 public: 48 48 KdTreeRenderSimulator(float objRenderCost, float vcOverhead, KdTree *kdTree); 49 50 49 Real SimulateRendering(); 51 50 52 51 protected: 52 53 Real RenderPvs(KdLeaf *leaf, float objRenderTime) const; 54 53 55 KdTree *mKdTree; 54 56 }; -
trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp
r406 r407 537 537 538 538 if (ViewCell::sHierarchy == ViewCell::KD) 539 cout << "#total PvsSize=" << mKdTree->CollectLeafPvs() << endl;539 cout << "#totalKdPvsSize=" << mKdTree->CollectLeafPvs() << endl; 540 540 541 541 if (mBspTree) 542 542 { 543 543 //-- render simulation 544 cout << "\nevaluating render time before merge ... ";544 cout << "\nevaluating bsp view cells render time before merge ... "; 545 545 Real rt = BspTreeRenderSimulator(mObjRenderCost, mVcOverhead, mBspTree).SimulateRendering(); 546 546 … … 652 652 if (1) { 653 653 654 if (ViewCell::sHierarchy == ViewCell::KD) 655 { 656 cout << "\nevaluating kd view cells render time ... "; 657 Real rt = KdTreeRenderSimulator(mObjRenderCost, mVcOverhead, mKdTree).SimulateRendering(); 658 659 cout << "avg render time: " << rt * 1e-3 << endl; 660 Debug << "avg render time: " << rt * 1e-3 << endl; 661 } 662 654 663 for (int k=0; k < pvsOut; k++) { 655 664 Intersectable *object = objects[k]; -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r406 r407 48 48 float BspTree::sPvsFactor = 1.0f; 49 49 50 bool BspTree::sStoreLeavesWithRays = false; 50 51 int BspNode::mailID = 1; 51 52 … … 284 285 ++ contributingSamples; 285 286 } 286 // warning: intersections not ordered 287 ray->bspIntersections.push_back(Ray::BspIntersection((*it)->mMinT, this)); 287 if (BspTree::sStoreLeavesWithRays) 288 // warning: intersections not ordered 289 ray->bspIntersections.push_back(Ray::BspIntersection((*it)->mMinT, this)); 288 290 } 289 291 } -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h
r406 r407 794 794 static int sTermMaxObjectsForAxisAligned; 795 795 796 static bool sStoreLeavesWithRays; 797 796 798 /// axis aligned split criteria 797 799 static float sCt_div_ci;
Note: See TracChangeset
for help on using the changeset viewer.