Changeset 1584 for GTP/trunk/Lib
- Timestamp:
- 10/08/06 23:29:21 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/InternalRayCaster.cpp
r1583 r1584 29 29 { 30 30 //cout << "internal ray" << endl; 31 static Ray ray; 31 32 int hits = 0; 32 static Ray ray;33 33 Intersection hitA(simpleRay.mOrigin), hitB(simpleRay.mOrigin); 34 35 // inside test for bounding box 36 // enlarge box slightly so the view point fits for sure 37 // AxisAlignedBox3 sbox = box; 38 // sbox.Enlarge(Vector3(-Limits::Small)); 39 // $$ JB moved here from Validate routine 40 if (!box.IsInside(simpleRay.mOrigin)) { 41 return 0; 42 } 34 43 35 44 mPreprocessor.SetupRay(ray, simpleRay.mOrigin, simpleRay.mDirection); -
GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp
r1583 r1584 192 192 int objectsBack, objectsFront; 193 193 float costRatio; 194 bool mOnlyDrivingAxis = false;194 bool mOnlyDrivingAxis = true; 195 195 196 196 if (mOnlyDrivingAxis) { … … 608 608 float mint = 0; 609 609 610 ray.ComputeInvertedDir();610 // ray.ComputeInvertedDir(); 611 611 612 612 Intersectable::NewMail(); … … 617 617 if (mint < 0) 618 618 mint = 0; 619 619 620 620 621 maxt += Limits::Threshold; -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r1582 r1584 25 25 26 26 #define DEBUG_RAYCAST 0 27 #define SHOW_RAYCAST_TIMING 1 27 28 28 29 … … 882 883 { 883 884 mRayCaster->CastRays16( 884 i,885 rays,886 vssRays,887 mViewCellsManager->GetViewSpaceBox(),888 castDoubleRays,889 pruneInvalidRays);885 i, 886 rays, 887 vssRays, 888 mViewCellsManager->GetViewSpaceBox(), 889 castDoubleRays, 890 pruneInvalidRays); 890 891 i += 16; 891 892 } 892 893 else 893 {894 { 894 895 mRayCaster->CastRay( 895 rays[i],896 vssRays,897 mViewCellsManager->GetViewSpaceBox(),898 castDoubleRays,899 pruneInvalidRays);896 rays[i], 897 vssRays, 898 mViewCellsManager->GetViewSpaceBox(), 899 castDoubleRays, 900 pruneInvalidRays); 900 901 i ++; 901 } 902 } 903 904 if (i % 10000 == 0) 905 cout<<"."; 906 907 #if DEBUB_RAYCAST 902 } 903 if (i % 10000 == 0) 904 cout<<"."; 905 } 906 907 908 908 long t2 = GetTime(); 909 910 #if SHOW_RAYCAST_TIMING 909 911 if (castDoubleRays) 910 912 cout << 2 * rays.size() / (1e3f * TimeDiff(t1, t2)) << "M rays/s" << endl; … … 956 958 // do not store anything else then intersections at the ray 957 959 ray.Init(point, direction, Ray::LOCAL_RAY); 958 } 959 960 961 } 960 961 } 962 963 964 } -
GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer.cpp
r1581 r1584 1247 1247 RenderRays(rays); 1248 1248 } 1249 1249 1250 if (mShowRenderCost) 1251 RenderRenderCost(); 1250 1252 } 1251 1253 mFrame++; … … 1407 1409 } 1408 1410 1409 1410 void 1411 QtGlRendererWidget::RenderInfo() 1412 { 1413 QString s; 1414 int vc = 0; 1415 if (mViewCellsManager) 1416 vc = mViewCellsManager->GetViewCells().size(); 1417 int filter = 0; 1418 if (mViewCellsManager) 1419 filter = mViewCellsManager->GetMaxFilterSize(); 1420 1421 s.sprintf("frame:%04d viewpoint:(%4.1f,%4.1f,%4.1f) dir:(%4.1f,%4.1f,%4.1f) viewcells:%04d filter:%04d pvs:%04d error:%5.5f\%", 1422 mFrame, 1423 mViewPoint.x, 1424 mViewPoint.y, 1425 mViewPoint.z, 1426 mViewDirection.x, 1427 mViewDirection.y, 1428 mViewDirection.z, 1429 vc, 1430 1431 filter, 1432 mPvsSize, 1433 mRenderError*100.0f 1434 ); 1435 1436 glColor3f(0.0f,0.0f,0.0f); 1437 renderText(0,20,s); 1438 1439 if (mShowRenderCost) { 1411 void 1412 QtGlRendererWidget::RenderRenderCost() 1413 { 1440 1414 static vector<float> costFunction; 1441 1415 static float maxCost = -1; … … 1531 1505 1532 1506 } 1533 } 1507 1508 1509 1510 } 1511 1512 void 1513 QtGlRendererWidget::RenderInfo() 1514 { 1515 QString s; 1516 int vc = 0; 1517 if (mViewCellsManager) 1518 vc = mViewCellsManager->GetViewCells().size(); 1519 int filter = 0; 1520 if (mViewCellsManager) 1521 filter = mViewCellsManager->GetMaxFilterSize(); 1522 1523 s.sprintf("frame:%04d viewpoint:(%4.1f,%4.1f,%4.1f) dir:(%4.1f,%4.1f,%4.1f) viewcells:%04d filter:%04d pvs:%04d error:%5.5f\%", 1524 mFrame, 1525 mViewPoint.x, 1526 mViewPoint.y, 1527 mViewPoint.z, 1528 mViewDirection.x, 1529 mViewDirection.y, 1530 mViewDirection.z, 1531 vc, 1532 1533 filter, 1534 mPvsSize, 1535 mRenderError*100.0f 1536 ); 1537 1538 glColor3f(0.0f,0.0f,0.0f); 1539 renderText(0,20,s); 1540 1534 1541 } 1535 1542 … … 1729 1736 connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetShowViewCells(bool))); 1730 1737 1731 cb = new QCheckBox(" Show render cost", hbox);1738 cb = new QCheckBox("Render cost curve", hbox); 1732 1739 hlayout->addWidget(cb); 1733 1740 cb->setChecked(false); 1734 1741 connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetShowRenderCost(bool))); 1735 1742 1736 cb = new QCheckBox("Show pvs sizes", hbox);1743 cb = new QCheckBox("Show render cost", hbox); 1737 1744 hlayout->addWidget(cb); 1738 1745 cb->setChecked(false); -
GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer.h
r1581 r1584 208 208 QtGlRendererWidget() {}; 209 209 210 void 211 RenderRenderCost(); 212 210 213 virtual void SetupCamera(); 211 214 // setup a transformation for manipulator -
GTP/trunk/Lib/Vis/Preprocessing/src/Ray.cpp
r1583 r1584 29 29 30 30 // apply the standard precomputation 31 Precompute(); 31 //Precompute(); 32 // $$ JB precomputation will be applied only when the origin/dir valueas are set 33 SetId(); 32 34 } 33 35 … … 36 38 { 37 39 // initialize inverted dir 38 invDir.SetValue(0.0, 0.0, 0.0); 39 40 // invDir.SetValue(0.0, 0.0, 0.0); 40 41 SetId(); 42 ComputeInvertedDir(); 41 43 } 42 44 … … 83 85 Ray::ComputeInvertedDir() const 84 86 { 85 if ( (invDir.x != 0.0) ||86 87 88 return; // has been already precomputed87 // if ( (invDir.x != 0.0) || 88 // (invDir.y != 0.0) || 89 // (invDir.z != 0.0) ) 90 // return; // has been already precomputed 89 91 90 92 const float eps = 1e-6f; … … 240 242 if (vssRay.mTerminationObject) 241 243 intersections.push_back(Intersection(len, -vssRay.GetDir(), vssRay.mTerminationObject, 0)); 244 242 245 243 246 Precompute(); -
GTP/trunk/Lib/Vis/Preprocessing/src/Ray.h
r1528 r1584 131 131 depth = 0; 132 132 Init(); 133 Precompute(); 133 134 } 134 135 … … 231 232 Vector3 &extP) const; 232 233 234 Vector3 GetInvDir() const { return invDir; } 235 233 236 private: 234 237 Vector3 loc, dir; // Describes ray origin and vector -
GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.cpp
r1583 r1584 10 10 #define DEBUG_RAYCAST 0 11 11 12 #define EXACT_BOX_CLIPPING 1 12 13 13 14 RayCaster::RayCaster(const Preprocessor &preprocessor): … … 43 44 Intersection &hit) 44 45 { 45 if (!hit.mObject) 46 { 47 // compute intersection with the scene bounding box 48 static Ray ray; 49 mPreprocessor.SetupRay(ray, origin, direction); 50 51 float tmin, tmax; 52 if (box.ComputeMinMaxT(ray, &tmin, &tmax) && (tmin < tmax)) 53 { 54 hit.mPoint = ray.Extrap(tmax); 55 } 56 else 57 { 58 return false; 59 } 60 } 61 else if (mPreprocessor.mDetectEmptyViewSpace) 62 { 63 if (DotProd(hit.mNormal, direction) >= 0) 64 { 65 hit.mObject = NULL; 66 return false; 67 } 46 if (!hit.mObject) { 47 // compute intersection with the scene bounding box 48 #if EXACT_BOX_CLIPPING 49 static Ray ray; 50 mPreprocessor.SetupRay(ray, origin, direction); 51 52 float tmin, tmax; 53 if (box.ComputeMinMaxT(ray, &tmin, &tmax) && (tmin < tmax)) { 54 hit.mPoint = ray.Extrap(tmax); 55 } 56 else { 57 // cout<<" invalid hp "<<tmin<<" "<<tmax<<endl; 58 // cout<<" box "<<box<<endl; 59 // cout<<" origin "<<origin<<endl; 60 // cout<<" direction "<<direction<<endl; 61 // cout<< "inv dir"<<ray.GetInvDir()<<endl; 62 return false; 63 } 64 #else 65 hit.mPoint = origin + direction*Magnitude(box.Diagonal()); 66 #endif 68 67 } 69 68 else if (mPreprocessor.mDetectEmptyViewSpace) { 69 if (DotProd(hit.mNormal, direction) >= 0) { 70 hit.mObject = NULL; 71 return false; 72 } 73 } 74 70 75 return true; 71 76 } … … 88 93 if (pruneInvalidRays) 89 94 { 90 if (!hitA.mObject && !hitB.mObject) 91 { 92 return 0; 93 } 95 if (!hitA.mObject && !hitB.mObject) { 96 return 0; 97 } 98 99 } 94 100 95 // inside test for bounding box96 // enlarge box slightly so the view point fits for sure97 AxisAlignedBox3 sbox = box;98 sbox.Enlarge(Vector3(-Limits::Small));99 100 if (!sbox.IsInside(simpleRay.mOrigin))101 {102 return 0;103 }104 }105 106 101 const bool validA = 107 ValidateRay(simpleRay.mOrigin, simpleRay.mDirection, box, hitA); 102 ValidateRay(simpleRay.mOrigin, simpleRay.mDirection, box, hitA); 103 108 104 if (!validA && pruneInvalidRays) 109 {105 { 110 106 return 0; 111 }112 107 } 108 113 109 const bool validB = castDoubleRay && 114 115 110 ValidateRay(simpleRay.mOrigin, -simpleRay.mDirection, box, hitB); 111 116 112 if (!validB && pruneInvalidRays) 117 {113 { 118 114 return 0; 119 115 } -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1582 r1584 623 623 // create the meshes and compute volumes 624 624 vm->FinalizeViewCells(true); 625 vm->mViewCellsTree->AssignRandomColors();625 // vm->mViewCellsTree->AssignRandomColors(); 626 626 } 627 627 … … 1521 1521 } 1522 1522 1523 mViewCellsTree->AssignRandomColors(); 1524 1523 1525 mTotalAreaValid = false; 1524 1526 } -
GTP/trunk/Lib/Vis/Preprocessing/src/default.env
r1583 r1584 7 7 8 8 #filename ../data/City4M/City4M.obj 9 # 9 #filename ../data/CityModel/CityModel.obj 10 10 # filename ../data/GrandCanyon/grandcanyon1_RotXmin90.obj 11 11 # filename ../data/glasgow/glasgow1.x3d 12 12 # filename vienna.x3d 13 #filename ../data/vienna/vienna-simple.x3d13 filename ../data/vienna/vienna-simple.x3d 14 14 # filename ../data/vienna/vienna-buildings.x3d 15 15 # filename ../data/vienna/city1500_flat_1.x3d 16 # filename ../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d16 # filename ../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d 17 17 #;../data/vienna/vienna-plane.x3d;../data/vienna/vienna-roads.x3d 18 18 # filename ../data/vienna/viewcells-25-sel.x3d 19 19 #filename ../data/atlanta/atlanta2.x3d 20 filename ../data/soda/soda.dat20 #filename ../data/soda/soda.dat 21 21 #filename ../data/test1/test2.x3d 22 22 #filename ../data/soda/soda5.dat … … 53 53 visibilityFilterWidth 0.01 54 54 visibilityFile visibility.xml 55 loadMeshes false55 loadMeshes true 56 56 loadKdTree false 57 57 exportKdTree false … … 59 59 60 60 ObjParser { 61 meshGrouping 50061 meshGrouping 1 62 62 } 63 63 … … 142 142 sahUseFaces false 143 143 Termination { 144 minCost 1144 minCost 0.95 145 145 maxDepth 30 146 146 maxCostRatio 1.0 147 147 ct_div_ci 0.5 148 maxNodes 200000149 148 maxNodes 100000 149 #200000 150 150 #500000 151 151 } … … 173 173 174 174 175 176 175 177 ViewCells { 176 178 # samples used for view cell construction 177 179 Construction { 178 samples 100000 179 samplesPerPass 100000 180 } 181 182 Filter { 183 maxSize 5 184 width 0.02 180 samples 0 181 samplesPerPass 1500000 185 182 } 186 183 187 184 #number of active view cells 188 185 active 5000 189 maxStaticMemory 200 186 maxViewCells 5000 187 188 maxStaticMemory 40 190 189 191 190 exportToFile true 192 loadFromFile true193 191 loadFromFile false 192 194 193 #type kdTree 195 194 #type vspKdTree 196 195 #type bspTree 197 196 type vspBspTree 198 #type vspOspTree199 197 #type sceneDependent 200 198 201 199 height 5.0 202 maxViewCells 5000203 200 204 201 #percentage of total visible objects where pvs is considered invalid 205 202 maxPvsRatio 1.0 206 203 207 pruneEmptyViewCells false208 204 processOnlyValidViewCells false 209 205 210 206 #stats viewCellStats.log 211 207 212 samplingType directional213 #samplingType box208 #samplingType directional 209 samplingType box 214 210 215 211 PostProcess { 216 212 # how much samples are used for post processing 217 samples 100000213 samples 0 218 214 renderCostWeight 1.0 219 215 maxCostRatio 0.1 … … 222 218 maxMergesPerPass 5000 223 219 useRaysForMerge false 224 refine false225 220 compress false 226 merge false221 merge true 227 222 } 228 223 229 224 Visualization { 230 225 # how much samples we use for visualization 231 samples 100000226 samples 0 232 227 #colorCode PVS 233 228 #colorCode MergedLeaves … … 235 230 colorCode Random 236 231 exportRays false 237 exportGeometry false232 exportGeometry true 238 233 exportMergedViewCells false 239 234 useClipPlane true 240 235 clipPlaneAxis 1 241 } 242 243 showVisualization false 236 clipPlanePos 0.3 237 } 238 239 showVisualization true 244 240 evaluateViewCells false 245 241 246 242 Evaluation { 247 samplesPerPass 500248 samples 1000 243 samplesPerPass 1000000 244 samples 1000000 249 245 statsPrefix ../scripts/viewCells 246 #samplingType directional 247 samplingType box 248 histogram true 249 histoStepSize 5000 250 250 } 251 251 … … 259 259 # filename ../data/soda/soda5-viewcells.xml 260 260 # filename ../scripts/viewcells_atlanta.xml 261 filename ../data/soda/soda-viewcells-5000.xml261 # filename ../data/soda/soda-viewcells-5000.xml 262 262 # filename ../data/test1/test-viewcells.xml 263 263 … … 268 268 269 269 270 #filename ../data/vienna/vsposp-seq-viewCells.xml.gz270 filename ../data/vienna/vsposp-seq-viewCells.xml.gz 271 271 272 272 # filename ../data/atlanta/viewcells_atlanta3.xml … … 291 291 292 292 293 294 293 VspBspTree { 295 294 Construction { 296 samples 800000297 epsilon 0.000 5295 samples 500000 296 epsilon 0.0000001 298 297 randomize false 299 298 renderCostWeight 1.0 … … 310 309 311 310 # maximal candidates for split planes 312 maxPolyCandidates 150311 maxPolyCandidates 0 313 312 314 313 usePolygonSplitIfAvailable false … … 334 333 minPolygons -1 335 334 maxDepth 25 336 minPvs -15337 minProbability 0.00000 001338 maxRayContribution 1 .8339 maxCostRatio 1.8335 minPvs 0 336 minProbability 0.000001 337 maxRayContribution 1 338 maxCostRatio 0.9 340 339 missTolerance 6 341 340 globalCostMissTolerance 4 342 minGlobalCostRatio 0.0000001343 #minGlobalCostRatio 0.0001344 # $$ MAXVIEWCELLS341 #minGlobalCostRatio 0.0000001 342 minGlobalCostRatio 0.0001 343 # $$ MAX 345 344 maxViewCells 5000 346 345 … … 356 355 357 356 useSplitCostQueue true 358 useCostHeuristics true357 useCostHeuristics false 359 358 360 359 splitUseOnlyDrivingAxis false … … 362 361 useRandomAxis false 363 362 usePolygonSplitIfAvailable false 364 useBreathFirstSplits false363 nodePriorityQueueType 0 365 364 366 365 Visualization { … … 370 369 } 371 370 371 BspTree { 372 Construction { 373 samples 100000 374 epsilon 0.005 375 } 376 377 378 # random polygon = 1 379 # axis aligned = 2 380 # least splits = 4 381 # balanced polygons = 8 382 # balanced view cells = 16 383 # largest polygon area = 32 384 # vertical axis = 64 385 # blocked rays = 128 386 # least ray splits = 256 387 # balanced rays = 512 388 # pvs = 1024 389 390 # least splits + balanced polygons 391 #splitPlaneStrategy 12 392 393 #axis aligned + vertical axis 394 #splitPlaneStrategy 66 395 396 # axis aligned + balanced view cells 397 # splitPlaneStrategy 18 398 399 # largest polygon area 400 #splitPlaneStrategy 32 401 402 # axus aligned + balanced polygons 403 #splitPlaneStrategy 72 404 405 # axis aligned + blocked rays 406 #splitPlaneStrategy 130 407 408 #splitPlaneStrategy 384 409 #splitPlaneStrategy 130 410 411 splitPlaneStrategy 32 412 413 maxPolyCandidates 100 414 maxRayCandidates 0 415 416 maxTests 10000 417 418 subdivisionStats ../subDivisionStats.log 419 420 # factors for evaluating split plane costs 421 Factor { 422 verticalSplits 1.0 423 largestPolyArea 1.0 424 blockedRays 1.0 425 leastRaySplits 1.0 426 balancedRays 1.0 427 pvs 1.0 428 leastSplits 1.0 429 balancedPolys 1.0 430 balancedViewCells 1.0 431 } 432 433 Termination { 434 # parameters used for autopartition 435 minRays -1 436 minPolygons 0 437 maxDepth 30 438 minPvs -1 439 minProbability 0.00001 440 maxRayContribution 9999 441 maxViewCells 50000 442 443 # used for pvs criterium 444 ct_div_ci 0.0 445 446 maxCostRatio 0.9 447 448 # axis aligned splits 449 AxisAligned { 450 minPolys 5000 451 minRays 500 452 minObjects 10 453 ct_div_ci 0.5 454 } 455 } 456 457 AxisAligned { 458 splitBorder 0.01 459 } 460 461 462 Visualization { 463 # x3d visualization of the split planes 464 exportSplits false 465 } 466 } 467
Note: See TracChangeset
for help on using the changeset viewer.