Changeset 2571 for GTP/trunk/Lib/Vis/Preprocessing
- Timestamp:
- 12/18/07 17:40:35 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/run_demo_arena
r2567 r2571 13 13 14 14 $COMMAND -preprocessor=combined -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 15 -rss_distributions= spatial \15 -rss_distributions=mutation+object_direction+spatial \ 16 16 -view_cells_use_kd_pvs+ -af_use_kd_pvs+ \ 17 17 -preprocessor_visibility_file=$PREFIX-i-mixed-b1-n4a.xml \ -
GTP/trunk/Lib/Vis/Preprocessing/scripts/run_demo_vienna
r2534 r2571 19 19 #PREFIX=../work/plots/atlanta2-rss9 20 20 21 #-rss_distributions=mutation+object_direction+spatial \ 21 22 22 23 $COMMAND -preprocessor=combined -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 23 -rss_distributions= mutation+object_direction+spatial\24 -rss_distributions=object_direction \ 24 25 -view_cells_use_kd_pvs+ -af_use_kd_pvs+ \ 25 26 -preprocessor_visibility_file=$PREFIX-i-mixed-b1-n4a.xml \ -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r2564 r2571 211 211 const float importance = log10(1e3*ray->mWeightedPvsContribution)/3.0f; 212 212 213 glColor3f(importance, importance, importance); 213 glColor3f(1.0f, 0.0f, 0.0f); 214 //glColor3f(importance, importance, importance); 214 215 glVertex3fv(&ray->mOrigin.x); 215 216 glVertex3fv(&ray->mTermination.x); … … 1455 1456 1456 1457 if (mPvsErrorBuffer[i].mError > 0.0f) 1457 1458 { 1458 1459 int pvsSize; 1459 1460 1460 1461 // compute the pixel error 1461 1462 float error = GetPixelError(pvsSize); 1462 1463 1463 1464 mPvsErrorBuffer[i].mError = error; 1464 1465 mPvsErrorBuffer[i].mPvsSize = pvsSize; 1465 1466 1466 1467 cout << "(" << i << "," << mPvsErrorBuffer[i].mError <<")"; 1467 1468 1468 } 1469 1469 1470 err = mPvsErrorBuffer[i].mError; 1470 1471 1471 1472 if (err >= 0.0f) 1472 1473 { 1473 1474 if (err > mPvsStat.maxError) 1474 mPvsStat.maxError = err;1475 1475 mPvsStat.maxError = err; 1476 1476 1477 mPvsStat.sumError += err; 1477 1478 1479 1478 mPvsStat.sumPvsSize += mPvsErrorBuffer[i].mPvsSize; 1479 1480 if (err == 0.0f) 1480 1481 ++ mPvsStat.errorFreeFrames; 1481 1482 1483 1482 1483 ++ mPvsStat.frames; 1484 } 1484 1485 } 1485 1486 -
GTP/trunk/Lib/Vis/Preprocessing/src/IntersectableWrapper.cpp
r2570 r2571 132 132 133 133 KdIntersectable::KdIntersectable(KdNode *item, const AxisAlignedBox3 &box) : 134 IntersectableWrapper<KdNode *>(item), mNumTriangles(-1) 134 IntersectableWrapper<KdNode *>(item), mNumTriangles(-1), mBox(box) 135 135 { 136 136 } -
GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp
r2569 r2571 1410 1410 // not in map => create new entry 1411 1411 const int id = (int)mKdIntersectables.size(); 1412 KdIntersectable *kdObj = new KdIntersectable(node, GetBox(node)); ;1412 KdIntersectable *kdObj = new KdIntersectable(node, GetBox(node)); 1413 1413 node->mIntersectable = kdObj; 1414 1414 -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2570 r2571 303 303 glEnable(GL_LIGHT1); 304 304 305 306 305 // set position of the light 307 306 GLfloat infinite_light[] = { 1.0, 0.8, 1.0, 0.0 }; … … 313 312 314 313 glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); 315 // 314 // glColorMaterial( GL_FRONT_AND_BACK, GL_SPECULAR); 316 315 glEnable(GL_COLOR_MATERIAL); 317 316 318 glShadeModel( GL_FLAT);317 glShadeModel(GL_FLAT); 319 318 } 320 319 … … 712 711 glColor3f(0.6f, 0.6f, 0.6f); 713 712 RenderPvs(); 713 } 714 715 if (1 && mShowRays) 716 { 717 RenderRays(mViewCellsManager->mVizBuffer.GetRays()); 714 718 } 715 719 } … … 1151 1155 if (mViewCellsManager) 1152 1156 { 1157 const float f = number / 1000.0f; 1153 1158 AxisAlignedBox3 box = mViewCellsManager->GetViewSpaceBox(); 1154 Vector3 p = box.Min() + (number/1000.0f)*box.Max();1159 Vector3 p = (1.0f - f) * box.Min() + f * box.Max(); 1155 1160 mSceneCutPlane.mNormal = Vector3(0,-1,0); 1156 1161 mSceneCutPlane.mD = -DotProd(mSceneCutPlane.mNormal, p); … … 1278 1283 ViewCell *vc = viewcells[i]; 1279 1284 1280 if (mShowPvsSizes) // pv 1285 if (mShowPvsSizes) // pvs size 1281 1286 { 1282 1287 //const int p = vc->GetPvs().CountObjectsInPvs(); … … 1336 1341 { 1337 1342 //glDisable(GL_CULL_FACE); 1338 //glEnable(GL_CULL_FACE);1339 //glFrontFace(GL_CCW);1340 1343 //glCullFace(GL_BACK); 1344 1341 1345 if (!mUseTransparency) 1342 1346 { … … 1346 1350 else 1347 1351 { 1348 //glCullFace(GL_BACK);1349 //cout << "here29 " << mTransparency << endl;1350 1352 glDisable(GL_DEPTH_TEST); 1351 1353 glEnable(GL_BLEND); … … 1410 1412 glEnable(GL_DEPTH_TEST); 1411 1413 } 1414 1415 glEnable(GL_CULL_FACE); 1416 glDisable(GL_CULL_FACE); 1417 1418 glDisable(GL_CLIP_PLANE0); 1412 1419 1413 1420 mUseFalseColors = false; -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.cpp
r2569 r2571 16 16 #include "RssPreprocessor.h" 17 17 #include "SceneGraph.h" 18 #include "ViewCellsManager.h" 18 19 19 20 … … 50 51 51 52 // This method has to be rendefined by all renderer implementations 52 void 53 QtGlViewer::RenderScene() 54 { 53 void QtGlViewer::RenderScene() 54 { 55 GLfloat mat_ambient[] = {0.1, 0.1, 0.1, 1.0}; 56 57 // mat_specular and mat_shininess are NOT default values 58 GLfloat mat_diffuse[] = {0.5, 1.0, 0.5, 1.0}; 59 GLfloat mat_specular[] = {0.3, 0.3, 0.3, 1.0}; 60 GLfloat mat_shininess[] = {1.0}; 61 62 GLfloat light_ambient[] = {0.1, 0.1, 0.1, 1.0}; 63 GLfloat light_diffuse[] = {0.5, 0.5, 0.5, 1.0}; 64 GLfloat light_specular[] = {0.0, 0.0, 0.0, 1.0}; 65 66 GLfloat lmodel_ambient[] = {0.2, 0.2, 0.2, 1.0}; 67 68 69 // default material 70 /*glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, mat_ambient); 71 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, mat_diffuse); 72 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, mat_specular); 73 glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, mat_shininess); 74 */ 75 // a light 76 glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient); 77 glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse); 78 glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular); 79 glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); 80 81 82 //GLfloat infinite_light2[] = {-0.3, 1.5f, 1.0f, 0.0f}; 83 //glLightfv (GL_LIGHT1, GL_POSITION, infinite_light2); 84 glColor3f(0.8f, 0.8f, 0.8f); 85 86 glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); 87 glDisable(GL_COLOR_MATERIAL); 88 //glEnable(GL_COLOR_MATERIAL); 89 55 90 ++ mRenderer->mFrame; 56 91 57 //glDisable(GL_DEPTH_TEST); 92 glEnable(GL_DEPTH_TEST); 93 glDepthMask(GL_TRUE); 94 95 glCullFace(GL_BACK); 96 glShadeModel(GL_FLAT); 97 98 glDisable(GL_BLEND); 58 99 59 100 mRenderer->mDummyViewPoint = mDummyViewPoint; 60 glColor3f(0.8f, 0.8f, 0.8f); 101 102 //glEnable(GL_LIGHTING); 103 61 104 mRenderer->RenderPvs(); 62 105 63 // if (mRenderer->mShowRays) { 64 // RssPreprocessor *p = (RssPreprocessor *) 65 // mRenderer->mViewCellsManager->GetPreprocessor(); 66 // if (p->mRssTree) { 67 // VssRayContainer rays; 68 // p->mRssTree->CollectRays(rays, 10000); 69 // mRenderer->RenderRays(rays); 70 // } 71 // } 106 glDisable(GL_LIGHTING); 107 108 if (0 && mRenderer->mShowRays) 109 { 110 mRenderer->RenderRays(mRenderer->mViewCellsManager->mVizBuffer.GetRays()); 111 } 72 112 73 113 if (mRenderer->mShowRenderCost) … … 101 141 << "Info: GL Extensions = "<<extString<<endl<<flush; 102 142 143 144 glEnable(GL_LIGHTING); 145 glEnable(GL_LIGHT0); 146 //glEnable(GL_LIGHT1); 147 148 // set position of the light 149 GLfloat infinite_light[] = {0, -1.0, 0, 1.0f}; 150 glLightfv(GL_LIGHT0, GL_POSITION, infinite_light); 103 151 104 152 return; -
GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.h
r2559 r2571 17 17 class SimpleRayContainer; 18 18 class AxisAlignedBox3; 19 //class Vector3;20 19 struct VssRayContainer; 21 20 class Preprocessor; … … 107 106 return mRays + mIndex ++; 108 107 } 108 109 109 protected: 110 110 111 VssRay *mRays; 111 112 int mIndex; -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r2570 r2571 2671 2671 void ViewCellsManager::UpdateStatsForViewCell(ViewCell *vc, Intersectable *obj) 2672 2672 { 2673 KdIntersectable *kdObj = static_cast<KdIntersectable *>(obj); 2674 2675 const AxisAlignedBox3 box = kdObj->GetBox(); 2676 const float dist = SqrDistance(vc->GetBox().Center(), box.Center()); 2677 2678 float f; 2679 2680 const float radius = mViewSpaceBox.Radius(); 2681 const float fullRadius = mViewSpaceBox.Radius(); 2682 2683 const float minVal = 0.1f; 2684 const float maxVal = 1.0f; 2685 2686 if (dist <= radius) 2687 f = maxVal; 2688 else if (dist >= fullRadius) 2689 f = minVal; 2690 else // linear blending 2691 { 2692 f = minVal * (dist - radius) + maxVal * (fullRadius - radius - dist); 2693 } 2694 2695 const int numTriangles = kdObj->ComputeNumTriangles(); 2696 2697 vc->GetPvs().mStats.mDistanceWeightedTriangles += f * numTriangles; 2698 vc->GetPvs().mStats.mDistanceWeightedPvs += f; 2699 vc->GetPvs().mStats.mWeightedTriangles += numTriangles; 2673 KdIntersectable *kdObj = static_cast<KdIntersectable *>(obj); 2674 2675 const AxisAlignedBox3 box = kdObj->GetBox(); 2676 const float dist = Distance(vc->GetBox().Center(), box.Center()); 2677 2678 float f; 2679 2680 const float radius = box.Radius(); 2681 const float fullRadius = max(0.2f * mViewSpaceBox.Radius(), radius); 2682 2683 const float minVal = 0.01f; 2684 const float maxVal = 1.0f; 2685 2686 if (dist <= radius) 2687 f = maxVal; 2688 else if (dist >= fullRadius) 2689 f = minVal; 2690 else // linear blending 2691 { 2692 f = minVal * (dist - radius) / (fullRadius - radius) + 2693 maxVal * (fullRadius - radius - dist) / (fullRadius - radius); 2694 } 2695 2696 //cout << "x " << radius << " " << dist << " " << fullRadius << " " << f << " " << f * f << endl; 2697 2698 const int numTriangles = kdObj->ComputeNumTriangles(); 2699 2700 vc->GetPvs().mStats.mDistanceWeightedTriangles += f * numTriangles; 2701 vc->GetPvs().mStats.mDistanceWeightedPvs += f ; 2702 vc->GetPvs().mStats.mWeightedTriangles += numTriangles; 2700 2703 } 2701 2704 … … 2725 2728 //hasAbsContribution = viewCell->GetPvs().AddSample(obj,ray.mPdf); 2726 2729 #if 1 2727 UpdateStatsForViewCell(viewCell, obj); 2730 if (hasAbsContribution) 2731 { 2732 UpdateStatsForViewCell(viewCell, obj); 2733 mVizBuffer.AddRay(&ray); 2734 } 2728 2735 #endif 2729 2736 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r2570 r2571 79 79 typedef pair<ViewCell *, SimpleRayContainer> ViewCellPoints; 80 80 81 struct VizBuffer 82 { 83 VizBuffer(): mIndex(0), mMaxSize(10000) 84 { 85 } 86 87 int GetSize() const {return (int)mVizRays.size();} 88 89 void AddRay(VssRay *ray) 90 { 91 if (mVizRays.size() < mMaxSize) 92 mVizRays.push_back(ray); 93 else 94 mVizRays[mIndex] = ray; 95 96 mIndex = (mIndex + 1) % mMaxSize; 97 } 98 99 VssRayContainer &GetRays() { return mVizRays;} 100 101 VssRay *GetRay(int i) { return mVizRays[i % 100];} 102 103 protected: 104 105 const int mMaxSize; 106 int mIndex; 107 VssRayContainer mVizRays; 108 }; 109 110 81 111 /** Manages different higher order operations on the view cells. 82 112 */ … … 600 630 void ResetPvs(); 601 631 602 Preprocessor *GetPreprocessor() const { 632 Preprocessor *GetPreprocessor() const 633 { 603 634 return mPreprocessor; 604 635 } 605 636 606 void SetPreprocessor(Preprocessor *p) { 637 void SetPreprocessor(Preprocessor *p) 638 { 607 639 mPreprocessor = p; 608 640 } … … 614 646 615 647 void UpdatePvsForEvaluation(); 648 649 650 VizBuffer mVizBuffer; 651 616 652 617 653 protected: … … 810 846 811 847 848 812 849 ////////////////// 813 850 //-- visualization options
Note: See TracChangeset
for help on using the changeset viewer.