Changeset 2065


Ignore:
Timestamp:
01/29/07 19:00:03 (17 years ago)
Author:
mattausch
Message:

debug version: something wrong with the pvs!

Location:
GTP/trunk/Lib/Vis/Preprocessing
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/generate_viewcells.env

    r2064 r2065  
    66Scene { 
    77#       filename ../data/vienna/vienna_cropped.obj 
    8         filename ../data/soda/soda5.dat 
     8        filename ../data/soda/soda5.obj 
    99} 
    1010 
    1111 
    1212Preprocessor { 
     13samplesPerPass 3000000 
    1314        useGlRenderer false 
    1415        type vss 
    1516        detectEmptyViewSpace true 
     17        #loadMeshes true 
    1618        loadMeshes false 
    1719        # internal raycaster 
     
    8486                maxDepth 20 
    8587                 
    86                 maxCostRatio 1.5 
     88                maxCostRatio 2.5 
    8789                ct_div_ci 0.5 
    8890        } 
     
    9294        splitBorder 0.01 
    9395} 
     96 
    9497 
    9598MeshKdTree { 
     
    151154        Visualization { 
    152155                # how much samples we use for visualization 
    153                 samples 0 
     156                samples 20000 
    154157                exportRays true 
    155158                exportGeometry true 
     
    184187VspBspTree { 
    185188        Construction { 
    186                 samples 500000 
     189                samples 300000 
    187190                epsilon 0.0000001 
    188191                randomize false 
  • GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp

    r2048 r2065  
    740740        { 
    741741                cout << "bvh local termination criteria met:" << endl; 
    742                 cout << "objects: " << (int)tData.mNode->mObjects.size() << " " << mTermMinObjects << endl; 
     742                cout << "objects: " << (int)tData.mNode->mObjects.size() << " (" << mTermMinObjects << ")" << endl; 
    743743        } 
    744744#endif 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.cpp

    r2017 r2065  
    150150                SetFilled(); 
    151151                 
    152                 if (0) 
     152                if (1) 
    153153                        ExportGeometry(leaf->mObjects, true, box); 
    154154                else 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r2053 r2065  
    13131313        } 
    13141314 
     1315        cout << "here5" << endl; 
     1316 
    13151317        DeterminePvsObjects(vssRays); 
    13161318} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.cpp

    r2017 r2065  
    143143        Intersectable::NewMail(); 
    144144        KdLeaf::NewMail(); 
    145         BvhNode::NewMail(); 
     145 
     146        cout << "here55 " << GetSize() << endl; 
    146147 
    147148        ObjectPvsEntries::const_iterator it, it_end = mEntries.end(); 
     
    161162                                } 
    162163                        case Intersectable::BVH_INTERSECTABLE: 
    163                                 { 
     164                                {cout<< "i"; 
    164165                                        BvhNode *bvhObj = static_cast<BvhNode *>(obj); 
    165166                                        pvs += EvalBvhNodeContribution(bvhObj); 
     
    172173        } 
    173174 
     175        cout << "here44 " << pvs << endl; 
    174176        return pvs; 
    175177} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r2064 r2065  
    742742        vector<int>::const_iterator iit, iit_end = strategies.end(); 
    743743 
     744        cout << "===============================\n" << endl; 
    744745        for (iit = strategies.begin(); iit != iit_end; ++ iit) 
    745746        { 
     
    762763                 << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 
    763764 
     765        cout << "===============================\n" << endl; 
    764766        return (int)passSamples.size(); 
    765767} 
     
    18101812{ 
    18111813 
    1812         if ((vc->GetPvs().EvalPvsCost() > maxPvsSize) || 
    1813                 (vc->GetPvs().EvalPvsCost() < minPvsSize)) 
    1814         { 
     1814        const float pvsCost = vc->GetPvs().EvalPvsCost(); 
     1815 
     1816        if ((pvsCost > maxPvsSize) || (pvsCost < minPvsSize)) 
     1817        { 
     1818                cout << "err: " << pvsCost << " " << minPvsSize << " " << maxPvsSize << endl; 
    18151819                return false; 
    18161820        } 
     
    26872691                                                                          const bool useHitObjects) 
    26882692{ 
    2689   if (!useHitObjects) { 
    2690         VssRayContainer::const_iterator it, it_end = rays.end(); 
    2691         for (it = rays.begin(); it != it_end; ++ it) { 
    2692           VssRay *vssRay = *it; 
    2693           // set only the termination object 
    2694           vssRay->mTerminationObject = GetIntersectable( 
    2695                                                                                                         *vssRay, 
    2696                                                                                                         true); 
    2697         } 
    2698   } 
     2693        if (!useHitObjects)  
     2694        { 
     2695                VssRayContainer::const_iterator it, it_end = rays.end(); 
     2696         
     2697                for (it = rays.begin(); it != it_end; ++ it)  
     2698                { 
     2699                        VssRay *vssRay = *it; 
     2700                        // set only the termination object 
     2701                        vssRay->mTerminationObject = GetIntersectable( 
     2702                                *vssRay, 
     2703                                true); 
     2704                } 
     2705        } 
    26992706} 
    27002707 
     
    27562763 
    27572764        if (!GetViewSpaceBox().GetRaySegment(hray, tmin, tmax) || (tmin > tmax)) { 
    2758           //      cerr<<"ray outside view space box\n"; 
     2765          // cerr<<"ray outside view space box\n"; 
    27592766          return 0; 
    27602767        } 
     
    27852792        if (storeViewCells) 
    27862793        {        
    2787           cerr<<"Store viewcells should not be used in the test!"<<endl; 
     2794          // cerr << "Store viewcells should not be used in the test!" << endl; 
    27882795          // copy viewcells memory efficiently 
    27892796#if VSS_STORE_VIEWCELLS 
     
    53205327                { 
    53215328                        cout << "exporting view cells after post process ... "; 
     5329 
    53225330                        if (0) 
    53235331                        {       // export view space box 
     
    63066314                        if (!node->IsLeaf()) 
    63076315                        { 
    6308                                 cout << "error, can only do leaves" << endl; 
     6316                                cout << "error, can only process leaves" << endl; 
    63096317                                return 0; 
    63106318                        } 
     
    63726380                const int savedColorCode = mColorCode; 
    63736381 
    6374                 const float maxRenderCost = UpdateObjectCosts(); 
     6382                const float maxRenderCost = -1;//UpdateObjectCosts(); 
    63756383                cout << "maxRenderCost: " << maxRenderCost << endl; 
    63766384                mColorCode = 0; // 0 = random, 1 = export pvs 
    6377  
    6378                 if (0) 
    6379                 mHierarchyManager->ExportObjectSpaceHierarchy(exporter, objects,  
    6380                                                                                                           CLAMP_TO_BOX ? &bbox : NULL, maxRenderCost, false); 
    6381                  
    6382  
    6383                 //ExportViewCellsForViz(exporter, CLAMP_TO_BOX ? &bbox : NULL, mColorCode, GetClipPlane()); 
    6384                 ExportViewCellsForViz(exporter, NULL, mColorCode, GetClipPlane()); 
    6385  
    6386                 delete exporter; 
    6387  
    6388                 cout << "finished in " << TimeDiff(starttime, GetTime()) * 1e-3f << " secs" << endl; 
    6389                 mColorCode = savedColorCode; 
    6390         } 
    6391  
    6392         exporter = Exporter::GetExporter("final_object_partition.wrl"); 
    6393  
    6394         if (exporter) 
    6395         { 
    6396                 if (CLAMP_TO_BOX) 
    6397                 {        
    6398                         exporter->mClampToBox = true;    
    6399                 } 
    6400  
    6401                 EvaluateViewCellsStats(); 
    6402  
    6403                 const long starttime = GetTime(); 
    6404                 cout << "exporting final objects (after initial construction + post process) ... "; 
    6405  
    6406                 // matt: hack for clamping scene 
    6407                 AxisAlignedBox3 bbox = mViewSpaceBox; 
    6408                 bbox.Scale(scale); 
    6409  
    6410                 // hack color code (show pvs size) 
    6411                 const int savedColorCode = mColorCode; 
    6412  
    6413                 mColorCode = 1; // 0 = random, 1 = export pvs 
    6414                 // don't visualize render cost 
    6415                 const float maxRenderCost = -1; 
    64166385 
    64176386                if (1) 
     
    64206389                 
    64216390 
    6422                 //ExportViewCellsForViz(exporter, CLAMP_TO_BOX ? &bbox : NULL, mColorCode, GetClipPlane()); 
    6423                 if (0) 
     6391                if (1) 
     6392                { 
     6393                        //ExportViewCellsForViz(exporter, CLAMP_TO_BOX ? &bbox : NULL, mColorCode, GetClipPlane()); 
    64246394                        ExportViewCellsForViz(exporter, NULL, mColorCode, GetClipPlane()); 
     6395                } 
     6396 
     6397                delete exporter; 
     6398 
     6399                cout << "finished in " << TimeDiff(starttime, GetTime()) * 1e-3f << " secs" << endl; 
     6400                mColorCode = savedColorCode; 
     6401        } 
     6402 
     6403        exporter = Exporter::GetExporter("final_object_partition.wrl"); 
     6404 
     6405        if (exporter) 
     6406        { 
     6407                if (CLAMP_TO_BOX) 
     6408                {        
     6409                        exporter->mClampToBox = true;    
     6410                } 
     6411 
     6412                EvaluateViewCellsStats(); 
     6413 
     6414                const long starttime = GetTime(); 
     6415                cout << "exporting final objects (after initial construction + post process) ... "; 
     6416 
     6417                // matt: hack for clamping scene 
     6418                AxisAlignedBox3 bbox = mViewSpaceBox; 
     6419                bbox.Scale(scale); 
     6420 
     6421                // hack color code (show pvs size) 
     6422                const int savedColorCode = mColorCode; 
     6423 
     6424                mColorCode = 1; // 0 = random, 1 = export pvs 
     6425                // don't visualize render cost 
     6426                const float maxRenderCost = -1; 
     6427 
     6428                if (1) 
     6429                mHierarchyManager->ExportObjectSpaceHierarchy(exporter, objects,  
     6430                                                                                                          CLAMP_TO_BOX ? &bbox : NULL, maxRenderCost, false); 
     6431                 
     6432 
     6433                if (1) 
     6434                { 
     6435                        ExportViewCellsForViz(exporter, NULL, mColorCode, GetClipPlane()); 
     6436                        //ExportViewCellsForViz(exporter, CLAMP_TO_BOX ? &bbox : NULL, mColorCode, GetClipPlane()); 
     6437                } 
    64256438 
    64266439                delete exporter; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.cpp

    r2063 r2065  
    406406        else 
    407407        { 
    408                 while (totalSamples < mInitialSamples) { 
     408                while (totalSamples < mInitialSamples)  
     409                { 
    409410                        int passContributingSamples = 0; 
    410411                        int passSampleContributions = 0; 
     
    477478                ExportSamples(mVssRays); 
    478479                cout << "finished\n" << endl; 
    479  
    480                 /*VssRayContainer dummyRays; 
    481                 LoadSamples(dummyRays, mObjects); 
    482                 Debug << "rays " << (int)mVssRays.size() << " " << dummyRays.size() << endl; 
    483  
    484                 for (int i = 0; i < (int)mVssRays.size(); ++ i) 
    485                 { 
    486                 Debug << mVssRays[i]->GetOrigin() << " " << mVssRays[i]->GetTermination() << " " << mVssRays[i]->mOriginObject << " " << mVssRays[i]->mTerminationObject << endl; 
    487                 Debug << dummyRays[i]->GetOrigin() << " " << dummyRays[i]->GetTermination() << " " << dummyRays[i]->mOriginObject << " " << dummyRays[i]->mTerminationObject << endl << endl; 
    488                 }*/ 
    489480        } 
    490481 
     
    519510        // get viewcells as kd tree boxes 
    520511        vector<AxisAlignedBox3> kdViewcells; 
    521         if (0) { 
     512        if (0)  
     513        { 
    522514                vector<KdLeaf *> leaves; 
    523515                mKdTree->CollectLeaves(leaves); 
     
    541533        while (samples < mVssSamples)  
    542534        { 
    543  
    544535                int num = mVssSamplesPerPass; 
    545536                SimpleRayContainer rays; 
    546537                VssRayContainer vssRays; 
    547538 
    548                 if (!mUseImportanceSampling) { 
     539                if (!mUseImportanceSampling)  
     540                { 
    549541                        for (int j=0; j < num; j++) { 
    550542                                Vector3 viewpoint;  
     
    556548                                                           ); 
    557549                        } 
    558                 } else { 
     550                }  
     551                else  
     552                { 
    559553                        num = GenerateImportanceRays(vssTree, num, rays); 
    560554                } 
     
    563557                vssTree->AddRays(vssRays); 
    564558 
    565                 if (0) { 
     559                if (0)  
     560                { 
    566561                        int subdivided = vssTree->UpdateSubdivision(); 
    567562                        cout<<"subdivided leafs = "<<subdivided<<endl; 
     
    584579                } 
    585580 
    586                 samples+=num; 
     581                samples += num; 
     582 
    587583                float pvs = vssTree->GetAvgPvsSize(); 
    588584                cout<<"*****************************\n"; 
     
    627623void VssPreprocessor::DeterminePvsObjects(VssRayContainer &rays) 
    628624{ 
     625        //Preprocessor::DeterminePvsObjects(rays); 
     626 
     627        cout << "here4"; 
    629628        mViewCellsManager->DeterminePvsObjects(rays, true); 
    630629} 
Note: See TracChangeset for help on using the changeset viewer.