Changeset 598 for trunk/VUT/GtpVisibilityPreprocessor
- Timestamp:
- 02/05/06 11:03:17 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env
r597 r598 36 36 loadInitialSamples false 37 37 storeInitialSamples false 38 useViewSpaceBox false38 useViewSpaceBox true 39 39 # testBeamSampling true 40 40 } … … 213 213 useRaysForMerge false 214 214 refine false 215 compress true215 compress false 216 216 merge false 217 217 } … … 322 322 Termination { 323 323 # parameters used for autopartition 324 minRays 150324 minRays -150 325 325 minPolygons -1 326 326 maxDepth 30 327 minPvs 10327 minPvs -10 328 328 #minProbability 0.0001 329 329 minProbability -1 330 maxRayContribution 0.3 331 maxCostRatio 0.9 330 # maxRayContribution 0.3 331 maxRayContribution 2.3 332 # maxCostRatio 0.9 333 maxCostRatio 3.9 332 334 missTolerance 3 333 #maxAccRayLength 100 335 334 336 335 337 maxViewCells 512 -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp
r597 r598 85 85 { 86 86 DEL_PTR(mRenderer); 87 //CLEAR_CONTAINER(mViewCells); 88 DEL_PTR(mViewCellsTree); 87 88 if (!ViewCellsTreeConstructed()) 89 CLEAR_CONTAINER(mViewCells); 90 else 91 DEL_PTR(mViewCellsTree); 89 92 90 93 CLEAR_CONTAINER(mMeshContainer); … … 689 692 int axis = 0; 690 693 691 Vector3 point = mViewSpaceBox.Center(); 694 const float factor = 0.55; 695 Vector3 point = mViewSpaceBox.Min() + mViewSpaceBox.Size() * factor; 692 696 693 697 if (mUseCuttingPlaneForViz) … … 1277 1281 if (exporter) 1278 1282 { 1283 //exporter->SetFilled(); 1284 1285 if (mExportGeometry) 1286 exporter->ExportGeometry(objects); 1287 1279 1288 Material m; 1280 1289 m.mDiffuseColor = RgbColor(1, 0, 0); … … 1288 1297 exporter->SetForcedMaterial(m); 1289 1298 //exporter->ResetForcedMaterial(); 1290 1291 exporter->SetFilled();1292 1293 if (mExportGeometry)1294 exporter->ExportGeometry(objects);1295 1299 1296 1300 delete exporter; … … 1402 1406 ViewCell *vc) const 1403 1407 { 1404 if (mColorCode == 0) // Random color 1405 { 1406 exporter->ResetForcedMaterial(); 1407 return; 1408 } 1408 const bool vcValid = CheckValidity(vc, mMinPvsSize, mMaxPvsSize); 1409 1409 1410 1410 float importance = 0; 1411 static Material m; 1411 1412 1412 1413 switch (mColorCode) 1413 1414 { 1415 case 0: // Random 1416 { 1417 if (vcValid) 1418 { 1419 m.mDiffuseColor.r = 0.5f + RandomValue(0.0f, 0.5f); 1420 m.mDiffuseColor.g = 0.5f + RandomValue(0.0f, 0.5f); 1421 m.mDiffuseColor.b = 0.5f + RandomValue(0.f, 0.5f); 1422 } 1423 else 1424 { 1425 m.mDiffuseColor.r = 0.0f; 1426 m.mDiffuseColor.g = 1.0f; 1427 m.mDiffuseColor.b = 0.0f; 1428 } 1429 1430 exporter->SetForcedMaterial(m); 1431 return; 1432 } 1433 1414 1434 case 1: // pvs 1415 1435 { 1416 1436 importance = (float)vc->GetPvs().GetSize() / 1417 1437 (float)mViewCellsStats.maxPvs; 1438 1418 1439 } 1419 1440 break; 1420 1441 case 2: // merges 1421 1442 { 1422 importance = (float)mViewCellsTree->GetSize(vc) / 1423 (float)mViewCellsStats.maxLeaves; 1424 } 1425 break; 1443 int lSize = mViewCellsTree->GetSize(vc); 1444 1445 importance = (float)lSize / (float)mViewCellsStats.maxLeaves; 1446 } 1447 //break; 1426 1448 case 3: // merge tree differene 1427 1449 { 1428 1450 // TODO 1451 //importance = (float)GetMaxTreeDiff(vc) / 1452 // (float)(mVspBspTree->GetStatistics().maxDepth * 2); 1453 1429 1454 } 1430 1455 break; … … 1433 1458 } 1434 1459 1435 Material m; 1436 m.mDiffuseColor.b = 1.0f; 1460 // special color code for invalid view cells 1437 1461 m.mDiffuseColor.r = importance; 1438 1462 m.mDiffuseColor.g = 1.0f - m.mDiffuseColor.r; 1439 1463 m.mDiffuseColor.b = vcValid ? 1.0f : 0.0f; 1464 1465 //Debug << "importance: " << importance << endl; 1440 1466 exporter->SetForcedMaterial(m); 1441 1467 } … … 1466 1492 *cuttingPlane, 1467 1493 mViewSpaceBox, 1468 0.00 5);1494 0.0001); 1469 1495 1470 1496 exporter->ExportPolygons(back.mPolys); … … 2049 2075 return; 2050 2076 2077 if (mExportGeometry) 2078 exporter->ExportGeometry(objects); 2079 2051 2080 //exporter->SetWireframe(); 2052 2081 //exporter->ExportVspKdTree(*mVspKdTree, mVspKdTree->GetStatistics().maxPvsSize); 2053 2082 exporter->ExportVspKdTree(*mVspKdTree); 2054 2055 if (mExportGeometry)2056 exporter->ExportGeometry(objects);2057 2083 2058 2084 if (mExportRays) … … 2416 2442 if (exporter) 2417 2443 { 2444 if (0 && mExportRays) 2445 exporter->ExportRays(rays, RgbColor(1, 1, 1)); 2446 2447 if (mExportGeometry) 2448 exporter->ExportGeometry(objects); 2449 2418 2450 //exporter->SetWireframe(); 2419 2451 exporter->SetFilled(); 2420 2452 ExportViewCellsForViz(exporter); 2421 2422 if (0 && mExportRays)2423 exporter->ExportRays(rays, RgbColor(1, 1, 1));2424 2425 if (mExportGeometry)2426 exporter->ExportGeometry(objects);2427 2453 2428 2454 delete exporter; … … 2497 2523 if (exporter) 2498 2524 { 2499 if (0)2500 exporter->SetWireframe();2501 else2502 exporter->SetFilled();2503 ExportViewCellsForViz(exporter);2504 2505 2525 if (mExportGeometry) 2506 2526 { … … 2513 2533 } 2514 2534 2535 if (0) 2536 exporter->SetWireframe(); 2537 else 2538 exporter->SetFilled(); 2539 2540 ExportViewCellsForViz(exporter); 2541 2515 2542 delete exporter; 2516 2543 } … … 2600 2627 RefineViewCells(postProcessRays, objects); 2601 2628 2602 if (mCompressViewCells) 2629 //-- compression 2630 2631 if (ViewCellsTreeConstructed() && mCompressViewCells) 2603 2632 { 2604 2633 int pvsEntries = mViewCellsTree->GetNumPvsEntries(mViewCellsTree->GetRoot()); … … 2628 2657 2629 2658 2630 //-- export shuffledview cells2659 //-- export refined (shuffled) view cells 2631 2660 if (0) 2632 2661 { … … 2701 2730 // real meshes are only contructed only at this stage 2702 2731 FinalizeViewCells(true); 2703 2704 // HACK: removes view cells in bsp leaves with active ones2705 if (0)2706 AddCurrentViewCellsToHierarchy();2707 2708 2732 2709 2733 // write view cells to disc … … 3056 3080 if (vcValid) 3057 3081 { 3058 m.mDiffuseColor.r = RandomValue(0.3f, 1.0f);3059 m.mDiffuseColor.g = RandomValue(0.3f, 1.0f);3060 m.mDiffuseColor.b = RandomValue(0.3f, 1.0f);3082 m.mDiffuseColor.r = 0.5f + RandomValue(0.0f, 0.5f); 3083 m.mDiffuseColor.g = 0.5f + RandomValue(0.0f, 0.5f); 3084 m.mDiffuseColor.b = 0.5f + RandomValue(0.f, 0.5f); 3061 3085 } 3062 3086 else … … 3140 3164 *cuttingPlane, 3141 3165 mViewSpaceBox, 3142 0.00 5);3166 0.0001); 3143 3167 3144 3168 exporter->ExportPolygons(back.mPolys); -
trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.cpp
r589 r598 2273 2273 } 2274 2274 } 2275 #if 0 2276 void VspKdTree::CollectMergeCandidates(const vector<VspKdRay *> &rays) 2277 { 2278 VspKdMergeCandidate::sOverallCost = 0; 2279 2280 vector<VspKdIntersection>::const_iterator iit; 2281 map<BspLeaf *, vector<BspLeaf*> candidateMap; 2282 2283 for (int i = 0; i < (int)rays.size(); ++ i) 2284 { 2285 //VspKdLeaf::NewMail(); 2286 VspKdRay *ray = rays[i]; 2287 2288 // traverse leaves stored in the rays and compare and merge consecutive 2289 // leaves (i.e., the neighbors in the tree) 2290 if (ray->intersections.size() < 2) 2291 continue; 2292 2293 iit = ray->intersections.begin(); 2294 2295 BspLeaf *previousLeaf = (*iit).mLeaf; 2296 2297 ++ iit; 2298 2299 for (; iit != ray->intersections.end(); ++ iit) 2300 { 2301 BspLeaf *leaf = (*iit).mLeaf; 2302 leaf->Mail 2303 // TODO: how to sort out doubles? 2304 VspKdMergeCandidate mc = VspKdMergeCandidate(leaf, previousLeaf); 2305 mMergeQueue.push(mc); 2306 2307 VspKdMergeCandidate::sOverallCost += mc.GetLeaf1Cost(); 2308 VspKdMergeCandidate::sOverallCost += mc.GetLeaf2Cost(); 2309 2310 previousLeaf = leaf; 2311 } 2312 } 2313 } 2314 #endif 2275 2315 2276 2316 2277 int VspKdTree::MergeViewCells(const VssRayContainer &rays) -
trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp
r590 r598 41 41 { 42 42 CLEAR_CONTAINER(mVssRays); 43 DEL_PTR(mViewSpaceBox); 43 44 } 44 45 … … 526 527 if (mUseViewSpaceBox) 527 528 { 528 mViewSpaceBox = box; 529 if (0) 530 mViewSpaceBox = box; 531 else 532 { 533 // HACK: enlarge in y directon 534 mViewSpaceBox = new AxisAlignedBox3(mKdTree->GetBox()); 535 //Vector3 pmin = mViewSpaceBox->Min(); 536 Vector3 size = mViewSpaceBox->Size(); 537 //size[1] *= 1.25; 538 Vector3 enlarge(size[0] * 0.1f, size[1] * 0.0f, size[2] * 0.1); 539 540 mViewSpaceBox->Enlarge(enlarge); 541 } 542 543 //Debug << "view space box: " << *mViewSpaceBox << endl; 529 544 } 530 545 else
Note: See TracChangeset
for help on using the changeset viewer.