- Timestamp:
- 11/09/05 01:54:05 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env
r389 r392 56 56 57 57 Sampling { 58 totalSamples 30000058 totalSamples 250000 59 59 samplesPerPass 3 60 60 } … … 73 73 minPvs 10 74 74 maxPvs 300 75 samples 10075 samples 0 76 76 } 77 77 … … 88 88 # input fromViewCells 89 89 # input fromSceneGeometry 90 samples 20000090 samples 50000 91 91 sideTolerance 0.005 92 92 } … … 133 133 Termination { 134 134 # autopartition 135 maxRays 300135 maxRays 100 136 136 maxPolygons 0 137 137 maxDepth 50 … … 152 152 153 153 154 Visualization 155 { 156 # if split polys are stored for visualization 157 storeSplitPolys false 154 Visualization { 158 155 # x3d visualization of the split planes 159 156 exportSplits true 160 157 # how much samples should be used in visualization 161 162 samples 2000 158 samples 300000 163 159 } 164 160 } -
trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.h
r372 r392 114 114 115 115 /// the view cell corresponding to unbounded space 116 ViewCell mUnbounded;116 BspViewCell mUnbounded; 117 117 }; 118 118 -
trunk/VUT/GtpVisibilityPreprocessor/src/Ray.h
r374 r392 41 41 42 42 Intersection(const float t, 43 44 43 Intersectable *object, 44 const int face):mT(t), mObject(object), mFace(face) {} 45 45 46 46 Intersection() {} … … 112 112 // Inititalize the ray again when already constructed 113 113 void Init(const Vector3 &wherefrom, 114 115 116 114 const Vector3 &whichdir, 115 const int _type, 116 bool dirNormalized = false) { 117 117 loc = wherefrom; 118 118 dir = (dirNormalized || _type == LINE_SEGMENT) ? whichdir: Normalize(whichdir) ; -
trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp
r391 r392 569 569 } 570 570 571 cout << "starting post processing using " << (int)mSampleRays.size()<< " samples ... ";571 cout << "starting post processing using " << mPostProcessSamples << " samples ... "; 572 572 573 573 long startTime = GetTime(); … … 690 690 } 691 691 692 void SamplingPreprocessor::ProcessBspViewCells( Ray &ray,693 694 int faceIndex,692 void SamplingPreprocessor::ProcessBspViewCells(const Ray &ray, 693 Intersectable *object, 694 const int faceIndex, 695 695 int &contributingSamples, 696 696 int &sampleContributions) … … 702 702 ((int)mSampleRays.size() < mBspConstructionSamples)) 703 703 { 704 // also add origin to sample in order to extract it as input polygons705 704 MeshInstance *mi = dynamic_cast<MeshInstance *>(object); 706 ray.sourceObject = Ray::Intersection(0.0, mi, faceIndex); 707 708 mSampleRays.push_back(new Ray(ray)); 705 706 Ray *sRay = new Ray(ray); 707 mSampleRays.push_back(sRay); 708 709 // also add origin to sample 710 sRay->sourceObject = Ray::Intersection(0.0, object, faceIndex); 709 711 } 710 712 else 711 713 { 712 // construct BSP tree using the samples714 // construct BSP tree using the collected samples 713 715 cout << "building bsp tree from " << (int)mSampleRays.size() << " samples " << endl; 714 716 BuildBspTree(); … … 910 912 exporter->SetForcedMaterial(m); 911 913 912 exporter->SetWireframe();914 //exporter->SetWireframe(); 913 915 914 916 // output PVS of view cell -
trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.h
r390 r392 75 75 @param sampleContributions contribution of the samples 76 76 */ 77 void ProcessBspViewCells( Ray &ray,77 void ProcessBspViewCells(const Ray &ray, 78 78 Intersectable *object, 79 int faceIndex,79 const int faceIndex, 80 80 int &contributingSamples, 81 81 int &sampleContributions); -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r391 r392 253 253 } 254 254 255 void BspLeaf:: GenerateViewCell(const BoundedRayContainer &rays,256 257 255 void BspLeaf::AddToPvs(const BoundedRayContainer &rays, 256 int &sampleContributions, 257 int &contributingSamples) 258 258 { 259 259 sampleContributions = 0; 260 260 contributingSamples = 0; 261 262 mViewCell = dynamic_cast<BspViewCell *>(ViewCell::Generate());263 mViewCell->mBspLeaves.push_back(this);264 261 265 262 BoundedRayContainer::const_iterator it, it_end = rays.end(); … … 273 270 if (!ray->intersections.empty()) 274 271 { 275 contribution += mViewCell->GetPvs().AddSample(ray->intersections[0].mObject);276 } 277 278 contribution += mViewCell->GetPvs().AddSample(ray->sourceObject.mObject);272 //contribution += mViewCell->GetPvs().AddSample(ray->intersections[0].mObject); 273 } 274 275 //contribution += mViewCell->GetPvs().AddSample(ray->sourceObject.mObject); 279 276 280 277 if (contribution > 0) … … 294 291 /****************************************************************/ 295 292 296 BspTree::BspTree( ViewCell *viewCell):293 BspTree::BspTree(BspViewCell *viewCell): 297 294 mRootCell(viewCell), mRoot(NULL), mGenerateViewCells(false), 298 295 mStorePiercingRays(true) … … 707 704 BspLeaf *leaf = dynamic_cast<BspLeaf *>(tData.mNode); 708 705 706 BspViewCell *viewCell; 707 709 708 // generate new view cell for each leaf 710 709 if (mGenerateViewCells) 711 710 { 712 int conSamp, sampCon; 713 leaf->GenerateViewCell(*tData.mRays, conSamp, sampCon); 711 viewCell = dynamic_cast<BspViewCell *>(ViewCell::Generate()); 712 } 713 else 714 { 715 // add view cell to leaf 716 viewCell = dynamic_cast<BspViewCell *>(tData.mViewCell); 717 } 718 719 leaf->SetViewCell(viewCell); 720 viewCell->mBspLeaves.push_back(leaf); 721 722 //-- add pvs 723 if (viewCell != mRootCell) 724 { 725 int conSamp = 0, sampCon = 0; 726 leaf->AddToPvs(*tData.mRays, conSamp, sampCon); 714 727 715 728 mStat.contributingSamples += conSamp; 716 729 mStat.sampleContributions += sampCon; 717 }718 else719 {720 // add view cell to leaf721 leaf->SetViewCell(dynamic_cast<BspViewCell *>(tData.mViewCell));722 leaf->mViewCell->mBspLeaves.push_back(leaf);723 730 } 724 731 … … 1334 1341 1335 1342 if (1) // use front and back cell areas to approximate volume 1336 { 1337 //-- compute area 1338 1343 { 1339 1344 // construct child geometry with regard to the candidate split plane 1340 1345 frontData.mCell = cell.ConstructChild(*this, candidatePlane, true); 1341 1346 backData.mCell = cell.ConstructChild(*this, candidatePlane, false); 1342 1347 1343 frontData.mArea = frontData.mCell->GetArea(); 1344 backData.mArea = backData.mCell->GetArea(); 1345 1346 pFront = frontData.mArea; 1347 pBack = backData.mArea; 1348 pFront = frontData.mArea = frontData.mCell->GetArea(); 1349 pBack = backData.mArea = backData.mCell->GetArea(); 1348 1350 1349 1351 pOverall = area; … … 1409 1411 1410 1412 if ((sSplitPlaneStrategy & PVS) && area && pvs) 1411 val += sPvsFactor * (frontData.mPvs * pFront + (backData.mPvs * pBack)) / (pOverall * (float)pvs * 2); 1412 1413 Debug << "pvs: " << pvs << " totalArea: " << area 1413 val += sPvsFactor * (frontData.mPvs * pFront + (backData.mPvs * pBack)) / 1414 (pOverall * (float)pvs * 2); 1415 1416 Debug << "totalpvs: " << pvs << " ptotal: " << pOverall 1414 1417 << " frontpvs: " << frontData.mPvs << " pFront: " << pFront 1415 1418 << " backpvs: " << backData.mPvs << " pBack: " << pBack … … 2486 2489 if (!planePoly) 2487 2490 { 2488 Debug << "returning 'same' geometry " << mPolys.size();2489 2491 //geometry is not changed at all, hence just copy polygons 2490 2492 PolygonContainer::const_iterator it, it_end = mPolys.end(); 2493 2491 2494 for (it = mPolys.begin(); it != it_end; ++ it) 2492 2495 childCell->mPolys.push_back(new Polygon3((*it)->mVertices)); … … 2513 2516 2514 2517 poly->Split(splitPlane, *frontPoly, *backPoly, splitPts); 2518 2515 2519 DEL_PTR(poly); 2516 2520 … … 2554 2558 childCell->mSides.push_back(side); 2555 2559 2556 Debug << "returning new geometry " << mPolys.size(); 2557 2560 Debug << "returning new geometry " << mPolys.size() << " CHILD: " << childCell->mPolys.size() << endl; 2561 2562 Debug << "old area " << this->GetArea() << " new: " << childCell->GetArea() << endl; 2558 2563 return childCell; 2559 2564 } -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h
r390 r392 315 315 void SetViewCell(BspViewCell *viewCell); 316 316 317 /** Generates new view cell and adds rays to the PVS.317 /** Adds rays to the PVS. 318 318 @param sampleContributions the number contributions of the sampels 319 319 @param contributingSampels the number of contributing rays 320 320 321 321 */ 322 void GenerateViewCell(const BoundedRayContainer &rays, 323 int &sampleContributions, 324 int &contributingSamples); 322 void AddToPvs(const BoundedRayContainer &rays, int &sampleContributions, 323 int &contributingSamples); 325 324 326 325 protected: … … 392 391 @param viewCell view cell corresponding to unbounded space 393 392 */ 394 BspTree( ViewCell *viewCell);393 BspTree(BspViewCell *viewCell); 395 394 396 395 ~BspTree(); … … 771 770 772 771 /// view cell corresponding to unbounded space 773 ViewCell *mRootCell;772 BspViewCell *mRootCell; 774 773 775 774 /// should view cells be stored or generated in the leaves?
Note: See TracChangeset
for help on using the changeset viewer.